summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-05-14 21:57:38 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-05-14 21:57:38 +0000
commit443b010ba42ad02107b04c33ccb77da56b5e82ff (patch)
treeaed7b7c4f84c4b2016b606b390e818023d2c3841
parentde973b7ed012f06aa934407840bedb921ecf3dec (diff)
Improved thresholding logic in the STMPE11 driver; NxWM: Oops minimizing wrong application
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4737 7fd9a85b-ad96-42d3-883c-3090e2eb8679
-rwxr-xr-xNxWidgets/ChangeLog.txt1
-rw-r--r--NxWidgets/nxwm/src/capplicationwindow.cxx2
-rw-r--r--NxWidgets/nxwm/src/cnxconsole.cxx2
-rw-r--r--NxWidgets/nxwm/src/ctaskbar.cxx4
-rw-r--r--nuttx/ChangeLog7
-rw-r--r--nuttx/Documentation/NuttxPortingGuide.html9
-rw-r--r--nuttx/configs/README.txt7
-rw-r--r--nuttx/configs/stm3240g-eval/nsh/defconfig10
-rw-r--r--nuttx/configs/stm3240g-eval/nxwm/defconfig9
-rw-r--r--nuttx/drivers/input/stmpe11_tsc.c14
-rw-r--r--nuttx/include/nuttx/input/stmpe11.h17
11 files changed, 69 insertions, 13 deletions
diff --git a/NxWidgets/ChangeLog.txt b/NxWidgets/ChangeLog.txt
index 5b14799bd1..b6d2cf9f8b 100755
--- a/NxWidgets/ChangeLog.txt
+++ b/NxWidgets/ChangeLog.txt
@@ -83,3 +83,4 @@
these: Now support method to report if the application is a full-screen
or a normal application. This is necessary to prevent CTaskbar from
displaying a task bar on top of a full-screen window.
+* NxWM::CTaskbar: Ooops... minimizing the wrong application!
diff --git a/NxWidgets/nxwm/src/capplicationwindow.cxx b/NxWidgets/nxwm/src/capplicationwindow.cxx
index 60ab5a3d3b..320559ef74 100644
--- a/NxWidgets/nxwm/src/capplicationwindow.cxx
+++ b/NxWidgets/nxwm/src/capplicationwindow.cxx
@@ -36,7 +36,7 @@
/********************************************************************************************
* Included Files
********************************************************************************************/
-
+
#include <nuttx/config.h>
#include <nuttx/nx/nxglib.h>
diff --git a/NxWidgets/nxwm/src/cnxconsole.cxx b/NxWidgets/nxwm/src/cnxconsole.cxx
index 264845a039..0d0f8e60eb 100644
--- a/NxWidgets/nxwm/src/cnxconsole.cxx
+++ b/NxWidgets/nxwm/src/cnxconsole.cxx
@@ -36,7 +36,7 @@
/********************************************************************************************
* Included Files
********************************************************************************************/
-
+
#include <nuttx/config.h>
#include <cstdio>
diff --git a/NxWidgets/nxwm/src/ctaskbar.cxx b/NxWidgets/nxwm/src/ctaskbar.cxx
index 3305b945bb..b15916b0a4 100644
--- a/NxWidgets/nxwm/src/ctaskbar.cxx
+++ b/NxWidgets/nxwm/src/ctaskbar.cxx
@@ -36,7 +36,7 @@
/********************************************************************************************
* Included Files
********************************************************************************************/
-
+
#include <nuttx/config.h>
#include <debug.h>
@@ -521,7 +521,7 @@ bool CTaskbar::topApplication(IApplication *app)
{
// Yes.. then minimize the application
- app->setMinimized(true);
+ m_topApp->setMinimized(true);
// And make the application non-visible
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 1311332177..79e746f6bb 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -2760,3 +2760,10 @@
window to revert to the previous window. Not good behavior.
* sched/sched_mergepending.c: Add task switching instrumentation. There is a case
here where instrumentation was missing. Contributed by Petri Tanskanen.
+ CONFIG_STMPE11_THRESHX, CONFIG_STMPE11_THRESHX, and drivers/stmpe11_tsc.c: Add some
+ threasholding controls to all slow down processing of touchscreen samples.
+ This is a problem with NX in multi-user mode: touchscreen data gets sent
+ via a message and when the message queue gets full the sender blocks and
+ touch events are lost. Basic data overrun. The badly effects touchscreen
+ human factors.
+ \ No newline at end of file
diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html
index 4ded08f0fb..15019ad102 100644
--- a/nuttx/Documentation/NuttxPortingGuide.html
+++ b/nuttx/Documentation/NuttxPortingGuide.html
@@ -4730,6 +4730,15 @@ build
<code>CONFIG_STMPE11_REGDEBUG</code>:
Enabled very low register-level debug output. Requires <code>CONFIG_DEBUG</code>.
</li>
+ <li>
+ <code>CONFIG_STMPE11_THRESHX</code> and <code>CONFIG_STMPE11_THRESHY</code>:
+ STMPE11 touchscreen data comes in a a very high rate. New touch positions
+ will only be reported when the X or Y data changes by these thresholds.
+ This trades reduces data rate for some loss in dragging accuracy. The
+ STMPE11 is configure for 12-bit values so the raw ranges are 0-4095. So
+ for example, if your display is 320x240, then THRESHX=13 and THRESHY=17
+ would correspond to one pixel. Default: 12
+ </li>
</ul>
<h3>Analog Devices</h3>
diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt
index 15ff30e114..fc85e89e12 100644
--- a/nuttx/configs/README.txt
+++ b/nuttx/configs/README.txt
@@ -814,6 +814,13 @@ defconfig -- This is a configuration file similar to the Linux
Disable driver temperature sensor functionality.
CONFIG_STMPE11_REGDEBUG
Enabled very low register-level debug output. Requires CONFIG_DEBUG.
+ CONFIG_STMPE11_THRESHX and CONFIG_STMPE11_THRESHY
+ STMPE11 touchscreen data comes in a a very high rate. New touch positions
+ will only be reported when the X or Y data changes by these thresholds.
+ This trades reduces data rate for some loss in dragging accuracy. The
+ STMPE11 is configure for 12-bit values so the raw ranges are 0-4095. So
+ for example, if your display is 320x240, then THRESHX=13 and THRESHY=17
+ would correspond to one pixel. Default: 12
Analog Devices
diff --git a/nuttx/configs/stm3240g-eval/nsh/defconfig b/nuttx/configs/stm3240g-eval/nsh/defconfig
index a0131c9932..0d298f520d 100644
--- a/nuttx/configs/stm3240g-eval/nsh/defconfig
+++ b/nuttx/configs/stm3240g-eval/nsh/defconfig
@@ -990,6 +990,13 @@ CONFIG_INPUT_TSC2007=n
# Disable driver temperature sensor functionality.
# CONFIG_STMPE11_REGDBUG
# Enabled very low register-level debug output. Requires CONFIG_DEBUG.
+# CONFIG_STMPE11_THRESHX and CONFIG_STMPE11_THRESHY
+# STMPE11 touchscreen data comes in a a very high rate. New touch positions
+# will only be reported when the X or Y data changes by these thresholds.
+# This trades reduces data rate for some loss in dragging accuracy. The
+# STMPE11 is configure for 12-bit values so the raw ranges are 0-4095. So
+# for example, if your display is 320x240, then THRESHX=13 and THRESHY=17
+# would correspond to one pixel. Default: 12
#
CONFIG_INPUT_STMPE11=n
CONFIG_STMPE11_SPI=n
@@ -1005,7 +1012,8 @@ CONFIG_STMPE11_GPIOINT_DISABLE=y
CONFIG_STMPE11_SWAPXY=y
CONFIG_STMPE11_TEMP_DISABLE=y
CONFIG_STMPE11_REGDEBUG=n
-
+CONFIG_STMPE11_THRESHX=26
+CONFIG_STMPE11_THRESHY=34
#
# USB Device Configuration
#
diff --git a/nuttx/configs/stm3240g-eval/nxwm/defconfig b/nuttx/configs/stm3240g-eval/nxwm/defconfig
index 3242948f30..ca7b242ce0 100644
--- a/nuttx/configs/stm3240g-eval/nxwm/defconfig
+++ b/nuttx/configs/stm3240g-eval/nxwm/defconfig
@@ -990,6 +990,13 @@ CONFIG_INPUT_TSC2007=n
# Disable driver temperature sensor functionality.
# CONFIG_STMPE11_REGDBUG
# Enabled very low register-level debug output. Requires CONFIG_DEBUG.
+# CONFIG_STMPE11_THRESHX and CONFIG_STMPE11_THRESHY
+# STMPE11 touchscreen data comes in a a very high rate. New touch positions
+# will only be reported when the X or Y data changes by these thresholds.
+# This trades reduces data rate for some loss in dragging accuracy. The
+# STMPE11 is configure for 12-bit values so the raw ranges are 0-4095. So
+# for example, if your display is 320x240, then THRESHX=13 and THRESHY=17
+# would correspond to one pixel. Default: 12
#
CONFIG_INPUT_STMPE11=n
CONFIG_STMPE11_SPI=n
@@ -1005,6 +1012,8 @@ CONFIG_STMPE11_GPIOINT_DISABLE=y
CONFIG_STMPE11_SWAPXY=n
CONFIG_STMPE11_TEMP_DISABLE=y
CONFIG_STMPE11_REGDEBUG=n
+CONFIG_STMPE11_THRESHX=26
+CONFIG_STMPE11_THRESHY=34
#
# USB Device Configuration
diff --git a/nuttx/drivers/input/stmpe11_tsc.c b/nuttx/drivers/input/stmpe11_tsc.c
index 70eb11259f..afe27ac899 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;
}
diff --git a/nuttx/include/nuttx/input/stmpe11.h b/nuttx/include/nuttx/input/stmpe11.h
index 5ecc53af10..2436437e6f 100644
--- a/nuttx/include/nuttx/input/stmpe11.h
+++ b/nuttx/include/nuttx/input/stmpe11.h
@@ -86,6 +86,13 @@
* Disable driver temperature sensor functionality.
* CONFIG_STMPE11_REGDEBUG
* Enabled very low register-level debug output. Requires CONFIG_DEBUG.
+ * CONFIG_STMPE11_THRESHX and CONFIG_STMPE11_THRESHY
+ * STMPE11 touchscreen data comes in a a very high rate. New touch positions
+ * will only be reported when the X or Y data changes by these thresholds.
+ * This trades reduces data rate for some loss in dragging accuracy. The
+ * STMPE11 is configure for 12-bit values so the raw ranges are 0-4095. So
+ * for example, if your display is 320x240, then THRESHX=13 and THRESHY=17
+ * would correspond to one pixel. Default: 12
*/
/* The STMPE811 interfaces with the target CPU via a I2C or SPI interface. The pin IN_1
@@ -127,6 +134,16 @@
# error "Work queue support required. CONFIG_SCHED_WORKQUEUE must be selected."
#endif
+/* Thresholds */
+
+#ifndef CONFIG_STMPE11_THRESHX
+# define CONFIG_STMPE11_THRESHX 12
+#endif
+
+#ifndef CONFIG_STMPE11_THRESHY
+# define CONFIG_STMPE11_THRESHY 12
+#endif
+
/* Debug output */
#ifndef CONFIG_DEBUG