summaryrefslogtreecommitdiff
path: root/NxWidgets
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-10-30 11:21:25 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-10-30 11:21:25 -0600
commit9c190bae9b5d3082d156626dc7c741691a3338cd (patch)
tree126bf12b5c653ea99b85995f93cd777dab7b6910 /NxWidgets
parent126a5c275c84910761067dee75f1e4dbaf05bb9a (diff)
downloadnuttx-9c190bae9b5d3082d156626dc7c741691a3338cd.tar.gz
nuttx-9c190bae9b5d3082d156626dc7c741691a3338cd.tar.bz2
nuttx-9c190bae9b5d3082d156626dc7c741691a3338cd.zip
Saving of touchscreen calibration but be done in CCalbration each time the touchscreen is calibrated, not just once on startup
Diffstat (limited to 'NxWidgets')
-rw-r--r--NxWidgets/ChangeLog.txt5
-rw-r--r--NxWidgets/UnitTests/nxwm/nxwm_main.cxx2
-rw-r--r--NxWidgets/nxwm/src/ccalibration.cxx19
3 files changed, 24 insertions, 2 deletions
diff --git a/NxWidgets/ChangeLog.txt b/NxWidgets/ChangeLog.txt
index 28c5ae888..53ea2745f 100644
--- a/NxWidgets/ChangeLog.txt
+++ b/NxWidgets/ChangeLog.txt
@@ -405,3 +405,8 @@
touchscreen calibration data. This depends upon having platform-dependent
support for storate of configuration data. Portions suggested by
Ken Pettit (2013-10-30).
+* NxWM:Calibration: Saving of calibration data must be performed in
+ CCalibration, not in UnitTests/nxwm. Why? Because the touchscreen
+ calibration could also be initiated from other ways other than through
+ the one-time, start-up initialization logic (2013-10-30).
+
diff --git a/NxWidgets/UnitTests/nxwm/nxwm_main.cxx b/NxWidgets/UnitTests/nxwm/nxwm_main.cxx
index 62b19bb23..0787a6cba 100644
--- a/NxWidgets/UnitTests/nxwm/nxwm_main.cxx
+++ b/NxWidgets/UnitTests/nxwm/nxwm_main.cxx
@@ -794,7 +794,7 @@ int nxwm_main(int argc, char *argv[])
}
else
{
-#ifdef CONFIG_NXWM_TOUCHCREEN_CONFIGDATA
+#if 0 // ifdef CONFIG_NXWM_TOUCHCREEN_CONFIGDATA. Done in CCalibration
// Save the new calibration data so that we do not have to do this
// again the next time we start up.
diff --git a/NxWidgets/nxwm/src/ccalibration.cxx b/NxWidgets/nxwm/src/ccalibration.cxx
index c7910f557..562ef206e 100644
--- a/NxWidgets/nxwm/src/ccalibration.cxx
+++ b/NxWidgets/nxwm/src/ccalibration.cxx
@@ -45,6 +45,10 @@
#include <assert.h>
#include <debug.h>
+#ifdef CONFIG_NXWM_TOUCHCREEN_CONFIGDATA
+# include <arch/platform/configdata.h>
+#endif
+
#include "nxwmconfig.hxx"
#include "nxwmglyphs.hxx"
#include "ctouchscreen.hxx"
@@ -1099,7 +1103,20 @@ void CCalibration::finishCalibration(void)
struct SCalibrationData caldata;
if (createCalibrationData(caldata))
{
- // And provide this to the touchscreen, enabling touchscreen processing
+#ifdef CONFIG_NXWM_TOUCHCREEN_CONFIGDATA
+ // Save the new calibration data. The saved calibration
+ // data may be used to avoided recalibrating in the future.
+
+ int ret = platform_setconfig(CONFIGDATA_TSCALIBRATION, 0,
+ (FAR const uint8_t *)&caldata,
+ sizeof(struct SCalibrationData));
+ if (ret != 0)
+ {
+ gdbg("ERROR: Failed to save calibration data\n");
+ }
+#endif
+ // And provide the calibration data to the touchscreen, enabling
+ // touchscreen processing
m_touchscreen->setEnabled(false);
m_touchscreen->setCalibrationData(caldata);