The plugin should not try to set the colors of a layer higher than
`max_layers_`, because the colormap for that would be coming from an EEPROM area
that is not ours, and result in weird colors at best.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
The `OneShot.isActive(key)` method was returning true even if a key timed out,
when `OneShot.isActive()` already returned false. It now takes the timeout into
consideration too.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
OneShot has a convenient way to tell us if any OneShot keys are active:
`OneShot.isActive()`. Thus, if we are using oneshots only, we can skip scanning
the whole keymap if no one-shots are active, saving us a whole lot of time per
cycle we would be spending needlessly.
The optimization is off by default, and must be turned on by the user's sketch.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
We want to start with a pre-cached state, so we have both less work to do when
keys are first pressed, and so that plugins that rely on the live composite
state will work reliably too.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
For all cases outside of Kaleidoscope itself, we are good with the value of
`highestLayer`, and do not need to re-scan the layer state. For this reason -
upon @obra's suggestion - rename `Layer.highest()` to `Layer.top()`, and the old
`Layer.top()` to `Layer.updateHighestLayer()`, and make the latter private, and
update the `highestLayer` member variable instead of returning the number.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
We are fine with the cached value, so lets use that and save a little time,
rather than the always-correct `Layer.top()`.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
`layer_getKey` was introduced in 6d641e7fc5, by
mistake, it was never implemented. Remove it now to avoid any possible
confusion.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
Use `Kaleidoscope.use` and `Kaleidoscope.useEventHandlerHook` instead of the
deprecated `USE_PLUGINS` and `event_handler_hook_use` interfaces.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
Use `Kaleidoscope.use` and `Kaleidoscope.useEventHandlerHook` instead of the
deprecated `USE_PLUGINS` and `event_handler_hook_use` interfaces.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>