diff --git a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp index 838f6559..b77d662f 100644 --- a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp +++ b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp @@ -246,7 +246,7 @@ EventHandlerResult FocusEEPROMCommand::onFocusEvent(const char *command) { break; case ERASE: { for (uint16_t i = 0; i < Runtime.storage().length(); i++) { - Runtime.storage().update(i, 255); + Runtime.storage().update(i, EEPROM_UNINITIALIZED_BYTE); } Runtime.storage().commit(); Runtime.device().rebootBootloader(); diff --git a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h index 18e0c07b..c1b3203b 100644 --- a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h +++ b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.h @@ -28,9 +28,12 @@ class EEPROMSettings : public kaleidoscope::Plugin { EventHandlerResult onSetup(); EventHandlerResult beforeEachCycle(); + /* EEPROM is filled with 0xff when uninitialized, and we use that in a few + * places. */ + static constexpr uint8_t EEPROM_UNINITIALIZED_BYTE = 0xff; /* EEPROM is filled with 0xff when uninitialized, so a version with that value * means we do not have an EEPROM version defined yet. */ - static constexpr uint8_t VERSION_UNDEFINED = 0xff; + static constexpr uint8_t VERSION_UNDEFINED = EEPROM_UNINITIALIZED_BYTE; /* A version set to zero is likely some kind of corruption, we do not normally * clear the byte. */ static constexpr uint8_t VERSION_IMPOSSIBLE_ZERO = 0x00;