Enable EEPROM storage unconditionally

The plugin is much less useful without EEPROM storage, even confusing when using
the Focus commands. As such, enable the storage unconditionally. This makes the
`enableEEPROM` method obsolete, so we mark that as deprecated.

Based on, and fixes #12 by Matt Venn <matt@mattvenn.net>.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/389/head
Gergely Nagy 6 years ago
parent 9c79c2d5b7
commit 90b2247465

@ -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.

@ -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, \

@ -19,13 +19,17 @@
#include <Kaleidoscope.h>
#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_;

Loading…
Cancel
Save