Add a few comments explaining why we call Layer.updateKeyCache()

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/172/head
Gergely Nagy 7 years ago
parent 3748fe7669
commit 130845f897

@ -14,6 +14,8 @@ Kaleidoscope_::setup(void) {
// A workaround, so that the compiler does not optimize this out... // A workaround, so that the compiler does not optimize this out...
handleKeyswitchEvent(Key_NoKey, 255, 255, 0); handleKeyswitchEvent(Key_NoKey, 255, 255, 0);
// Update the key cache, so we start with a non-empty state.
Layer.updateKeyCache(); Layer.updateKeyCache();
} }

@ -106,6 +106,9 @@ void Layer_::on(uint8_t layer) {
bitSet(LayerState, layer); bitSet(LayerState, layer);
if (layer > highestLayer) if (layer > highestLayer)
highestLayer = layer; highestLayer = layer;
// Update the key cache, so that if anything depends on knowing the active
// layout, the layout will be in sync.
updateKeyCache(); updateKeyCache();
} }
@ -113,6 +116,9 @@ void Layer_::off(uint8_t layer) {
bitClear(LayerState, layer); bitClear(LayerState, layer);
if (layer == highestLayer) if (layer == highestLayer)
highestLayer = top(); highestLayer = top();
// Update the key cache, so that if anything depends on knowing the active
// layout, the layout will be in sync.
updateKeyCache(); updateKeyCache();
} }

Loading…
Cancel
Save