summaryrefslogtreecommitdiff
path: root/nuttx/drivers/input/stmpe11_tsc.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-14 21:57:38 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-14 21:57:38 +0000
commit5d5fb0b5646aed4cb074eb317fc09170645c7a3f (patch)
treeaed7b7c4f84c4b2016b606b390e818023d2c3841 /nuttx/drivers/input/stmpe11_tsc.c
parent8c194ec17b4fc4810bde451e803d9cb29db28e59 (diff)
downloadpx4-nuttx-5d5fb0b5646aed4cb074eb317fc09170645c7a3f.tar.gz
px4-nuttx-5d5fb0b5646aed4cb074eb317fc09170645c7a3f.tar.bz2
px4-nuttx-5d5fb0b5646aed4cb074eb317fc09170645c7a3f.zip
Improved thresholding logic in the STMPE11 driver; NxWM: Oops minimizing wrong application
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4737 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/input/stmpe11_tsc.c')
-rw-r--r--nuttx/drivers/input/stmpe11_tsc.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/nuttx/drivers/input/stmpe11_tsc.c b/nuttx/drivers/input/stmpe11_tsc.c
index 70eb11259..afe27ac89 100644
--- a/nuttx/drivers/input/stmpe11_tsc.c
+++ b/nuttx/drivers/input/stmpe11_tsc.c
@@ -986,19 +986,17 @@ void stmpe11_tscworker(FAR struct stmpe11_dev_s *priv, uint8_t intsta)
goto ignored;
}
- /* Perform a thresholding operation so that the results will be more stable */
+ /* Perform a thresholding operation so that the results will be more stable.
+ * If the difference from the last sample is small, then ignore the event.
+ * REVISIT: Should a large change in pressure also generate a event?
+ */
xdiff = x > priv->threshx ? (x - priv->threshx) : (priv->threshx - x);
ydiff = y > priv->threshy ? (y - priv->threshy) : (priv->threshy - y);
- /* If the difference from the last sample is small, then ignore the event.
- * REVISIT: Should a large change in pressure also generate a event?
- */
-
- if (xdiff + ydiff < 6)
+ if (xdiff < CONFIG_STMPE11_THRESHX && ydiff < CONFIG_STMPE11_THRESHY)
{
- /* Little or no change in position ... don't report anything.
- */
+ /* Little or no change in either direction ... don't report anything. */
goto ignored;
}