Browse Source

Set LCD status for EEPROM errors (#16977)

InsanityAutomation 4 years ago
parent
commit
cdcd45d651
No account linked to committer's email address

+ 11
- 11
Marlin/src/MarlinCore.cpp View File

@@ -995,32 +995,28 @@ void setup() {
995 995
     ui.show_bootscreen();
996 996
   #endif
997 997
 
998
+  ui.reset_status();        // Load welcome message early. (Retained if no errors exist.)
999
+
998 1000
   #if ENABLED(SDSUPPORT)
999
-    card.mount(); // Mount the SD card before settings.first_load
1001
+    card.mount();           // Mount the SD card before settings.first_load
1000 1002
   #endif
1001
-
1002
-  // Load data from EEPROM if available (or use defaults)
1003
-  // This also updates variables in the planner, elsewhere
1004
-  settings.first_load();
1003
+                            // Load data from EEPROM if available (or use defaults)
1004
+  settings.first_load();    // This also updates variables in the planner, elsewhere
1005 1005
 
1006 1006
   #if ENABLED(TOUCH_BUTTONS)
1007 1007
     touch.init();
1008 1008
   #endif
1009 1009
 
1010
-  #if HAS_M206_COMMAND
1011
-    // Initialize current position based on home_offset
1010
+  #if HAS_M206_COMMAND      // Initialize current position based on home_offset
1012 1011
     current_position += home_offset;
1013 1012
   #endif
1014 1013
 
1015
-  // Vital to init stepper/planner equivalent for current_position
1016
-  sync_plan_position();
1014
+  sync_plan_position();     // Vital to init stepper/planner equivalent for current_position
1017 1015
 
1018 1016
   thermalManager.init();    // Initialize temperature loop
1019 1017
 
1020 1018
   print_job_timer.init();   // Initial setup of print job timer
1021 1019
 
1022
-  ui.reset_status();        // Print startup message after print statistics are loaded
1023
-
1024 1020
   endstops.init();          // Init endstops and pullups
1025 1021
 
1026 1022
   stepper.init();           // Init stepper. This enables interrupts!
@@ -1175,6 +1171,10 @@ void setup() {
1175 1171
   #if ENABLED(PRUSA_MMU2)
1176 1172
     mmu2.init();
1177 1173
   #endif
1174
+
1175
+  #if HAS_SERVICE_INTERVALS
1176
+    ui.reset_status(true);  // Show service messages or keep current status
1177
+  #endif
1178 1178
 }
1179 1179
 
1180 1180
 /**

+ 3
- 0
Marlin/src/lcd/language/language_en.h View File

@@ -314,6 +314,9 @@ namespace Language_en {
314 314
   PROGMEM Language_Str MSG_LOAD_EEPROM                     = _UxGT("Load Settings");
315 315
   PROGMEM Language_Str MSG_RESTORE_DEFAULTS                = _UxGT("Restore Defaults");
316 316
   PROGMEM Language_Str MSG_INIT_EEPROM                     = _UxGT("Initialize EEPROM");
317
+  PROGMEM Language_Str MSG_ERR_EEPROM_CRC                  = _UxGT("Err: EEPROM CRC");
318
+  PROGMEM Language_Str MSG_ERR_EEPROM_INDEX                = _UxGT("Err: EEPROM Index");
319
+  PROGMEM Language_Str MSG_ERR_EEPROM_VERSION              = _UxGT("Err: EEPROM Version");
317 320
   PROGMEM Language_Str MSG_MEDIA_UPDATE                    = _UxGT("Media Update");
318 321
   PROGMEM Language_Str MSG_RESET_PRINTER                   = _UxGT("Reset Printer");
319 322
   PROGMEM Language_Str MSG_REFRESH                         = LCD_STR_REFRESH  _UxGT("Refresh");

+ 4
- 2
Marlin/src/lcd/ultralcd.cpp View File

@@ -1453,7 +1453,7 @@ void MarlinUI::update() {
1453 1453
   /**
1454 1454
    * Reset the status message
1455 1455
    */
1456
-  void MarlinUI::reset_status() {
1456
+  void MarlinUI::reset_status(const bool no_welcome) {
1457 1457
     PGM_P printing = GET_TEXT(MSG_PRINTING);
1458 1458
     PGM_P welcome  = GET_TEXT(WELCOME_MSG);
1459 1459
     #if SERVICE_INTERVAL_1 > 0
@@ -1485,8 +1485,10 @@ void MarlinUI::update() {
1485 1485
       else if (print_job_timer.needsService(3)) msg = service3;
1486 1486
     #endif
1487 1487
 
1488
-    else
1488
+    else if (!no_welcome)
1489 1489
       msg = welcome;
1490
+    else
1491
+      return;
1490 1492
 
1491 1493
     set_status_P(msg, -1);
1492 1494
   }

+ 2
- 2
Marlin/src/lcd/ultralcd.h View File

@@ -402,7 +402,7 @@ public:
402 402
     static void set_status(const char* const message, const bool persist=false);
403 403
     static void set_status_P(PGM_P const message, const int8_t level=0);
404 404
     static void status_printf_P(const uint8_t level, PGM_P const fmt, ...);
405
-    static void reset_status();
405
+    static void reset_status(const bool no_welcome=false);
406 406
 
407 407
   #else // No LCD
408 408
 
@@ -416,7 +416,7 @@ public:
416 416
     static inline void refresh() {}
417 417
     static inline void return_to_status() {}
418 418
     static inline void set_alert_status_P(PGM_P const) {}
419
-    static inline void reset_status() {}
419
+    static inline void reset_status(const bool=false) {}
420 420
     static inline void reset_alert_level() {}
421 421
     static constexpr bool has_status() { return false; }
422 422
 

+ 9
- 0
Marlin/src/module/configuration_store.cpp View File

@@ -1397,6 +1397,9 @@ void MarlinSettings::postprocess() {
1397 1397
       }
1398 1398
       DEBUG_ECHO_START();
1399 1399
       DEBUG_ECHOLNPAIR("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")");
1400
+      #if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT)
1401
+        ui.set_status_P(GET_TEXT(MSG_ERR_EEPROM_VERSION));
1402
+      #endif
1400 1403
       eeprom_error = true;
1401 1404
     }
1402 1405
     else {
@@ -2205,11 +2208,17 @@ void MarlinSettings::postprocess() {
2205 2208
       if (eeprom_error) {
2206 2209
         DEBUG_ECHO_START();
2207 2210
         DEBUG_ECHOLNPAIR("Index: ", int(eeprom_index - (EEPROM_OFFSET)), " Size: ", datasize());
2211
+        #if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT)
2212
+          ui.set_status_P(GET_TEXT(MSG_ERR_EEPROM_INDEX));
2213
+        #endif
2208 2214
       }
2209 2215
       else if (working_crc != stored_crc) {
2210 2216
         eeprom_error = true;
2211 2217
         DEBUG_ERROR_START();
2212 2218
         DEBUG_ECHOLNPAIR("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!");
2219
+        #if HAS_LCD_MENU && DISABLED(EEPROM_AUTO_INIT)
2220
+          ui.set_status_P(GET_TEXT(MSG_ERR_EEPROM_CRC));
2221
+        #endif
2213 2222
       }
2214 2223
       else if (!validating) {
2215 2224
         DEBUG_ECHO_START();

Loading…
Cancel
Save