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

This commit is contained in:
Eric Ptak 2019-07-31 00:43:45 +02:00 committed by Scott Lahteine
parent 128eed6b57
commit fdbc733376

View file

@ -460,7 +460,8 @@ void MarlinSettings::postprocess() {
#define EEPROM_SKIP(VAR) (eeprom_index += sizeof(VAR)) #define EEPROM_SKIP(VAR) (eeprom_index += sizeof(VAR))
#endif #endif
#define EEPROM_START() int eeprom_index = EEPROM_OFFSET; persistentStore.access_start() #define EEPROM_START() if (!persistentStore.access_start()) { SERIAL_ECHO_MSG("No EEPROM."); return false; } \
int eeprom_index = EEPROM_OFFSET
#define EEPROM_FINISH() persistentStore.access_finish() #define EEPROM_FINISH() persistentStore.access_finish()
#define EEPROM_WRITE(VAR) do{ persistentStore.write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc); UPDATE_TEST_INDEX(VAR); }while(0) #define EEPROM_WRITE(VAR) do{ persistentStore.write_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc); UPDATE_TEST_INDEX(VAR); }while(0)
#define EEPROM_READ(VAR) do{ persistentStore.read_data(eeprom_index, (uint8_t*)&VAR, sizeof(VAR), &working_crc, !validating); UPDATE_TEST_INDEX(VAR); }while(0) #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() {
(void)save(); (void)save();
SERIAL_ECHO_MSG("EEPROM Initialized"); SERIAL_ECHO_MSG("EEPROM Initialized");
#endif #endif
return true; return false;
} }
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(AUTO_BED_LEVELING_UBL)