diff --git a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp index 859a1747..ac2b7085 100644 --- a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp +++ b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp @@ -37,13 +37,11 @@ uint16_t AutoShiftConfig::settings_base_; EventHandlerResult AutoShiftConfig::onSetup() { settings_base_ = ::EEPROMSettings.requestSlice(sizeof(AutoShift::settings_)); - uint32_t checker; - Runtime.storage().get(settings_base_, checker); - - // Check if we have an empty eeprom... - if (checker == 0xffffffff) { - // ...if the eeprom was empty, store the default settings. + if (Runtime.storage().isSliceUninitialized( + settings_base_, + sizeof(AutoShift::settings_))) { + // If our slice is uninitialized, set sensible defaults. Runtime.storage().put(settings_base_, AutoShift::settings_); Runtime.storage().commit(); } diff --git a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp index 721f0332..59a29b61 100644 --- a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp +++ b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot-Config.cpp @@ -34,13 +34,11 @@ uint16_t EscapeOneShotConfig::settings_base_; EventHandlerResult EscapeOneShotConfig::onSetup() { settings_base_ = ::EEPROMSettings.requestSlice(sizeof(EscapeOneShot::settings_)); - uint16_t checker; - Runtime.storage().get(settings_base_, checker); - - // Check if we have an empty eeprom... - if (checker == 0xffff) { - // ...if the eeprom was empty, store the default settings. + if (Runtime.storage().isSliceUninitialized( + settings_base_, + sizeof(EscapeOneShot::settings_))) { + // If our slice is uninitialized, set sensible defaults. Runtime.storage().put(settings_base_, EscapeOneShot::settings_); Runtime.storage().commit(); } diff --git a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp index 9490ec43..bbf63ae6 100644 --- a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp +++ b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp @@ -121,11 +121,10 @@ EventHandlerResult TypingBreaks::onNameQuery() { EventHandlerResult TypingBreaks::onSetup() { settings_base_ = ::EEPROMSettings.requestSlice(sizeof(settings)); - // If idleTime is max, assume that EEPROM is uninitialized, and store the - // defaults. - uint32_t idle_time; - Runtime.storage().get(settings_base_, idle_time); - if (idle_time == 0xffffffff) { + if (Runtime.storage().isSliceUninitialized( + settings_base_, + sizeof(settings))) { + // If our slice is uninitialized, set sensible defaults. Runtime.storage().put(settings_base_, settings); Runtime.storage().commit(); }