diff --git a/src/Kaleidoscope.cpp b/src/Kaleidoscope.cpp index c50d7d64..3a6bbdd0 100644 --- a/src/Kaleidoscope.cpp +++ b/src/Kaleidoscope.cpp @@ -14,6 +14,8 @@ Kaleidoscope_::setup(void) { // A workaround, so that the compiler does not optimize this out... handleKeyswitchEvent(Key_NoKey, 255, 255, 0); + + // Update the key cache, so we start with a non-empty state. Layer.updateKeyCache(); } diff --git a/src/layers.cpp b/src/layers.cpp index 23377a3a..100d1f7c 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -106,6 +106,9 @@ void Layer_::on(uint8_t layer) { bitSet(LayerState, layer); if (layer > highestLayer) highestLayer = layer; + + // Update the key cache, so that if anything depends on knowing the active + // layout, the layout will be in sync. updateKeyCache(); } @@ -113,6 +116,9 @@ void Layer_::off(uint8_t layer) { bitClear(LayerState, layer); if (layer == highestLayer) highestLayer = top(); + + // Update the key cache, so that if anything depends on knowing the active + // layout, the layout will be in sync. updateKeyCache(); }