Bladeren bron

Improved EEPROM boot error (#17916)

Scott Lahteine 5 jaren geleden
bovenliggende
commit
52aa459a2d
No account linked to committer's email address

+ 4
- 3
Marlin/src/lcd/language/language_en.h Bestand weergeven

328
   PROGMEM Language_Str MSG_LOAD_EEPROM                     = _UxGT("Load Settings");
328
   PROGMEM Language_Str MSG_LOAD_EEPROM                     = _UxGT("Load Settings");
329
   PROGMEM Language_Str MSG_RESTORE_DEFAULTS                = _UxGT("Restore Defaults");
329
   PROGMEM Language_Str MSG_RESTORE_DEFAULTS                = _UxGT("Restore Defaults");
330
   PROGMEM Language_Str MSG_INIT_EEPROM                     = _UxGT("Initialize EEPROM");
330
   PROGMEM Language_Str MSG_INIT_EEPROM                     = _UxGT("Initialize EEPROM");
331
-  PROGMEM Language_Str MSG_ERR_EEPROM_CRC                  = _UxGT("Err: EEPROM CRC");
332
-  PROGMEM Language_Str MSG_ERR_EEPROM_INDEX                = _UxGT("Err: EEPROM Index");
333
-  PROGMEM Language_Str MSG_ERR_EEPROM_VERSION              = _UxGT("Err: EEPROM Version");
331
+  PROGMEM Language_Str MSG_ERR_EEPROM_CRC                  = _UxGT("EEPROM CRC Error");
332
+  PROGMEM Language_Str MSG_ERR_EEPROM_INDEX                = _UxGT("EEPROM Index Error");
333
+  PROGMEM Language_Str MSG_ERR_EEPROM_VERSION              = _UxGT("EEPROM Version Error");
334
   PROGMEM Language_Str MSG_SETTINGS_STORED                 = _UxGT("Settings Stored");
334
   PROGMEM Language_Str MSG_SETTINGS_STORED                 = _UxGT("Settings Stored");
335
   PROGMEM Language_Str MSG_MEDIA_UPDATE                    = _UxGT("Media Update");
335
   PROGMEM Language_Str MSG_MEDIA_UPDATE                    = _UxGT("Media Update");
336
   PROGMEM Language_Str MSG_RESET_PRINTER                   = _UxGT("Reset Printer");
336
   PROGMEM Language_Str MSG_RESET_PRINTER                   = _UxGT("Reset Printer");
344
   PROGMEM Language_Str MSG_BUTTON_STOP                     = _UxGT("Stop");
344
   PROGMEM Language_Str MSG_BUTTON_STOP                     = _UxGT("Stop");
345
   PROGMEM Language_Str MSG_BUTTON_PRINT                    = _UxGT("Print");
345
   PROGMEM Language_Str MSG_BUTTON_PRINT                    = _UxGT("Print");
346
   PROGMEM Language_Str MSG_BUTTON_RESET                    = _UxGT("Reset");
346
   PROGMEM Language_Str MSG_BUTTON_RESET                    = _UxGT("Reset");
347
+  PROGMEM Language_Str MSG_BUTTON_IGNORE                   = _UxGT("Ignore");
347
   PROGMEM Language_Str MSG_BUTTON_CANCEL                   = _UxGT("Cancel");
348
   PROGMEM Language_Str MSG_BUTTON_CANCEL                   = _UxGT("Cancel");
348
   PROGMEM Language_Str MSG_BUTTON_DONE                     = _UxGT("Done");
349
   PROGMEM Language_Str MSG_BUTTON_DONE                     = _UxGT("Done");
349
   PROGMEM Language_Str MSG_BUTTON_BACK                     = _UxGT("Back");
350
   PROGMEM Language_Str MSG_BUTTON_BACK                     = _UxGT("Back");

+ 4
- 12
Marlin/src/lcd/menu/menu.cpp Bestand weergeven

34
   #include "../../libs/buzzer.h"
34
   #include "../../libs/buzzer.h"
35
 #endif
35
 #endif
36
 
36
 
37
-#if ENABLED(EEPROM_SETTINGS)
38
-  #include "../../module/configuration_store.h"
39
-#endif
40
-
41
 #if WATCH_HOTENDS || WATCH_BED
37
 #if WATCH_HOTENDS || WATCH_BED
42
   #include "../../module/temperature.h"
38
   #include "../../module/temperature.h"
43
 #endif
39
 #endif
228
         if (on_status_screen())
224
         if (on_status_screen())
229
           doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL;
225
           doubleclick_expire_ms = millis() + DOUBLECLICK_MAX_INTERVAL;
230
       }
226
       }
231
-      else if (screen == status_screen && currentScreen == menu_main && PENDING(millis(), doubleclick_expire_ms)) {
227
+      else if (on_status_screen() && currentScreen == menu_main && PENDING(millis(), doubleclick_expire_ms)) {
232
         if ( (ENABLED(BABYSTEP_WITHOUT_HOMING) || all_axes_known())
228
         if ( (ENABLED(BABYSTEP_WITHOUT_HOMING) || all_axes_known())
233
           && (ENABLED(BABYSTEP_ALWAYS_AVAILABLE) || printer_busy()) )
229
           && (ENABLED(BABYSTEP_ALWAYS_AVAILABLE) || printer_busy()) )
234
           screen = TERN(BABYSTEP_ZPROBE_OFFSET, lcd_babystep_zoffset, lcd_babystep_z);
230
           screen = TERN(BABYSTEP_ZPROBE_OFFSET, lcd_babystep_zoffset, lcd_babystep_z);
245
     encoderPosition = encoder;
241
     encoderPosition = encoder;
246
     encoderTopLine = top;
242
     encoderTopLine = top;
247
     screen_items = items;
243
     screen_items = items;
248
-    if (screen == status_screen) {
244
+    if (on_status_screen()) {
249
       defer_status_screen(false);
245
       defer_status_screen(false);
250
       TERN_(AUTO_BED_LEVELING_UBL, ubl.lcd_map_control = false);
246
       TERN_(AUTO_BED_LEVELING_UBL, ubl.lcd_map_control = false);
251
       screen_history_depth = 0;
247
       screen_history_depth = 0;
256
     // Re-initialize custom characters that may be re-used
252
     // Re-initialize custom characters that may be re-used
257
     #if HAS_CHARACTER_LCD
253
     #if HAS_CHARACTER_LCD
258
       if (TERN1(AUTO_BED_LEVELING_UBL, !ubl.lcd_map_control))
254
       if (TERN1(AUTO_BED_LEVELING_UBL, !ubl.lcd_map_control))
259
-        set_custom_characters(screen == status_screen ? CHARSET_INFO : CHARSET_MENU);
255
+        set_custom_characters(on_status_screen() ? CHARSET_INFO : CHARSET_MENU);
260
     #endif
256
     #endif
261
 
257
 
262
     refresh(LCDVIEW_CALL_REDRAW_NEXT);
258
     refresh(LCDVIEW_CALL_REDRAW_NEXT);
383
 
379
 
384
 #endif // BABYSTEP_ZPROBE_OFFSET
380
 #endif // BABYSTEP_ZPROBE_OFFSET
385
 
381
 
386
-#if ENABLED(EEPROM_SETTINGS)
387
-  void lcd_store_settings() { ui.completion_feedback(settings.save()); }
388
-  void lcd_load_settings()  { ui.completion_feedback(settings.load()); }
389
-#endif
390
-
391
 void _lcd_draw_homing() {
382
 void _lcd_draw_homing() {
392
   constexpr uint8_t line = (LCD_HEIGHT - 1) / 2;
383
   constexpr uint8_t line = (LCD_HEIGHT - 1) / 2;
393
   if (ui.should_draw()) MenuItem_static::draw(line, GET_TEXT(MSG_LEVEL_BED_HOMING));
384
   if (ui.should_draw()) MenuItem_static::draw(line, GET_TEXT(MSG_LEVEL_BED_HOMING));
416
   if (got_click || ui.should_draw()) {
407
   if (got_click || ui.should_draw()) {
417
     draw_select_screen(yes, no, ui_selection, pref, string, suff);
408
     draw_select_screen(yes, no, ui_selection, pref, string, suff);
418
     if (got_click) { ui_selection ? yesFunc() : noFunc(); }
409
     if (got_click) { ui_selection ? yesFunc() : noFunc(); }
410
+    ui.defer_status_screen();
419
   }
411
   }
420
 }
412
 }
421
 
413
 

+ 0
- 5
Marlin/src/lcd/menu/menu.h Bestand weergeven

589
   #endif
589
   #endif
590
 #endif
590
 #endif
591
 
591
 
592
-#if ENABLED(EEPROM_SETTINGS)
593
-  void lcd_store_settings();
594
-  void lcd_load_settings();
595
-#endif
596
-
597
 #if ENABLED(POWER_LOSS_RECOVERY)
592
 #if ENABLED(POWER_LOSS_RECOVERY)
598
   void menu_job_recovery();
593
   void menu_job_recovery();
599
 #endif
594
 #endif

+ 3
- 12
Marlin/src/lcd/menu/menu_advanced.cpp Bestand weergeven

47
   #include "../../feature/runout.h"
47
   #include "../../feature/runout.h"
48
 #endif
48
 #endif
49
 
49
 
50
-#if ENABLED(EEPROM_SETTINGS) && DISABLED(SLIM_LCD_MENUS)
50
+#if ENABLED(SD_FIRMWARE_UPDATE)
51
   #include "../../module/configuration_store.h"
51
   #include "../../module/configuration_store.h"
52
 #endif
52
 #endif
53
 
53
 
97
 
97
 
98
 #endif
98
 #endif
99
 
99
 
100
-#if ENABLED(SD_FIRMWARE_UPDATE)
101
-  #include "../../module/configuration_store.h"
102
-#endif
103
-
104
 #if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE)
100
 #if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE)
105
   //
101
   //
106
   // Advanced Settings > Filament
102
   // Advanced Settings > Filament
591
   #if ENABLED(EEPROM_SETTINGS) && DISABLED(SLIM_LCD_MENUS)
587
   #if ENABLED(EEPROM_SETTINGS) && DISABLED(SLIM_LCD_MENUS)
592
     CONFIRM_ITEM(MSG_INIT_EEPROM,
588
     CONFIRM_ITEM(MSG_INIT_EEPROM,
593
       MSG_BUTTON_INIT, MSG_BUTTON_CANCEL,
589
       MSG_BUTTON_INIT, MSG_BUTTON_CANCEL,
594
-      []{
595
-        const bool inited = settings.init_eeprom();
596
-        ui.completion_feedback(inited);
597
-        UNUSED(inited);
598
-      },
599
-      ui.goto_previous_screen,
600
-      GET_TEXT(MSG_INIT_EEPROM), (PGM_P)nullptr, PSTR("?")
590
+      ui.init_eeprom, ui.goto_previous_screen,
591
+      GET_TEXT(MSG_INIT_EEPROM), (const char *)nullptr, PSTR("?")
601
     );
592
     );
602
   #endif
593
   #endif
603
 
594
 

+ 1
- 1
Marlin/src/lcd/menu/menu_bed_corners.cpp Bestand weergeven

86
             ui.goto_previous_screen_no_defer();
86
             ui.goto_previous_screen_no_defer();
87
           }
87
           }
88
         , GET_TEXT(TERN(LEVEL_CENTER_TOO, MSG_LEVEL_BED_NEXT_POINT, MSG_NEXT_CORNER))
88
         , GET_TEXT(TERN(LEVEL_CENTER_TOO, MSG_LEVEL_BED_NEXT_POINT, MSG_NEXT_CORNER))
89
-        , (PGM_P)nullptr, PSTR("?")
89
+        , (const char*)nullptr, PSTR("?")
90
       );
90
       );
91
     });
91
     });
92
     ui.set_selection(true);
92
     ui.set_selection(true);

+ 2
- 2
Marlin/src/lcd/menu/menu_bed_leveling.cpp Bestand weergeven

279
   #endif
279
   #endif
280
 
280
 
281
   #if ENABLED(EEPROM_SETTINGS)
281
   #if ENABLED(EEPROM_SETTINGS)
282
-    ACTION_ITEM(MSG_LOAD_EEPROM, lcd_load_settings);
283
-    ACTION_ITEM(MSG_STORE_EEPROM, lcd_store_settings);
282
+    ACTION_ITEM(MSG_LOAD_EEPROM, ui.load_settings);
283
+    ACTION_ITEM(MSG_STORE_EEPROM, ui.store_settings);
284
   #endif
284
   #endif
285
   END_MENU();
285
   END_MENU();
286
 }
286
 }

+ 5
- 8
Marlin/src/lcd/menu/menu_configuration.cpp Bestand weergeven

30
 
30
 
31
 #include "menu.h"
31
 #include "menu.h"
32
 
32
 
33
-#include "../../module/configuration_store.h"
34
-
35
 #if HAS_FILAMENT_SENSOR
33
 #if HAS_FILAMENT_SENSOR
36
   #include "../../feature/runout.h"
34
   #include "../../feature/runout.h"
37
 #endif
35
 #endif
174
     EDIT_ITEM_FAST(float42_52, MSG_HOTEND_OFFSET_Y, &hotend_offset[1].y, -99.0, 99.0, _recalc_offsets);
172
     EDIT_ITEM_FAST(float42_52, MSG_HOTEND_OFFSET_Y, &hotend_offset[1].y, -99.0, 99.0, _recalc_offsets);
175
     EDIT_ITEM_FAST(float42_52, MSG_HOTEND_OFFSET_Z, &hotend_offset[1].z, Z_PROBE_LOW_POINT, 10.0, _recalc_offsets);
173
     EDIT_ITEM_FAST(float42_52, MSG_HOTEND_OFFSET_Z, &hotend_offset[1].z, Z_PROBE_LOW_POINT, 10.0, _recalc_offsets);
176
     #if ENABLED(EEPROM_SETTINGS)
174
     #if ENABLED(EEPROM_SETTINGS)
177
-      ACTION_ITEM(MSG_STORE_EEPROM, lcd_store_settings);
175
+      ACTION_ITEM(MSG_STORE_EEPROM, ui.store_settings);
178
     #endif
176
     #endif
179
     END_MENU();
177
     END_MENU();
180
   }
178
   }
335
       EDIT_ITEM(int3, MSG_BED, &ui.preheat_bed_temp[material], BED_MINTEMP, BED_MAX_TARGET);
333
       EDIT_ITEM(int3, MSG_BED, &ui.preheat_bed_temp[material], BED_MINTEMP, BED_MAX_TARGET);
336
     #endif
334
     #endif
337
     #if ENABLED(EEPROM_SETTINGS)
335
     #if ENABLED(EEPROM_SETTINGS)
338
-      ACTION_ITEM(MSG_STORE_EEPROM, lcd_store_settings);
336
+      ACTION_ITEM(MSG_STORE_EEPROM, ui.store_settings);
339
     #endif
337
     #endif
340
     END_MENU();
338
     END_MENU();
341
   }
339
   }
439
   #endif
437
   #endif
440
 
438
 
441
   #if ENABLED(EEPROM_SETTINGS)
439
   #if ENABLED(EEPROM_SETTINGS)
442
-    ACTION_ITEM(MSG_STORE_EEPROM, lcd_store_settings);
443
-    if (!busy) ACTION_ITEM(MSG_LOAD_EEPROM, lcd_load_settings);
440
+    ACTION_ITEM(MSG_STORE_EEPROM, ui.store_settings);
441
+    if (!busy) ACTION_ITEM(MSG_LOAD_EEPROM, ui.load_settings);
444
   #endif
442
   #endif
445
 
443
 
446
-  if (!busy)
447
-    ACTION_ITEM(MSG_RESTORE_DEFAULTS, []{ settings.reset(); ui.completion_feedback(); });
444
+  if (!busy) ACTION_ITEM(MSG_RESTORE_DEFAULTS, ui.reset_settings);
448
 
445
 
449
   END_MENU();
446
   END_MENU();
450
 }
447
 }

+ 2
- 2
Marlin/src/lcd/menu/menu_delta_calibrate.cpp Bestand weergeven

126
   #if ENABLED(DELTA_AUTO_CALIBRATION)
126
   #if ENABLED(DELTA_AUTO_CALIBRATION)
127
     GCODES_ITEM(MSG_DELTA_AUTO_CALIBRATE, PSTR("G33"));
127
     GCODES_ITEM(MSG_DELTA_AUTO_CALIBRATE, PSTR("G33"));
128
     #if ENABLED(EEPROM_SETTINGS)
128
     #if ENABLED(EEPROM_SETTINGS)
129
-      ACTION_ITEM(MSG_STORE_EEPROM, lcd_store_settings);
130
-      ACTION_ITEM(MSG_LOAD_EEPROM, lcd_load_settings);
129
+      ACTION_ITEM(MSG_STORE_EEPROM, ui.store_settings);
130
+      ACTION_ITEM(MSG_LOAD_EEPROM, ui.load_settings);
131
     #endif
131
     #endif
132
   #endif
132
   #endif
133
 
133
 

+ 1
- 1
Marlin/src/lcd/menu/menu_main.cpp Bestand weergeven

103
         MenuItem_confirm::select_screen(
103
         MenuItem_confirm::select_screen(
104
           GET_TEXT(MSG_BUTTON_STOP), GET_TEXT(MSG_BACK),
104
           GET_TEXT(MSG_BUTTON_STOP), GET_TEXT(MSG_BACK),
105
           ui.abort_print, ui.goto_previous_screen,
105
           ui.abort_print, ui.goto_previous_screen,
106
-          GET_TEXT(MSG_STOP_PRINT), (PGM_P)nullptr, PSTR("?")
106
+          GET_TEXT(MSG_STOP_PRINT), (const char *)nullptr, PSTR("?")
107
         );
107
         );
108
       });
108
       });
109
     #endif
109
     #endif

+ 1
- 1
Marlin/src/lcd/menu/menu_mixer.cpp Bestand weergeven

265
       ui.return_to_status();
265
       ui.return_to_status();
266
     },
266
     },
267
     ui.goto_previous_screen,
267
     ui.goto_previous_screen,
268
-    GET_TEXT(MSG_RESET_VTOOLS), (PGM_P)nullptr, PSTR("?")
268
+    GET_TEXT(MSG_RESET_VTOOLS), (const char *)nullptr, PSTR("?")
269
   );
269
   );
270
 
270
 
271
   #if ENABLED(GRADIENT_MIX)
271
   #if ENABLED(GRADIENT_MIX)

+ 66
- 41
Marlin/src/lcd/ultralcd.cpp Bestand weergeven

95
 #include "lcdprint.h"
95
 #include "lcdprint.h"
96
 
96
 
97
 #include "../sd/cardreader.h"
97
 #include "../sd/cardreader.h"
98
+#include "../module/configuration_store.h"
98
 #include "../module/temperature.h"
99
 #include "../module/temperature.h"
99
 #include "../module/planner.h"
100
 #include "../module/planner.h"
100
 #include "../module/motion.h"
101
 #include "../module/motion.h"
879
     // This runs every ~100ms when idling often enough.
880
     // This runs every ~100ms when idling often enough.
880
     // Instead of tracking changes just redraw the Status Screen once per second.
881
     // Instead of tracking changes just redraw the Status Screen once per second.
881
     if (on_status_screen() && !lcd_status_update_delay--) {
882
     if (on_status_screen() && !lcd_status_update_delay--) {
882
-      lcd_status_update_delay = 9
883
-        #if HAS_GRAPHICAL_LCD
884
-          + 3
885
-        #endif
886
-      ;
883
+      lcd_status_update_delay = TERN(HAS_GRAPHICAL_LCD, 12, 9);
887
       max_display_update_time--;
884
       max_display_update_time--;
888
       refresh(LCDVIEW_REDRAW_NOW);
885
       refresh(LCDVIEW_REDRAW_NOW);
889
     }
886
     }
1167
           WRITE(SHIFT_CLK, HIGH);
1164
           WRITE(SHIFT_CLK, HIGH);
1168
           WRITE(SHIFT_CLK, LOW);
1165
           WRITE(SHIFT_CLK, LOW);
1169
         }
1166
         }
1170
-        #if ENABLED(REPRAPWORLD_KEYPAD)
1171
-          keypad_buttons = ~val;
1172
-        #else
1173
-          buttons = ~val;
1174
-        #endif
1167
+        TERN(REPRAPWORLD_KEYPAD, keypad_buttons, buttons) = ~val;
1175
       #endif
1168
       #endif
1176
 
1169
 
1177
     } // next_button_update_ms
1170
     } // next_button_update_ms
1238
 
1231
 
1239
   void MarlinUI::finish_status(const bool persist) {
1232
   void MarlinUI::finish_status(const bool persist) {
1240
 
1233
 
1241
-    #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
1234
+    #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE) > 0)
1242
       UNUSED(persist);
1235
       UNUSED(persist);
1243
     #endif
1236
     #endif
1244
 
1237
 
1438
   #if HAS_PRINT_PROGRESS
1431
   #if HAS_PRINT_PROGRESS
1439
 
1432
 
1440
     MarlinUI::progress_t MarlinUI::_get_progress() {
1433
     MarlinUI::progress_t MarlinUI::_get_progress() {
1441
-      #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
1442
-        const progress_t p = progress_override & PROGRESS_MASK;
1443
-      #else
1444
-        constexpr progress_t p = 0;
1445
-      #endif
1446
-      return (p
1434
+      return (
1435
+        TERN0(LCD_SET_PROGRESS_MANUALLY, (progress_override & PROGRESS_MASK))
1447
         #if ENABLED(SDSUPPORT)
1436
         #if ENABLED(SDSUPPORT)
1448
-          #if HAS_PRINT_PROGRESS_PERMYRIAD
1449
-            ?: card.permyriadDone()
1450
-          #else
1451
-            ?: card.percentDone()
1452
-          #endif
1437
+          ?: TERN(HAS_PRINT_PROGRESS_PERMYRIAD, card.permyriadDone(), card.percentDone())
1453
         #endif
1438
         #endif
1454
       );
1439
       );
1455
     }
1440
     }
1461
   //
1446
   //
1462
   // Send the status line as a host notification
1447
   // Send the status line as a host notification
1463
   //
1448
   //
1464
-
1465
   void MarlinUI::set_status(const char * const message, const bool) {
1449
   void MarlinUI::set_status(const char * const message, const bool) {
1466
-    #if ENABLED(HOST_PROMPT_SUPPORT)
1467
-      host_action_notify(message);
1468
-    #else
1469
-      UNUSED(message);
1470
-    #endif
1450
+    TERN(HOST_PROMPT_SUPPORT, host_action_notify(message), UNUSED(message));
1471
   }
1451
   }
1472
-
1473
   void MarlinUI::set_status_P(PGM_P message, const int8_t) {
1452
   void MarlinUI::set_status_P(PGM_P message, const int8_t) {
1474
-    #if ENABLED(HOST_PROMPT_SUPPORT)
1475
-      host_action_notify(message);
1476
-    #else
1477
-      UNUSED(message);
1478
-    #endif
1453
+    TERN(HOST_PROMPT_SUPPORT, host_action_notify(message), UNUSED(message));
1479
   }
1454
   }
1480
-
1481
   void MarlinUI::status_printf_P(const uint8_t, PGM_P const message, ...) {
1455
   void MarlinUI::status_printf_P(const uint8_t, PGM_P const message, ...) {
1482
-    #if ENABLED(HOST_PROMPT_SUPPORT)
1483
-      host_action_notify(message);
1484
-    #else
1485
-      UNUSED(message);
1486
-    #endif
1456
+    TERN(HOST_PROMPT_SUPPORT, host_action_notify(message), UNUSED(message));
1487
   }
1457
   }
1488
 
1458
 
1489
 #endif // !HAS_DISPLAY
1459
 #endif // !HAS_DISPLAY
1507
         TERN_(EXTENSIBLE_UI, ExtUI::onMediaRemoved()); // ExtUI response
1477
         TERN_(EXTENSIBLE_UI, ExtUI::onMediaRemoved()); // ExtUI response
1508
         #if PIN_EXISTS(SD_DETECT)
1478
         #if PIN_EXISTS(SD_DETECT)
1509
           set_status_P(GET_TEXT(MSG_MEDIA_REMOVED));
1479
           set_status_P(GET_TEXT(MSG_MEDIA_REMOVED));
1510
-          TERN_(HAS_LCD_MENU, return_to_status());
1480
+          #if HAS_LCD_MENU
1481
+            if (!defer_return_to_status) return_to_status();
1482
+          #endif
1511
         #endif
1483
         #endif
1512
       }
1484
       }
1513
     }
1485
     }
1530
   }
1502
   }
1531
 
1503
 
1532
 #endif // SDSUPPORT
1504
 #endif // SDSUPPORT
1505
+
1506
+#if HAS_LCD_MENU
1507
+  void MarlinUI::reset_settings() { settings.reset(); completion_feedback(); }
1508
+#endif
1509
+
1510
+#if ENABLED(EEPROM_SETTINGS)
1511
+
1512
+  #if HAS_LCD_MENU
1513
+    void MarlinUI::init_eeprom() {
1514
+      const bool good = settings.init_eeprom();
1515
+      completion_feedback(good);
1516
+      return_to_status();
1517
+    }
1518
+    void MarlinUI::load_settings() {
1519
+      const bool good = settings.load();
1520
+      completion_feedback(good);
1521
+    }
1522
+    void MarlinUI::store_settings() {
1523
+      const bool good = settings.save();
1524
+      completion_feedback(good);
1525
+    }
1526
+  #endif
1527
+
1528
+  #if DISABLED(EEPROM_AUTO_INIT)
1529
+
1530
+    static inline PGM_P eeprom_err(const uint8_t msgid) {
1531
+      switch (msgid) {
1532
+        default:
1533
+        case 0: return GET_TEXT(MSG_ERR_EEPROM_CRC);
1534
+        case 1: return GET_TEXT(MSG_ERR_EEPROM_INDEX);
1535
+        case 2: return GET_TEXT(MSG_ERR_EEPROM_VERSION);
1536
+      }
1537
+    }
1538
+
1539
+    void MarlinUI::eeprom_alert(const uint8_t msgid) {
1540
+      #if HAS_LCD_MENU
1541
+        editable.uint8 = msgid;
1542
+        goto_screen([]{
1543
+          PGM_P const restore_msg = GET_TEXT(MSG_RESTORE_DEFAULTS);
1544
+          char msg[utf8_strlen_P(restore_msg) + 1];
1545
+          strcpy_P(msg, restore_msg);
1546
+          MenuItem_confirm::select_screen(
1547
+            GET_TEXT(MSG_BUTTON_RESET), GET_TEXT(MSG_BUTTON_IGNORE),
1548
+            init_eeprom, return_to_status,
1549
+            eeprom_err(editable.uint8), msg, PSTR("?")
1550
+          );
1551
+        });
1552
+      #else
1553
+        set_status_P(eeprom_err(msgid));
1554
+      #endif
1555
+    }
1556
+  #endif
1557
+#endif

+ 32
- 8
Marlin/src/lcd/ultralcd.h Bestand weergeven

544
 
544
 
545
   #endif
545
   #endif
546
 
546
 
547
-  #define LCD_HAS_WAIT_FOR_MOVE EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) || (ENABLED(LCD_BED_LEVELING) && EITHER(PROBE_MANUALLY, MESH_BED_LEVELING))
547
+  //
548
+  // EEPROM: Reset / Init / Load / Store
549
+  //
550
+  #if HAS_LCD_MENU
551
+    static void reset_settings();
552
+  #endif
553
+
554
+  #if ENABLED(EEPROM_SETTINGS)
555
+    #if HAS_LCD_MENU
556
+      static void init_eeprom();
557
+      static void load_settings();
558
+      static void store_settings();
559
+    #endif
560
+    #if DISABLED(EEPROM_AUTO_INIT)
561
+      static void eeprom_alert(const uint8_t msgid);
562
+      static inline void eeprom_alert_crc()     { eeprom_alert(0); }
563
+      static inline void eeprom_alert_index()   { eeprom_alert(1); }
564
+      static inline void eeprom_alert_version() { eeprom_alert(2); }
565
+    #endif
566
+  #endif
548
 
567
 
549
-  #if LCD_HAS_WAIT_FOR_MOVE
568
+  //
569
+  // Special handling if a move is underway
570
+  //
571
+  #if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) || (ENABLED(LCD_BED_LEVELING) && EITHER(PROBE_MANUALLY, MESH_BED_LEVELING))
572
+    #define LCD_HAS_WAIT_FOR_MOVE 1
550
     static bool wait_for_move;
573
     static bool wait_for_move;
551
   #else
574
   #else
552
     static constexpr bool wait_for_move = false;
575
     static constexpr bool wait_for_move = false;
553
   #endif
576
   #endif
554
 
577
 
578
+  //
579
+  // Block interaction while under external control
580
+  //
555
   #if HAS_LCD_MENU && EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION)
581
   #if HAS_LCD_MENU && EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION)
556
     static bool external_control;
582
     static bool external_control;
557
     FORCE_INLINE static void capture() { external_control = true; }
583
     FORCE_INLINE static void capture() { external_control = true; }
615
   #endif
641
   #endif
616
 
642
 
617
   #if HAS_SPI_LCD
643
   #if HAS_SPI_LCD
618
-    #if HAS_LCD_MENU
619
-      #if LCD_TIMEOUT_TO_STATUS > 0
620
-        static bool defer_return_to_status;
621
-      #else
622
-        static constexpr bool defer_return_to_status = false;
623
-      #endif
644
+    #if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS > 0
645
+      static bool defer_return_to_status;
646
+    #else
647
+      static constexpr bool defer_return_to_status = false;
624
     #endif
648
     #endif
625
     static void draw_status_screen();
649
     static void draw_status_screen();
626
   #endif
650
   #endif

+ 4
- 10
Marlin/src/module/configuration_store.cpp Bestand weergeven

37
  */
37
  */
38
 
38
 
39
 // Change EEPROM version if the structure changes
39
 // Change EEPROM version if the structure changes
40
-#define EEPROM_VERSION "V78"
40
+#define EEPROM_VERSION "V79"
41
 #define EEPROM_OFFSET 100
41
 #define EEPROM_OFFSET 100
42
 
42
 
43
 // Check the integrity of data offsets.
43
 // Check the integrity of data offsets.
1367
       }
1367
       }
1368
       DEBUG_ECHO_START();
1368
       DEBUG_ECHO_START();
1369
       DEBUG_ECHOLNPAIR("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")");
1369
       DEBUG_ECHOLNPAIR("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")");
1370
-      #if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT)
1371
-        LCD_MESSAGEPGM(MSG_ERR_EEPROM_VERSION);
1372
-      #endif
1370
+      TERN(EEPROM_AUTO_INIT,,ui.eeprom_alert_version());
1373
       eeprom_error = true;
1371
       eeprom_error = true;
1374
     }
1372
     }
1375
     else {
1373
     else {
2141
       if (eeprom_error) {
2139
       if (eeprom_error) {
2142
         DEBUG_ECHO_START();
2140
         DEBUG_ECHO_START();
2143
         DEBUG_ECHOLNPAIR("Index: ", int(eeprom_index - (EEPROM_OFFSET)), " Size: ", datasize());
2141
         DEBUG_ECHOLNPAIR("Index: ", int(eeprom_index - (EEPROM_OFFSET)), " Size: ", datasize());
2144
-        #if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT)
2145
-          LCD_MESSAGEPGM(MSG_ERR_EEPROM_INDEX);
2146
-        #endif
2142
+        TERN(EEPROM_AUTO_INIT,,ui.eeprom_alert_index());
2147
       }
2143
       }
2148
       else if (working_crc != stored_crc) {
2144
       else if (working_crc != stored_crc) {
2149
         eeprom_error = true;
2145
         eeprom_error = true;
2150
         DEBUG_ERROR_START();
2146
         DEBUG_ERROR_START();
2151
         DEBUG_ECHOLNPAIR("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!");
2147
         DEBUG_ECHOLNPAIR("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!");
2152
-        #if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT)
2153
-          LCD_MESSAGEPGM(MSG_ERR_EEPROM_CRC);
2154
-        #endif
2148
+        TERN(EEPROM_AUTO_INIT,,ui.eeprom_alert_crc());
2155
       }
2149
       }
2156
       else if (!validating) {
2150
       else if (!validating) {
2157
         DEBUG_ECHO_START();
2151
         DEBUG_ECHO_START();

Laden…
Annuleren
Opslaan