Browse Source

♻️ Adjust LCD init, contrast default, settings load

Scott Lahteine 3 years ago
parent
commit
d5f2334140

+ 1
- 1
Marlin/src/HAL/LPC1768/inc/SanityCheck.h View File

113
   #define _IS_RX1_1 IS_RX1
113
   #define _IS_RX1_1 IS_RX1
114
   #if IS_TX1(TMC_SW_SCK)
114
   #if IS_TX1(TMC_SW_SCK)
115
     #error "Serial port pins (1) conflict with other pins!"
115
     #error "Serial port pins (1) conflict with other pins!"
116
-  #elif HAS_WIRED_LCD
116
+  #elif HAS_ROTARY_ENCODER
117
     #if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
117
     #if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1)
118
       #error "Serial port pins (1) conflict with Encoder Buttons!"
118
       #error "Serial port pins (1) conflict with Encoder Buttons!"
119
     #elif ANY_TX(1, SD_SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, SHIFT_CLK_PIN) \
119
     #elif ANY_TX(1, SD_SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, SHIFT_CLK_PIN) \

+ 10
- 14
Marlin/src/MarlinCore.cpp View File

1294
   // UI must be initialized before EEPROM
1294
   // UI must be initialized before EEPROM
1295
   // (because EEPROM code calls the UI).
1295
   // (because EEPROM code calls the UI).
1296
 
1296
 
1297
-  #if HAS_DWIN_E3V2_BASIC
1298
-    SETUP_RUN(DWIN_Startup());
1299
-  #else
1300
-    SETUP_RUN(ui.init());
1301
-    #if BOTH(HAS_WIRED_LCD, SHOW_BOOTSCREEN)
1302
-      SETUP_RUN(ui.show_bootscreen());
1303
-      const millis_t bootscreen_ms = millis();
1304
-    #endif
1305
-    SETUP_RUN(ui.reset_status());     // Load welcome message early. (Retained if no errors exist.)
1306
-  #endif
1297
+  SETUP_RUN(ui.init());
1307
 
1298
 
1308
   #if PIN_EXISTS(SAFE_POWER)
1299
   #if PIN_EXISTS(SAFE_POWER)
1309
     #if HAS_DRIVER_SAFE_POWER_PROTECT
1300
     #if HAS_DRIVER_SAFE_POWER_PROTECT
1314
     #endif
1305
     #endif
1315
   #endif
1306
   #endif
1316
 
1307
 
1317
-  #if ENABLED(PROBE_TARE)
1318
-    SETUP_RUN(probe.tare_init());
1319
-  #endif
1320
-
1321
   #if BOTH(SDSUPPORT, SDCARD_EEPROM_EMULATION)
1308
   #if BOTH(SDSUPPORT, SDCARD_EEPROM_EMULATION)
1322
     SETUP_RUN(card.mount());          // Mount media with settings before first_load
1309
     SETUP_RUN(card.mount());          // Mount media with settings before first_load
1323
   #endif
1310
   #endif
1325
   SETUP_RUN(settings.first_load());   // Load data from EEPROM if available (or use defaults)
1312
   SETUP_RUN(settings.first_load());   // Load data from EEPROM if available (or use defaults)
1326
                                       // This also updates variables in the planner, elsewhere
1313
                                       // This also updates variables in the planner, elsewhere
1327
 
1314
 
1315
+  #if BOTH(HAS_WIRED_LCD, SHOW_BOOTSCREEN)
1316
+    SETUP_RUN(ui.show_bootscreen());
1317
+    const millis_t bootscreen_ms = millis();
1318
+  #endif
1319
+
1320
+  #if ENABLED(PROBE_TARE)
1321
+    SETUP_RUN(probe.tare_init());
1322
+  #endif
1323
+
1328
   #if HAS_ETHERNET
1324
   #if HAS_ETHERNET
1329
     SETUP_RUN(ethernet.init());
1325
     SETUP_RUN(ethernet.init());
1330
   #endif
1326
   #endif

+ 1
- 1
Marlin/src/gcode/lcd/M250.cpp View File

31
  * M250: Read and optionally set the LCD contrast
31
  * M250: Read and optionally set the LCD contrast
32
  */
32
  */
33
 void GcodeSuite::M250() {
33
 void GcodeSuite::M250() {
34
-  if (parser.seenval('C'))
34
+  if (LCD_CONTRAST_MIN < LCD_CONTRAST_MAX && parser.seenval('C'))
35
     ui.set_contrast(parser.value_byte());
35
     ui.set_contrast(parser.value_byte());
36
   else
36
   else
37
     M250_report();
37
     M250_report();

+ 1
- 1
Marlin/src/inc/Conditionals_LCD.h View File

237
   #define LCD_HEIGHT                  10    // Character lines
237
   #define LCD_HEIGHT                  10    // Character lines
238
   #define LCD_CONTRAST_MIN            127
238
   #define LCD_CONTRAST_MIN            127
239
   #define LCD_CONTRAST_MAX            255
239
   #define LCD_CONTRAST_MAX            255
240
-  #define DEFAULT_LCD_CONTRAST        250
240
+  #define LCD_CONTRAST_DEFAULT        250
241
   #define CONVERT_TO_EXT_ASCII        // Use extended 128-255 symbols from ASCII table.
241
   #define CONVERT_TO_EXT_ASCII        // Use extended 128-255 symbols from ASCII table.
242
                                       // At this time present conversion only for cyrillic - bg, ru and uk languages.
242
                                       // At this time present conversion only for cyrillic - bg, ru and uk languages.
243
                                       // First 7 ASCII symbols in panel font must be replaced with Marlin's special symbols.
243
                                       // First 7 ASCII symbols in panel font must be replaced with Marlin's special symbols.

+ 2
- 9
Marlin/src/inc/Conditionals_post.h View File

376
 #elif EITHER(MKS_MINI_12864_V3, BTT_MINI_12864_V1)
376
 #elif EITHER(MKS_MINI_12864_V3, BTT_MINI_12864_V1)
377
   #define _LCD_CONTRAST_MIN  255
377
   #define _LCD_CONTRAST_MIN  255
378
   #define _LCD_CONTRAST_INIT 255
378
   #define _LCD_CONTRAST_INIT 255
379
-  #define _LCD_CONTRAST_MAX  255
380
 #elif ENABLED(FYSETC_MINI_12864)
379
 #elif ENABLED(FYSETC_MINI_12864)
381
   #define _LCD_CONTRAST_INIT 220
380
   #define _LCD_CONTRAST_INIT 220
382
 #elif ENABLED(ULTI_CONTROLLER)
381
 #elif ENABLED(ULTI_CONTROLLER)
389
 #elif ENABLED(ZONESTAR_12864OLED)
388
 #elif ENABLED(ZONESTAR_12864OLED)
390
   #define _LCD_CONTRAST_MIN   64
389
   #define _LCD_CONTRAST_MIN   64
391
   #define _LCD_CONTRAST_INIT 128
390
   #define _LCD_CONTRAST_INIT 128
392
-  #define _LCD_CONTRAST_MAX  255
393
 #elif IS_TFTGLCD_PANEL
391
 #elif IS_TFTGLCD_PANEL
394
-  #define _LCD_CONTRAST_MIN    0
395
   #define _LCD_CONTRAST_INIT 250
392
   #define _LCD_CONTRAST_INIT 250
396
-  #define _LCD_CONTRAST_MAX  255
397
 #endif
393
 #endif
398
 
394
 
399
 #ifdef _LCD_CONTRAST_INIT
395
 #ifdef _LCD_CONTRAST_INIT
400
   #define HAS_LCD_CONTRAST 1
396
   #define HAS_LCD_CONTRAST 1
401
-#endif
402
-
403
-#if HAS_LCD_CONTRAST
404
   #ifndef LCD_CONTRAST_MIN
397
   #ifndef LCD_CONTRAST_MIN
405
     #ifdef _LCD_CONTRAST_MIN
398
     #ifdef _LCD_CONTRAST_MIN
406
       #define LCD_CONTRAST_MIN _LCD_CONTRAST_MIN
399
       #define LCD_CONTRAST_MIN _LCD_CONTRAST_MIN
420
       #define LCD_CONTRAST_MAX 63   // ST7567 6-bits contrast
413
       #define LCD_CONTRAST_MAX 63   // ST7567 6-bits contrast
421
     #endif
414
     #endif
422
   #endif
415
   #endif
423
-  #ifndef DEFAULT_LCD_CONTRAST
424
-    #define DEFAULT_LCD_CONTRAST LCD_CONTRAST_INIT
416
+  #ifndef LCD_CONTRAST_DEFAULT
417
+    #define LCD_CONTRAST_DEFAULT LCD_CONTRAST_INIT
425
   #endif
418
   #endif
426
 #endif
419
 #endif
427
 
420
 

+ 4
- 0
Marlin/src/inc/Warnings.cpp View File

559
 #if CANNOT_EMBED_CONFIGURATION
559
 #if CANNOT_EMBED_CONFIGURATION
560
   #warning "Disabled CONFIGURATION_EMBEDDING because the target usually has less flash storage. Define FORCE_CONFIG_EMBED to override."
560
   #warning "Disabled CONFIGURATION_EMBEDDING because the target usually has less flash storage. Define FORCE_CONFIG_EMBED to override."
561
 #endif
561
 #endif
562
+
563
+#if HAS_LCD_CONTRAST && LCD_CONTRAST_MIN >= LCD_CONTRAST_MAX
564
+  #warning "Contrast cannot be changed when LCD_CONTRAST_MIN >= LCD_CONTRAST_MAX."
565
+#endif

+ 3
- 0
Marlin/src/lcd/e3v2/creality/dwin.cpp View File

1834
 
1834
 
1835
 void HMI_SDCardInit() { card.cdroot(); }
1835
 void HMI_SDCardInit() { card.cdroot(); }
1836
 
1836
 
1837
+// Initialize or re-initialize the LCD
1838
+void MarlinUI::init_lcd() { DWIN_Startup(); }
1839
+
1837
 void MarlinUI::refresh() { /* Nothing to see here */ }
1840
 void MarlinUI::refresh() { /* Nothing to see here */ }
1838
 
1841
 
1839
 #if HAS_LCD_BRIGHTNESS
1842
 #if HAS_LCD_BRIGHTNESS

+ 3
- 0
Marlin/src/lcd/e3v2/enhanced/dwin.cpp View File

888
 
888
 
889
 void HMI_SDCardInit() { card.cdroot(); }
889
 void HMI_SDCardInit() { card.cdroot(); }
890
 
890
 
891
+// Initialize or re-initialize the LCD
892
+void MarlinUI::init_lcd() { DWIN_Startup(); }
893
+
891
 void MarlinUI::refresh() { /* Nothing to see here */ }
894
 void MarlinUI::refresh() { /* Nothing to see here */ }
892
 
895
 
893
 #if HAS_LCD_BRIGHTNESS
896
 #if HAS_LCD_BRIGHTNESS

+ 1
- 1
Marlin/src/lcd/e3v2/jyersui/dwin.cpp View File

4980
   Redraw_Screen();
4980
   Redraw_Screen();
4981
 }
4981
 }
4982
 
4982
 
4983
-void MarlinUI::init() {
4983
+void MarlinUI::init_lcd() {
4984
   delay(800);
4984
   delay(800);
4985
   SERIAL_ECHOPGM("\nDWIN handshake ");
4985
   SERIAL_ECHOPGM("\nDWIN handshake ");
4986
   if (DWIN_Handshake()) SERIAL_ECHOLNPGM("ok."); else SERIAL_ECHOLNPGM("error.");
4986
   if (DWIN_Handshake()) SERIAL_ECHOLNPGM("ok."); else SERIAL_ECHOLNPGM("error.");

+ 1
- 3
Marlin/src/lcd/e3v2/marlinui/ui_common.cpp View File

79
 bool MarlinUI::detected() { return true; }
79
 bool MarlinUI::detected() { return true; }
80
 
80
 
81
 // Initialize or re-initialize the LCD
81
 // Initialize or re-initialize the LCD
82
-void MarlinUI::init_lcd() {
83
-  DWIN_Startup();
84
-}
82
+void MarlinUI::init_lcd() { DWIN_Startup(); }
85
 
83
 
86
 // This LCD should clear where it will draw anew
84
 // This LCD should clear where it will draw anew
87
 void MarlinUI::clear_lcd() {
85
 void MarlinUI::clear_lcd() {

+ 1
- 1
Marlin/src/lcd/extui/ui_api.cpp View File

1144
 
1144
 
1145
 // At the moment we hook into MarlinUI methods, but this could be cleaned up in the future
1145
 // At the moment we hook into MarlinUI methods, but this could be cleaned up in the future
1146
 
1146
 
1147
-void MarlinUI::init() { ExtUI::onStartup(); }
1147
+void MarlinUI::init_lcd() { ExtUI::onStartup(); }
1148
 
1148
 
1149
 void MarlinUI::update() { ExtUI::onIdle(); }
1149
 void MarlinUI::update() { ExtUI::onIdle(); }
1150
 
1150
 

+ 72
- 77
Marlin/src/lcd/marlinui.cpp View File

43
 #if HAS_DISPLAY
43
 #if HAS_DISPLAY
44
   #include "../gcode/queue.h"
44
   #include "../gcode/queue.h"
45
   #include "fontutils.h"
45
   #include "fontutils.h"
46
-  #include "../sd/cardreader.h"
47
 #endif
46
 #endif
48
 
47
 
49
 #if ENABLED(DWIN_CREALITY_LCD)
48
 #if ENABLED(DWIN_CREALITY_LCD)
176
 
175
 
177
 #endif
176
 #endif
178
 
177
 
178
+// Encoder Handling
179
+#if HAS_ENCODER_ACTION
180
+  uint32_t MarlinUI::encoderPosition;
181
+  volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update
182
+#endif
183
+
184
+void MarlinUI::init() {
185
+
186
+  init_lcd();
187
+
188
+  #if HAS_DIGITAL_BUTTONS
189
+    #if BUTTON_EXISTS(EN1)
190
+      SET_INPUT_PULLUP(BTN_EN1);
191
+    #endif
192
+    #if BUTTON_EXISTS(EN2)
193
+      SET_INPUT_PULLUP(BTN_EN2);
194
+    #endif
195
+    #if BUTTON_EXISTS(ENC)
196
+      SET_INPUT_PULLUP(BTN_ENC);
197
+    #endif
198
+    #if BUTTON_EXISTS(ENC_EN)
199
+      SET_INPUT_PULLUP(BTN_ENC_EN);
200
+    #endif
201
+    #if BUTTON_EXISTS(BACK)
202
+      SET_INPUT_PULLUP(BTN_BACK);
203
+    #endif
204
+    #if BUTTON_EXISTS(UP)
205
+      SET_INPUT(BTN_UP);
206
+    #endif
207
+    #if BUTTON_EXISTS(DWN)
208
+      SET_INPUT(BTN_DWN);
209
+    #endif
210
+    #if BUTTON_EXISTS(LFT)
211
+      SET_INPUT(BTN_LFT);
212
+    #endif
213
+    #if BUTTON_EXISTS(RT)
214
+      SET_INPUT(BTN_RT);
215
+    #endif
216
+  #endif
217
+
218
+  #if HAS_SHIFT_ENCODER
219
+
220
+    #if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
221
+
222
+      SET_OUTPUT(SR_DATA_PIN);
223
+      SET_OUTPUT(SR_CLK_PIN);
224
+
225
+    #elif PIN_EXISTS(SHIFT_CLK)
226
+
227
+      SET_OUTPUT(SHIFT_CLK_PIN);
228
+      OUT_WRITE(SHIFT_LD_PIN, HIGH);
229
+      #if PIN_EXISTS(SHIFT_EN)
230
+        OUT_WRITE(SHIFT_EN_PIN, LOW);
231
+      #endif
232
+      SET_INPUT_PULLUP(SHIFT_OUT_PIN);
233
+
234
+    #endif
235
+
236
+  #endif // HAS_SHIFT_ENCODER
237
+
238
+  #if BOTH(HAS_ENCODER_ACTION, HAS_SLOW_BUTTONS)
239
+    slow_buttons = 0;
240
+  #endif
241
+
242
+  update_buttons();
243
+
244
+  TERN_(HAS_ENCODER_ACTION, encoderDiff = 0);
245
+
246
+  reset_status(); // Set welcome message
247
+}
248
+
179
 #if HAS_WIRED_LCD
249
 #if HAS_WIRED_LCD
180
 
250
 
181
   #if HAS_MARLINUI_U8GLIB
251
   #if HAS_MARLINUI_U8GLIB
184
 
254
 
185
   #include "lcdprint.h"
255
   #include "lcdprint.h"
186
 
256
 
187
-  #include "../sd/cardreader.h"
188
-
189
   #include "../module/temperature.h"
257
   #include "../module/temperature.h"
190
   #include "../module/planner.h"
258
   #include "../module/planner.h"
191
   #include "../module/motion.h"
259
   #include "../module/motion.h"
247
     bool MarlinUI::old_is_printing;
315
     bool MarlinUI::old_is_printing;
248
   #endif
316
   #endif
249
 
317
 
250
-  // Encoder Handling
251
-  #if HAS_ENCODER_ACTION
252
-    uint32_t MarlinUI::encoderPosition;
253
-    volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update
254
-  #endif
255
-
256
   #if ENABLED(SDSUPPORT)
318
   #if ENABLED(SDSUPPORT)
257
 
319
 
258
-    #include "../sd/cardreader.h"
259
-
260
     #if MARLINUI_SCROLL_NAME
320
     #if MARLINUI_SCROLL_NAME
261
       uint8_t MarlinUI::filename_scroll_pos, MarlinUI::filename_scroll_max;
321
       uint8_t MarlinUI::filename_scroll_pos, MarlinUI::filename_scroll_max;
262
     #endif
322
     #endif
393
 
453
 
394
   #endif // HAS_LCD_MENU
454
   #endif // HAS_LCD_MENU
395
 
455
 
396
-  void MarlinUI::init() {
397
-
398
-    init_lcd();
399
-
400
-    #if HAS_DIGITAL_BUTTONS
401
-      #if BUTTON_EXISTS(EN1)
402
-        SET_INPUT_PULLUP(BTN_EN1);
403
-      #endif
404
-      #if BUTTON_EXISTS(EN2)
405
-        SET_INPUT_PULLUP(BTN_EN2);
406
-      #endif
407
-      #if BUTTON_EXISTS(ENC)
408
-        SET_INPUT_PULLUP(BTN_ENC);
409
-      #endif
410
-      #if BUTTON_EXISTS(ENC_EN)
411
-        SET_INPUT_PULLUP(BTN_ENC_EN);
412
-      #endif
413
-      #if BUTTON_EXISTS(BACK)
414
-        SET_INPUT_PULLUP(BTN_BACK);
415
-      #endif
416
-      #if BUTTON_EXISTS(UP)
417
-        SET_INPUT(BTN_UP);
418
-      #endif
419
-      #if BUTTON_EXISTS(DWN)
420
-        SET_INPUT(BTN_DWN);
421
-      #endif
422
-      #if BUTTON_EXISTS(LFT)
423
-        SET_INPUT(BTN_LFT);
424
-      #endif
425
-      #if BUTTON_EXISTS(RT)
426
-        SET_INPUT(BTN_RT);
427
-      #endif
428
-    #endif
429
-
430
-    #if HAS_SHIFT_ENCODER
431
-
432
-      #if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
433
-
434
-        SET_OUTPUT(SR_DATA_PIN);
435
-        SET_OUTPUT(SR_CLK_PIN);
436
-
437
-      #elif PIN_EXISTS(SHIFT_CLK)
438
-
439
-        SET_OUTPUT(SHIFT_CLK_PIN);
440
-        OUT_WRITE(SHIFT_LD_PIN, HIGH);
441
-        #if PIN_EXISTS(SHIFT_EN)
442
-          OUT_WRITE(SHIFT_EN_PIN, LOW);
443
-        #endif
444
-        SET_INPUT_PULLUP(SHIFT_OUT_PIN);
445
-
446
-      #endif
447
-
448
-    #endif // HAS_SHIFT_ENCODER
449
-
450
-    #if BOTH(HAS_ENCODER_ACTION, HAS_SLOW_BUTTONS)
451
-      slow_buttons = 0;
452
-    #endif
453
-
454
-    update_buttons();
455
-
456
-    TERN_(HAS_ENCODER_ACTION, encoderDiff = 0);
457
-  }
458
-
459
   ////////////////////////////////////////////
456
   ////////////////////////////////////////////
460
   ///////////// Keypad Handling //////////////
457
   ///////////// Keypad Handling //////////////
461
   ////////////////////////////////////////////
458
   ////////////////////////////////////////////
629
           next_filament_display = millis() + 5000UL;  // Show status message for 5s
626
           next_filament_display = millis() + 5000UL;  // Show status message for 5s
630
         #endif
627
         #endif
631
         goto_screen(menu_main);
628
         goto_screen(menu_main);
632
-        #if DISABLED(NO_LCD_REINIT)
633
-          init_lcd(); // May revive the LCD if static electricity killed it
634
-        #endif
629
+        IF_DISABLED(NO_LCD_REINIT, init_lcd()); // May revive the LCD if static electricity killed it
635
         return;
630
         return;
636
       }
631
       }
637
 
632
 

+ 15
- 14
Marlin/src/lcd/marlinui.h View File

21
  */
21
  */
22
 #pragma once
22
 #pragma once
23
 
23
 
24
+#include "../sd/cardreader.h"
24
 #include "../module/motion.h"
25
 #include "../module/motion.h"
25
 #include "buttons.h"
26
 #include "buttons.h"
26
 
27
 
30
   #include "../libs/buzzer.h"
31
   #include "../libs/buzzer.h"
31
 #endif
32
 #endif
32
 
33
 
33
-#if ENABLED(SDSUPPORT)
34
-  #include "../sd/cardreader.h"
35
-#endif
36
-
37
 #if ENABLED(TOUCH_SCREEN_CALIBRATION)
34
 #if ENABLED(TOUCH_SCREEN_CALIBRATION)
38
   #include "tft_io/touch_calibration.h"
35
   #include "tft_io/touch_calibration.h"
39
 #endif
36
 #endif
204
     TERN_(HAS_LCD_MENU, currentScreen = status_screen);
201
     TERN_(HAS_LCD_MENU, currentScreen = status_screen);
205
   }
202
   }
206
 
203
 
204
+  static void init();
205
+
206
+  #if HAS_DISPLAY || HAS_DWIN_E3V2
207
+    static void init_lcd();
208
+  #else
209
+    static void init_lcd() {}
210
+  #endif
211
+
212
+  #if HAS_WIRED_LCD
213
+    static bool detected();
214
+  #else
215
+    static bool detected() { return true; }
216
+  #endif
217
+
207
   #if HAS_MULTI_LANGUAGE
218
   #if HAS_MULTI_LANGUAGE
208
     static uint8_t language;
219
     static uint8_t language;
209
     static void set_language(const uint8_t lang);
220
     static void set_language(const uint8_t lang);
270
     }
281
     }
271
   #endif
282
   #endif
272
 
283
 
273
-  #if HAS_WIRED_LCD
274
-    static bool detected();
275
-    static void init_lcd();
276
-  #else
277
-    static bool detected() { return true; }
278
-    static void init_lcd() {}
279
-  #endif
280
-
281
   #if HAS_PRINT_PROGRESS
284
   #if HAS_PRINT_PROGRESS
282
     #if HAS_PRINT_PROGRESS_PERMYRIAD
285
     #if HAS_PRINT_PROGRESS_PERMYRIAD
283
       typedef uint16_t progress_t;
286
       typedef uint16_t progress_t;
365
 
368
 
366
   #if HAS_DISPLAY
369
   #if HAS_DISPLAY
367
 
370
 
368
-    static void init();
369
     static void update();
371
     static void update();
370
 
372
 
371
     static void abort_print();
373
     static void abort_print();
480
 
482
 
481
   #else // No LCD
483
   #else // No LCD
482
 
484
 
483
-    static void init() {}
484
     static void update() {}
485
     static void update() {}
485
     static void return_to_status() {}
486
     static void return_to_status() {}
486
 
487
 

+ 1
- 1
Marlin/src/lcd/menu/menu_configuration.cpp View File

538
   #if HAS_LCD_BRIGHTNESS
538
   #if HAS_LCD_BRIGHTNESS
539
     EDIT_ITEM_FAST(uint8, MSG_BRIGHTNESS, &ui.brightness, LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.refresh_brightness, true);
539
     EDIT_ITEM_FAST(uint8, MSG_BRIGHTNESS, &ui.brightness, LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.refresh_brightness, true);
540
   #endif
540
   #endif
541
-  #if HAS_LCD_CONTRAST
541
+  #if HAS_LCD_CONTRAST && LCD_CONTRAST_MIN < LCD_CONTRAST_MAX
542
     EDIT_ITEM_FAST(uint8, MSG_CONTRAST, &ui.contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, ui.refresh_contrast, true);
542
     EDIT_ITEM_FAST(uint8, MSG_CONTRAST, &ui.contrast, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX, ui.refresh_contrast, true);
543
   #endif
543
   #endif
544
   #if ENABLED(FWRETRACT)
544
   #if ENABLED(FWRETRACT)

+ 17
- 27
Marlin/src/module/settings.cpp View File

1965
       //
1965
       //
1966
       #if HAS_USER_THERMISTORS
1966
       #if HAS_USER_THERMISTORS
1967
       {
1967
       {
1968
+        user_thermistor_t user_thermistor[USER_THERMISTORS];
1968
         _FIELD_TEST(user_thermistor);
1969
         _FIELD_TEST(user_thermistor);
1969
-        EEPROM_READ(thermalManager.user_thermistor);
1970
+        EEPROM_READ(user_thermistor);
1971
+        if (!validating) COPY(thermalManager.user_thermistor, user_thermistor);
1970
       }
1972
       }
1971
       #endif
1973
       #endif
1972
 
1974
 
1974
       // Power monitor
1976
       // Power monitor
1975
       //
1977
       //
1976
       {
1978
       {
1977
-        #if HAS_POWER_MONITOR
1978
-          uint8_t &power_monitor_flags = power_monitor.flags;
1979
-        #else
1980
-          uint8_t power_monitor_flags;
1981
-        #endif
1979
+        uint8_t power_monitor_flags;
1982
         _FIELD_TEST(power_monitor_flags);
1980
         _FIELD_TEST(power_monitor_flags);
1983
         EEPROM_READ(power_monitor_flags);
1981
         EEPROM_READ(power_monitor_flags);
1982
+        TERN_(HAS_POWER_MONITOR, if (!validating) power_monitor.flags = power_monitor_flags);
1984
       }
1983
       }
1985
 
1984
 
1986
       //
1985
       //
1997
       // LCD Brightness
1996
       // LCD Brightness
1998
       //
1997
       //
1999
       {
1998
       {
2000
-        _FIELD_TEST(lcd_brightness);
2001
         uint8_t lcd_brightness;
1999
         uint8_t lcd_brightness;
2002
         EEPROM_READ(lcd_brightness);
2000
         EEPROM_READ(lcd_brightness);
2003
         TERN_(HAS_LCD_BRIGHTNESS, if (!validating) ui.set_brightness(lcd_brightness));
2001
         TERN_(HAS_LCD_BRIGHTNESS, if (!validating) ui.set_brightness(lcd_brightness));
2007
       // Controller Fan
2005
       // Controller Fan
2008
       //
2006
       //
2009
       {
2007
       {
2008
+        controllerFan_settings_t cfs = { 0 };
2010
         _FIELD_TEST(controllerFan_settings);
2009
         _FIELD_TEST(controllerFan_settings);
2011
-        #if ENABLED(CONTROLLER_FAN_EDITABLE)
2012
-          const controllerFan_settings_t &cfs = controllerFan.settings;
2013
-        #else
2014
-          controllerFan_settings_t cfs = { 0 };
2015
-        #endif
2016
         EEPROM_READ(cfs);
2010
         EEPROM_READ(cfs);
2011
+        TERN_(CONTROLLER_FAN_EDITABLE, if (!validating) controllerFan.settings = cfs);
2017
       }
2012
       }
2018
 
2013
 
2019
       //
2014
       //
2020
       // Power-Loss Recovery
2015
       // Power-Loss Recovery
2021
       //
2016
       //
2022
       {
2017
       {
2018
+        bool recovery_enabled;
2023
         _FIELD_TEST(recovery_enabled);
2019
         _FIELD_TEST(recovery_enabled);
2024
-        #if ENABLED(POWER_LOSS_RECOVERY)
2025
-          const bool &recovery_enabled = recovery.enabled;
2026
-        #else
2027
-          bool recovery_enabled;
2028
-        #endif
2029
         EEPROM_READ(recovery_enabled);
2020
         EEPROM_READ(recovery_enabled);
2021
+        TERN_(POWER_LOSS_RECOVERY, if (!validating) recovery.enabled = recovery_enabled);
2030
       }
2022
       }
2031
 
2023
 
2032
       //
2024
       //
2033
       // Firmware Retraction
2025
       // Firmware Retraction
2034
       //
2026
       //
2035
       {
2027
       {
2028
+        fwretract_settings_t fwretract_settings;
2029
+        bool autoretract_enabled;
2036
         _FIELD_TEST(fwretract_settings);
2030
         _FIELD_TEST(fwretract_settings);
2031
+        EEPROM_READ(fwretract_settings);
2032
+        EEPROM_READ(autoretract_enabled);
2037
 
2033
 
2038
         #if ENABLED(FWRETRACT)
2034
         #if ENABLED(FWRETRACT)
2039
-          EEPROM_READ(fwretract.settings);
2040
-        #else
2041
-          fwretract_settings_t fwretract_settings;
2042
-          EEPROM_READ(fwretract_settings);
2043
-        #endif
2044
-        #if BOTH(FWRETRACT, FWRETRACT_AUTORETRACT)
2045
-          EEPROM_READ(fwretract.autoretract_enabled);
2046
-        #else
2047
-          bool autoretract_enabled;
2048
-          EEPROM_READ(autoretract_enabled);
2035
+          if (!validating) {
2036
+            fwretract.settings = fwretract_settings;
2037
+            TERN_(FWRETRACT_AUTORETRACT, fwretract.autoretract_enabled = autoretract_enabled);
2038
+          }
2049
         #endif
2039
         #endif
2050
       }
2040
       }
2051
 
2041
 

+ 1
- 1
Marlin/src/pins/mega/pins_GT2560_REV_A.h View File

127
 
127
 
128
       #define LCD_RESET_PIN                   16
128
       #define LCD_RESET_PIN                   16
129
 
129
 
130
-      #define DEFAULT_LCD_CONTRAST           220
130
+      #define LCD_CONTRAST_DEFAULT           220
131
 
131
 
132
       #define LCD_BACKLIGHT_PIN               -1
132
       #define LCD_BACKLIGHT_PIN               -1
133
     #else
133
     #else

+ 1
- 1
Marlin/src/pins/mega/pins_HJC2560C_REV2.h View File

134
     #if ENABLED(HJC_LCD_SMART_CONTROLLER)
134
     #if ENABLED(HJC_LCD_SMART_CONTROLLER)
135
       #define LCD_BACKLIGHT_PIN                5  // LCD_Backlight
135
       #define LCD_BACKLIGHT_PIN                5  // LCD_Backlight
136
       //#ifndef LCD_CONTRAST_PIN
136
       //#ifndef LCD_CONTRAST_PIN
137
-      //  #define LCD_CONTRAST_PIN  5   // LCD_Contrast
137
+      //  #define LCD_CONTRAST_PIN             5  // LCD_Contrast
138
       //#endif
138
       //#endif
139
       #ifndef FIL_RUNOUT_PIN
139
       #ifndef FIL_RUNOUT_PIN
140
         #define FIL_RUNOUT_PIN                24  // Filament runout
140
         #define FIL_RUNOUT_PIN                24  // Filament runout

+ 1
- 1
Marlin/src/pins/ramps/pins_K8800.h View File

107
 
107
 
108
   #define LCD_CONTRAST_MIN                     0
108
   #define LCD_CONTRAST_MIN                     0
109
   #define LCD_CONTRAST_MAX                   100
109
   #define LCD_CONTRAST_MAX                   100
110
-  #define DEFAULT_LCD_CONTRAST                30
110
+  #define LCD_CONTRAST_DEFAULT                30
111
   //#define LCD_SCREEN_ROTATE                180  // 0, 90, 180, 270
111
   //#define LCD_SCREEN_ROTATE                180  // 0, 90, 180, 270
112
 
112
 
113
   #if IS_NEWPANEL
113
   #if IS_NEWPANEL

+ 1
- 1
Marlin/src/pins/stm32f4/pins_ARTILLERY_RUBY.h View File

157
       #define NEOPIXEL_PIN                  PB9
157
       #define NEOPIXEL_PIN                  PB9
158
     #endif
158
     #endif
159
 
159
 
160
-    #define DEFAULT_LCD_CONTRAST             255
160
+    #define LCD_CONTRAST_DEFAULT             255
161
   #else
161
   #else
162
     #define LCD_PINS_RS                     PC15
162
     #define LCD_PINS_RS                     PC15
163
     #define LCD_PINS_ENABLE                 PB6
163
     #define LCD_PINS_ENABLE                 PB6

Loading…
Cancel
Save