From aa5b55e366d68faa69c63ecd626ebf22c8593918 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 8 Nov 2019 12:12:45 +0100 Subject: [PATCH] IdleLEDs: Update PersistentIdleLEDs to not use deprecated interfaces Signed-off-by: Gergely Nagy --- examples/LEDs/IdleLEDs/IdleLEDs.ino | 2 +- src/kaleidoscope/plugin/IdleLEDs.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/LEDs/IdleLEDs/IdleLEDs.ino b/examples/LEDs/IdleLEDs/IdleLEDs.ino index a4f5d686..44732f37 100644 --- a/examples/LEDs/IdleLEDs/IdleLEDs.ino +++ b/examples/LEDs/IdleLEDs/IdleLEDs.ino @@ -52,7 +52,7 @@ KALEIDOSCOPE_INIT_PLUGINS(LEDControl, LEDOff); void setup() { - KeyboardHardware.serialPort().begin(9600); + Kaleidoscope.serialPort().begin(9600); Kaleidoscope.setup(); diff --git a/src/kaleidoscope/plugin/IdleLEDs.cpp b/src/kaleidoscope/plugin/IdleLEDs.cpp index e45813b8..f0809d38 100644 --- a/src/kaleidoscope/plugin/IdleLEDs.cpp +++ b/src/kaleidoscope/plugin/IdleLEDs.cpp @@ -67,9 +67,9 @@ EventHandlerResult PersistentIdleLEDs::onSetup() { // If idleTime is max, assume that EEPROM is uninitialized, and store the // defaults. uint16_t idle_time; - KeyboardHardware.storage().get(settings_base_, idle_time); + Kaleidoscope.storage().get(settings_base_, idle_time); if (idle_time == 0xffff) { - KeyboardHardware.storage().put(settings_base_, idle_time_limit); + idle_time = idle_time_limit; } setIdleTimeoutSeconds(idle_time); @@ -78,7 +78,10 @@ EventHandlerResult PersistentIdleLEDs::onSetup() { void PersistentIdleLEDs::setIdleTimeoutSeconds(uint32_t new_limit) { IdleLEDs::setIdleTimeoutSeconds(new_limit); - KeyboardHardware.storage().put(settings_base_, (uint16_t)new_limit); + + uint16_t stored_limit = (uint16_t)new_limit; + Kaleidoscope.storage().put(settings_base_, stored_limit); + Kaleidoscope.storage().commit(); } EventHandlerResult PersistentIdleLEDs::onFocusEvent(const char *command) {