Bsongis/boot issue invalid eeprom (#6684)

Boot issue on invalid eeprom
This commit is contained in:
Bertrand Songis
2019-08-30 13:23:49 +02:00
committed by GitHub
parent ae4a80f4be
commit ff2cde85be
7 changed files with 29 additions and 32 deletions
+5 -7
View File
@@ -757,7 +757,7 @@ uint16_t eeLoadModelData(uint8_t index)
return theFile.readRlc((uint8_t*)&g_model, sizeof(g_model));
}
bool eeLoadGeneral(bool allowConversion)
bool eeLoadGeneral(bool allowFixes)
{
theFile.openRlc(FILE_GENERAL);
if (theFile.readRlc((uint8_t*)&g_eeGeneral, 3) == 3 && g_eeGeneral.version == EEPROM_VER) {
@@ -794,16 +794,14 @@ bool eeLoadGeneral(bool allowConversion)
return false;
}
#endif
#if defined(EEPROM_CONVERSIONS)
if (g_eeGeneral.version != EEPROM_VER) {
if (!allowConversion) {
storageClearRadioSetting();
return true; // prevent eeprom from being wiped
}
TRACE("EEPROM version %d instead of %d", g_eeGeneral.version, EEPROM_VER);
if (!eeConvert()) {
if (!allowFixes)
return false; // prevent eeprom from being wiped
if (!eeConvert())
return false;
}
}
return true;
#else