summaryrefslogtreecommitdiff
path: root/NxWidgets/nxwm/src/ccalibration.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'NxWidgets/nxwm/src/ccalibration.cxx')
-rw-r--r--NxWidgets/nxwm/src/ccalibration.cxx19
1 files changed, 18 insertions, 1 deletions
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);