diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 00000000..9ccbf7ed --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,11 @@ +Important changes in TypingBreaks +================================= + +Older versions of the plugin used to provide EEPROM storage for the settings +only optionally, when it was explicitly enabled via the +`TypingBreaks.enableEEPROM()` method. Similarly, the Focus hooks were optional +too. + +Both of them are unconditionally enabled now, because they add so much to the +plugin. This means that any calls to `TypingBreaks.enableEEPROM()` can be safely +removed, the method is a no-op by now. diff --git a/src/Kaleidoscope/TypingBreaks.cpp b/src/Kaleidoscope/TypingBreaks.cpp index 2f1c52af..919b2f2f 100644 --- a/src/Kaleidoscope/TypingBreaks.cpp +++ b/src/Kaleidoscope/TypingBreaks.cpp @@ -109,7 +109,7 @@ EventHandlerResult TypingBreaks::onKeyswitchEvent(Key &mapped_key, byte row, byt return EventHandlerResult::OK; } -void TypingBreaks::enableEEPROM(void) { +EventHandlerResult TypingBreaks::onSetup() { settings_base_ = ::EEPROMSettings.requestSlice(sizeof(settings)); // If idleTime is max, assume that EEPROM is uninitialized, and store the @@ -121,6 +121,7 @@ void TypingBreaks::enableEEPROM(void) { } EEPROM.get(settings_base_, settings); + return EventHandlerResult::OK; } #define FOCUS_HOOK_TYPINGBREAKS FOCUS_HOOK(TypingBreaks.focusHook, \ diff --git a/src/Kaleidoscope/TypingBreaks.h b/src/Kaleidoscope/TypingBreaks.h index bfc39a98..fe128555 100644 --- a/src/Kaleidoscope/TypingBreaks.h +++ b/src/Kaleidoscope/TypingBreaks.h @@ -19,13 +19,17 @@ #include +#define _DEPRECATED_MESSAGE_ENABLE_EEPROM \ + "EEPROM is now enabled automatically, and the .enableEEPROM()\n" \ + "method is therefore obsolete. You can safely remove it." + namespace kaleidoscope { class TypingBreaks : public kaleidoscope::Plugin { public: TypingBreaks(void) {} - static void enableEEPROM(void); + static void enableEEPROM(void) DEPRECATED(ENABLE_EEPROM) {} typedef struct settings_t { uint16_t idle_time_limit; @@ -39,6 +43,7 @@ class TypingBreaks : public kaleidoscope::Plugin { EventHandlerResult onKeyswitchEvent(Key &mapped_key, byte row, byte col, uint8_t key_state); EventHandlerResult onFocusEvent(const char *command); + EventHandlerResult onSetup(); private: static uint32_t session_start_time_;