|
@ -31,9 +31,10 @@ bool _settings_save = false; |
|
|
unsigned long settingsSize() { |
|
|
unsigned long settingsSize() { |
|
|
unsigned pos = SPI_FLASH_SEC_SIZE - 1; |
|
|
unsigned pos = SPI_FLASH_SEC_SIZE - 1; |
|
|
while (size_t len = EEPROMr.read(pos)) { |
|
|
while (size_t len = EEPROMr.read(pos)) { |
|
|
|
|
|
if (0xFF == len) break; |
|
|
pos = pos - len - 2; |
|
|
pos = pos - len - 2; |
|
|
} |
|
|
} |
|
|
return SPI_FLASH_SEC_SIZE - pos; |
|
|
|
|
|
|
|
|
return SPI_FLASH_SEC_SIZE - pos + EEPROM_DATA_END; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
// -----------------------------------------------------------------------------
|
|
@ -42,6 +43,7 @@ unsigned int settingsKeyCount() { |
|
|
unsigned count = 0; |
|
|
unsigned count = 0; |
|
|
unsigned pos = SPI_FLASH_SEC_SIZE - 1; |
|
|
unsigned pos = SPI_FLASH_SEC_SIZE - 1; |
|
|
while (size_t len = EEPROMr.read(pos)) { |
|
|
while (size_t len = EEPROMr.read(pos)) { |
|
|
|
|
|
if (0xFF == len) break; |
|
|
pos = pos - len - 2; |
|
|
pos = pos - len - 2; |
|
|
len = EEPROMr.read(pos); |
|
|
len = EEPROMr.read(pos); |
|
|
pos = pos - len - 2; |
|
|
pos = pos - len - 2; |
|
@ -57,6 +59,7 @@ String settingsKeyName(unsigned int index) { |
|
|
unsigned count = 0; |
|
|
unsigned count = 0; |
|
|
unsigned pos = SPI_FLASH_SEC_SIZE - 1; |
|
|
unsigned pos = SPI_FLASH_SEC_SIZE - 1; |
|
|
while (size_t len = EEPROMr.read(pos)) { |
|
|
while (size_t len = EEPROMr.read(pos)) { |
|
|
|
|
|
if (0xFF == len) break; |
|
|
pos = pos - len - 2; |
|
|
pos = pos - len - 2; |
|
|
if (count == index) { |
|
|
if (count == index) { |
|
|
s.reserve(len); |
|
|
s.reserve(len); |
|
|