1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 19:40:31 +03:00

Make three attempts to not only write to FLASH, but also validate it (#14001)

This commit is contained in:
Steve Evans 2024-10-31 13:45:16 +00:00 committed by GitHub
parent 954cc1da3a
commit b819eceb86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -509,7 +509,7 @@ void writeConfigToEEPROM(void)
bool success = false; bool success = false;
// write it // write it
for (int attempt = 0; attempt < 3 && !success; attempt++) { for (int attempt = 0; attempt < 3 && !success; attempt++) {
if (writeSettingsToEEPROM()) { if (writeSettingsToEEPROM() && isEEPROMVersionValid() && isEEPROMStructureValid()) {
success = true; success = true;
#if defined(CONFIG_IN_EXTERNAL_FLASH) || defined(CONFIG_IN_MEMORY_MAPPED_FLASH) #if defined(CONFIG_IN_EXTERNAL_FLASH) || defined(CONFIG_IN_MEMORY_MAPPED_FLASH)
@ -523,8 +523,7 @@ void writeConfigToEEPROM(void)
} }
} }
if (success) {
if (success && isEEPROMVersionValid() && isEEPROMStructureValid()) {
return; return;
} }