diff --git a/firmware/controllers/algo/persistent_configuration.h b/firmware/controllers/algo/persistent_configuration.h index 692c8e86b0..ab6a9380fb 100644 --- a/firmware/controllers/algo/persistent_configuration.h +++ b/firmware/controllers/algo/persistent_configuration.h @@ -13,5 +13,5 @@ typedef struct { int version; int size; persistent_config_s persistentConfiguration; - uint32_t value; + uint32_t crc; } persistent_config_container_s; diff --git a/firmware/controllers/flash_main.cpp b/firmware/controllers/flash_main.cpp index c0d78498cf..2ddac7a3dd 100644 --- a/firmware/controllers/flash_main.cpp +++ b/firmware/controllers/flash_main.cpp @@ -167,7 +167,7 @@ void writeToFlashNow() { // Set up the container persistentState.size = sizeof(persistentState); persistentState.version = FLASH_DATA_VERSION; - persistentState.value = flashStateCrc(persistentState); + persistentState.crc = flashStateCrc(persistentState); #if EFI_STORAGE_EXT_SNOR == TRUE mfs_error_t err; @@ -234,9 +234,9 @@ static FlashState readOneConfigurationCopy(flashaddr_t address) { auto flashCrc = flashStateCrc(persistentState); - if (flashCrc != persistentState.value) { + if (flashCrc != persistentState.crc) { // If the stored crc is all 1s, that probably means the flash is actually blank, not that the crc failed. - if (persistentState.value == ((decltype(persistentState.value))-1)) { + if (persistentState.crc == ((decltype(persistentState.crc))-1)) { return FlashState::BlankChip; } else { return FlashState::CrcFailed; @@ -264,16 +264,16 @@ static FlashState readConfiguration() { // readed size is not exactly the same if (settings_size != sizeof(persistentState)) return FlashState::IncompatibleVersion; - // claimed size or versio is not the same + // claimed size or version is not the same if (persistentState.version != FLASH_DATA_VERSION || persistentState.size != sizeof(persistentState)) return FlashState::IncompatibleVersion; // now crc auto flashCrc = flashStateCrc(persistentState); - if (flashCrc != persistentState.value) { + if (flashCrc != persistentState.crc) { // If the stored crc is all 1s, that probably means the flash is actually blank, not that the crc failed. - if (persistentState.value == ((decltype(persistentState.value))-1)) { + if (persistentState.crc == ((decltype(persistentState.crc))-1)) { return FlashState::BlankChip; } else { return FlashState::CrcFailed;