Browse Source

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

Eric Ptak 6 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
     #define EEPROM_SKIP(VAR) (eeprom_index += sizeof(VAR))
460
     #define EEPROM_SKIP(VAR) (eeprom_index += sizeof(VAR))
461
   #endif
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
   #define EEPROM_FINISH()         persistentStore.access_finish()
465
   #define EEPROM_FINISH()         persistentStore.access_finish()
465
   #define EEPROM_WRITE(VAR)       do{ persistentStore.write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc);              UPDATE_TEST_INDEX(VAR); }while(0)
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
   #define EEPROM_READ(VAR)        do{ persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc, !validating);  UPDATE_TEST_INDEX(VAR); }while(0)
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
       (void)save();
2112
       (void)save();
2112
       SERIAL_ECHO_MSG("EEPROM Initialized");
2113
       SERIAL_ECHO_MSG("EEPROM Initialized");
2113
     #endif
2114
     #endif
2114
-    return true;
2115
+    return false;
2115
   }
2116
   }
2116
 
2117
 
2117
   #if ENABLED(AUTO_BED_LEVELING_UBL)
2118
   #if ENABLED(AUTO_BED_LEVELING_UBL)

Loading…
Cancel
Save