Saving of touchscreen calibration but be done in CCalbration each time the touchscreen is calibrated, not just once on startup

This commit is contained in:
Gregory Nutt 2013-10-30 11:21:25 -06:00
parent ecb7bd7c43
commit 7a165b1eb9
3 changed files with 24 additions and 2 deletions

View file

@ -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).

View file

@ -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.

View file

@ -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);