Touch Calibration Screen auto-save option (#20971)

This commit is contained in:
Victor Oliveira 2021-02-02 17:31:51 -03:00 committed by GitHub
parent 1f12273de1
commit 617f5dfe5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -2457,6 +2457,10 @@
//#define TOUCH_OFFSET_Y 257
//#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
#if BOTH(TOUCH_SCREEN_CALIBRATION, EEPROM_SETTINGS)
#define TOUCH_CALIBRATION_AUTO_SAVE // Auto save successful calibration values to EEPROM
#endif
#if ENABLED(TFT_COLOR_UI)
//#define SINGLE_TOUCH_NAVIGATION
#endif

View File

@ -28,6 +28,10 @@
#define DEBUG_OUT ENABLED(DEBUG_TOUCH_CALIBRATION)
#include "../../core/debug_out.h"
#if ENABLED(TOUCH_CALIBRATION_AUTO_SAVE)
#include "../../module/settings.h"
#endif
TouchCalibration touch_calibration;
touch_calibration_t TouchCalibration::calibration;
@ -78,6 +82,7 @@ void TouchCalibration::validate_calibration() {
SERIAL_ECHOLNPAIR("TOUCH_OFFSET_X ", calibration.offset_x);
SERIAL_ECHOLNPAIR("TOUCH_OFFSET_Y ", calibration.offset_y);
SERIAL_ECHO_TERNARY(calibration.orientation == TOUCH_LANDSCAPE, "TOUCH_ORIENTATION ", "TOUCH_LANDSCAPE", "TOUCH_PORTRAIT", "\n");
TERN_(TOUCH_CALIBRATION_AUTO_SAVE, settings.save());
}
}