From 71d49dee511c3edb76ba4b01c24e391f0dba61e1 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 21 Feb 2017 20:20:51 +0100 Subject: [PATCH] Don't try to load the saved layer on setup() If we want to allow plugins to implement EEPROM storage, it is best if we don't do anything with EEPROM in the core firmware. As such, remove the `Layer.defaultLayer` call from `Kaleidoscope.setup`. With that gone, the `keymap_count` argument is obsolete, so drop it from `Kaleidoscope.setup()` - but we keep an temporary `setup()` with the old arity, so that plugins can be updated at a slower pace. Signed-off-by: Gergely Nagy --- examples/Kaleidoscope/Kaleidoscope.ino | 2 +- src/Kaleidoscope.cpp | 4 +--- src/Kaleidoscope.h | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/Kaleidoscope/Kaleidoscope.ino b/examples/Kaleidoscope/Kaleidoscope.ino index dc1916d7..dfec7a8d 100644 --- a/examples/Kaleidoscope/Kaleidoscope.ino +++ b/examples/Kaleidoscope/Kaleidoscope.ino @@ -125,7 +125,7 @@ const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { } void setup() { - Kaleidoscope.setup(KEYMAP_SIZE); + Kaleidoscope.setup(); Kaleidoscope.use(&TestMode, &LEDControl, &LEDOff, diff --git a/src/Kaleidoscope.cpp b/src/Kaleidoscope.cpp index 94c687bd..876d095c 100644 --- a/src/Kaleidoscope.cpp +++ b/src/Kaleidoscope.cpp @@ -8,7 +8,7 @@ Kaleidoscope_::Kaleidoscope_(void) { } void -Kaleidoscope_::setup(const byte keymap_count) { +Kaleidoscope_::setup(void) { wdt_disable(); delay(100); Keyboard.begin(); @@ -16,8 +16,6 @@ Kaleidoscope_::setup(const byte keymap_count) { // A workaround, so that the compiler does not optimize this out... handle_key_event (Key_NoKey, 255, 255, 0); - - Layer.defaultLayer (KeyboardHardware.load_primary_layer (keymap_count)); } void diff --git a/src/Kaleidoscope.h b/src/Kaleidoscope.h index f9212efa..fbdeb8dc 100644 --- a/src/Kaleidoscope.h +++ b/src/Kaleidoscope.h @@ -61,7 +61,8 @@ class Kaleidoscope_ { public: Kaleidoscope_(void); - void setup(const byte keymap_count); + void setup(const byte keymap_count) { setup(); }; + void setup(void); void loop(void); void use(KaleidoscopePlugin *plugin, ...) __attribute__((sentinel));