much better field name

This commit is contained in:
rusefi 2023-10-31 09:36:29 -04:00
parent b77a7c4111
commit e4f60c72c9
2 changed files with 7 additions and 7 deletions

View File

@ -13,5 +13,5 @@ typedef struct {
int version;
int size;
persistent_config_s persistentConfiguration;
uint32_t value;
uint32_t crc;
} persistent_config_container_s;

View File

@ -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;