Skip to content

Commit

Permalink
replace bootloader version in payload
Browse files Browse the repository at this point in the history
when the config client writes the eeprom area automatically replace
the version byte with the right version to avoid the extra flash
erase/write in update_EEPROM()
  • Loading branch information
tridge committed Nov 27, 2024
1 parent 352f238 commit ee18461
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bootloader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,16 @@ static void decodeInput()
return;
}

if (address == EEPROM_START_ADD && payload_buffer_size > 2) {
/*
if the configuration client is writing the eeprom area
then replace the bootloader version byte in the buffer
with the right version. This makes the update_EEPROM()
less likely to need to erase any flash
*/
payLoadBuffer[2] = BOOTLOADER_VERSION;
}

if (!save_flash_nolib((uint8_t*)payLoadBuffer, payload_buffer_size,address)) {
send_BAD_ACK();
} else {
Expand Down

0 comments on commit ee18461

Please sign in to comment.