Browse Source

Return 'false' on EEPROM connection fail (#14776)

Eric Ptak 5 years ago
parent
commit
fdbc733376
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      Marlin/src/module/configuration_store.cpp

+ 3
- 2
Marlin/src/module/configuration_store.cpp View File

@@ -460,7 +460,8 @@ void MarlinSettings::postprocess() {
460 460
     #define EEPROM_SKIP(VAR) (eeprom_index += sizeof(VAR))
461 461
   #endif
462 462
 
463
-  #define EEPROM_START()          int eeprom_index = EEPROM_OFFSET; persistentStore.access_start()
463
+  #define EEPROM_START()          if (!persistentStore.access_start()) { SERIAL_ECHO_MSG("No EEPROM."); return false; } \
464
+                                  int eeprom_index = EEPROM_OFFSET
464 465
   #define EEPROM_FINISH()         persistentStore.access_finish()
465 466
   #define EEPROM_WRITE(VAR)       do{ persistentStore.write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc);              UPDATE_TEST_INDEX(VAR); }while(0)
466 467
   #define EEPROM_READ(VAR)        do{ persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc, !validating);  UPDATE_TEST_INDEX(VAR); }while(0)
@@ -2111,7 +2112,7 @@ void MarlinSettings::postprocess() {
2111 2112
       (void)save();
2112 2113
       SERIAL_ECHO_MSG("EEPROM Initialized");
2113 2114
     #endif
2114
-    return true;
2115
+    return false;
2115 2116
   }
2116 2117
 
2117 2118
   #if ENABLED(AUTO_BED_LEVELING_UBL)

Loading…
Cancel
Save