diff --git a/ChangeLog.txt b/ChangeLog.txt index 28c5ae888..53ea2745f 100644 --- a/ChangeLog.txt +++ b/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/UnitTests/nxwm/nxwm_main.cxx b/UnitTests/nxwm/nxwm_main.cxx index 62b19bb23..0787a6cba 100644 --- a/UnitTests/nxwm/nxwm_main.cxx +++ b/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/nxwm/src/ccalibration.cxx b/nxwm/src/ccalibration.cxx index c7910f557..562ef206e 100644 --- a/nxwm/src/ccalibration.cxx +++ b/nxwm/src/ccalibration.cxx @@ -45,6 +45,10 @@ #include #include +#ifdef CONFIG_NXWM_TOUCHCREEN_CONFIGDATA +# include +#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);