Browse Source

Touch Calibration Screen auto-save option (#20971)

Victor Oliveira 3 years ago
parent
commit
617f5dfe5e
No account linked to committer's email address
2 changed files with 9 additions and 0 deletions
  1. 4
    0
      Marlin/Configuration.h
  2. 5
    0
      Marlin/src/lcd/tft_io/touch_calibration.cpp

+ 4
- 0
Marlin/Configuration.h View File

@@ -2457,6 +2457,10 @@
2457 2457
   //#define TOUCH_OFFSET_Y        257
2458 2458
   //#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
2459 2459
 
2460
+  #if BOTH(TOUCH_SCREEN_CALIBRATION, EEPROM_SETTINGS)
2461
+    #define TOUCH_CALIBRATION_AUTO_SAVE // Auto save successful calibration values to EEPROM
2462
+  #endif
2463
+
2460 2464
   #if ENABLED(TFT_COLOR_UI)
2461 2465
     //#define SINGLE_TOUCH_NAVIGATION
2462 2466
   #endif

+ 5
- 0
Marlin/src/lcd/tft_io/touch_calibration.cpp View File

@@ -28,6 +28,10 @@
28 28
 #define DEBUG_OUT ENABLED(DEBUG_TOUCH_CALIBRATION)
29 29
 #include "../../core/debug_out.h"
30 30
 
31
+#if ENABLED(TOUCH_CALIBRATION_AUTO_SAVE)
32
+  #include "../../module/settings.h"
33
+#endif
34
+
31 35
 TouchCalibration touch_calibration;
32 36
 
33 37
 touch_calibration_t TouchCalibration::calibration;
@@ -78,6 +82,7 @@ void TouchCalibration::validate_calibration() {
78 82
     SERIAL_ECHOLNPAIR("TOUCH_OFFSET_X ", calibration.offset_x);
79 83
     SERIAL_ECHOLNPAIR("TOUCH_OFFSET_Y ", calibration.offset_y);
80 84
     SERIAL_ECHO_TERNARY(calibration.orientation == TOUCH_LANDSCAPE, "TOUCH_ORIENTATION ", "TOUCH_LANDSCAPE", "TOUCH_PORTRAIT", "\n");
85
+    TERN_(TOUCH_CALIBRATION_AUTO_SAVE, settings.save());
81 86
   }
82 87
 }
83 88
 

Loading…
Cancel
Save