The default `onSetup` will call `.begin`, to support initializing plugins using
the V1 plugins while using `KALEIDOSCOPE_INIT_PLUGINS`. However, plugins that
implement a compatibility layer so that they can be used with both the new API,
and with `Kaleidoscope.use()` will have a `.begin` method too. Which the default
`onSetup` will call, and we'll register the compatibility layer too, in addition
to the new-style event handlers. This results in many things running twice,
which leads to all kinds of problems.
For this reason, override `onSetup`, so that it does not call `begin`. When used
with `Kaleidoscope.use()`, the plugin will still work, so compatibility is
maintained. But the bug is now gone.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Use `Kaleidoscope.use`, `Kaleidoscope.useEventHandlerHook`, and
`Kaleidoscope.useLoopHook` instead of the deprecated `USE_PLUGINS`,
`event_handler_hook_use` and `loop_hook_use` interfaces.
Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
When interrupting, we send a report, release all keys, and mask the interrupting
key to avoid issues like sending too many of the interrupting keys. Later on, we
unmask the interrupting key if it has been masked.
This fixes#9, but requires the masking patches to be merged first.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
When releasing immediately, other keys that may affect us (such as Shift) may
not be handled yet. So lets wait with the release until the next loop.
Addresses #6, at least partially.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
When timing out, we should not clear the timer, because then we'll fail to reset
the tapCount later, too.
Fixes#8.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Limiting the number of keys saves us 20 bytes of SRAM, and almost 200
bytes of program space, and 16 tap-dance keys are still plenty.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Instead of calculating a time delta every time we want to check for a
timeout, compute the projected end ahead of time.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
To be able to change the LEDs under a tap-dance key - for example - we need to
know its position. For this reason, remember the position, and use it when
injecting events, and pass them to `tapDanceAction`, too.
Fixes#3.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Having a long timeout for tap-dance is counter-intuitive, unlike for the other
special keys with timeouts. Use a short one instead.
Fixes#2.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
When tapping a tap-dance key handled by `TapDance::actionKeys` more times than
the amount of keys available, treat it as if the last action was to be
triggered. This feels not only more intuitive, but it also allows the counter
and state to reset as soon as possible, resulting in a better typing experience.
Fixes#1.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>