Fixed single-byte configuration changes not working on nRF

master
Mark Qvist 1 month ago
parent 6b815c47d4
commit 7066b4de6f
  1. 13
      Utilities.h

@ -1396,7 +1396,6 @@ void kiss_dump_eeprom() {
#if !HAS_EEPROM && MCU_VARIANT == MCU_NRF52 #if !HAS_EEPROM && MCU_VARIANT == MCU_NRF52
void eeprom_flush() { void eeprom_flush() {
// sync file contents to flash
file.close(); file.close();
file.open(EEPROM_FILE, FILE_O_WRITE); file.open(EEPROM_FILE, FILE_O_WRITE);
written_bytes = 0; written_bytes = 0;
@ -1423,22 +1422,10 @@ void eeprom_update(int mapped_addr, uint8_t byte) {
file.write(byte); file.write(byte);
} }
written_bytes++; written_bytes++;
if ((mapped_addr - eeprom_addr(0)) == ADDR_INFO_LOCK) {
#if !HAS_EEPROM && MCU_VARIANT == MCU_NRF52
// have to do a flush because we're only writing 1 byte and it syncs after 4
eeprom_flush(); eeprom_flush();
#endif #endif
} }
if (written_bytes >= 4) {
file.close();
file.open(EEPROM_FILE, FILE_O_WRITE);
written_bytes = 0;
}
#endif
}
void eeprom_write(uint8_t addr, uint8_t byte) { void eeprom_write(uint8_t addr, uint8_t byte) {
if (!eeprom_info_locked() && addr >= 0 && addr < EEPROM_RESERVED) { if (!eeprom_info_locked() && addr >= 0 && addr < EEPROM_RESERVED) {
eeprom_update(eeprom_addr(addr), byte); eeprom_update(eeprom_addr(addr), byte);

Loading…
Cancel
Save