Skip to content

Commit

Permalink
Touch Calibration Screen auto-save option (MarlinFirmware#20971)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhapsodyv authored and Jyers committed Feb 3, 2021
1 parent 44cbf4a commit 799f63f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/lcd/tft_io/touch_calibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}

Expand Down

0 comments on commit 799f63f

Please sign in to comment.