When calculating `end_time`, explicitly cast `idle_time_limit` to 32 bits,
otherwise the `idle_time_limit * 1000` operation will be done on 16 bits, which
would overflow at about 65 seconds. With the cast, the operation will use all 32
bits, and we avoid the overflow.
Many thanks to @nevd for the report and the help in debugging & testing the fix.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Suggested by `nev` on Discord, this plugin will turn the LEDs off after a
configurable idle time, and back on on the next keypress.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
When `LEDControl` is paused, we want to pause not just the LED modes, but *all*
LED operations. The easiest way to do this is to not sync them.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
For easier navigation of changes, this introduces `NEWS.md`, a high-level
overview of important or otherwise noteworthy changes. It is a short list only,
with just the bare minimum of details. The new `UPGRADING.md` on the other hand,
is a much more detailed document, and contains the upgrade notes from plugins
too. The plugin docs now document the current version of the plugins only.
The intent is to have both a short overview (`NEWS.md`), and a detailed
guide (`UPGRADING.md`). The former will contain historical entries too, while
the later is meant to be an upgrade guide from the previous version to the most
recent one, with old notes eventually removed.
Fixes#436.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
This is pretty much the same thing as keyboardio/Kaleidoscope-OneShot#23 by
@jamesnvc, except that it also changes the `isLayerKey()` macro, which was
otherwise unused.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
To make the interaction with plugins that work on top of LEDModes (such as
`ActiveModColor`), we need a `refreshAt()` method. For AlphaSquare, we'll return
black when a pixel has timed out, or if a key is not part of the currently lit
symbol.
Fixes#401.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Instead of remembering a key whenever a new one toggles on, remember only when
Redial itself is not held. We keep track of the last pressed key while Redial is
held, though, so we can update the key to redial when we're released ourselves.
This should fix#396.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
A long-long time ago, Kaleidoscope used to call `onKeyswitchEvent` (or rather,
it's then-current incarnation) even when keys were idle. For a number of
plugins, this was a case they didn't want to handle, and bailed out early.
When we changed Kaleidoscope to not call the event handlers for idle keys, these
plugins weren't modified at the same time, and the superfluous check remained,
making the firmware both larger and marginally slower.
Since the event handlers are never called when idle, it is safe to remove these
checks.
Affected plugins are `Leader`, `OneShot`, and `TapDance`.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
EscapeOneShot needs to stop bailing out early when a oneshot is pressed (sticky
appears pressed), and continue with its process if there's a sticky oneshot.
This makes stickies cancelable via the EscapeOneShot plugin.
For this to work, OneShot needed an `.isSticky()` method, much like
`.isActive()` and `.isPressed()`.
Fixes#413 and likely addresses part of #408 too.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Way back when, in order to fix the issue explained in
keyboardio/Kaleidoscope-OneShot#4, we made it so that keys that interrupt a
OneShot will be masked (unless certain conditions are met). Since then, we
changed how keys are looked up, and the original problem is no longer present.
This makes the masking unnecessary.
Begin unnecessary is good news, because that masking prevented key repeat for
keys on a one-shot layer (even when the OSL key was held).
Fixes#415.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
I chose the date to be the same as the removal date of other compatibility stuff
recently introduced, so we'll only have one flag day. We could remove it
earlier, because the error was there for a while now, but I'd rather play it safe.
Fixes#374.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
This allows us to do `i < LED_COUNT` comparisons on boards with no LEDs. All
places that did this comparison have been updated to use `int8_t`, as were all
places that use a LED index.
Together with the previous commits, fixes#385.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
LED related functions should be as close to no-op on LED-less hardware as
possible. For this reason, guard all relevant points with an early exit in the
LED-less case.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Intended to make it easier for LED-using code to bail out early, this simple
constant will tell us whether the board has LEDs or if it does not.
Because this will be used regularly, by code not close to the hardware,
`Kaleidoscope.has_leds` is an alias to `KeyboardHardware.has_leds`.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
In an attempt to move away from magic, global defines, move the `ROWS`, `COLS`,
and `LED_COUNT` defines to the hardware class. Backwards-compatible defines are
provided by `<Kaleidoscope.h>`.
This is just a first step, no users are updated just yet.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
If there's a config file in the sketch dir, load BOARD & FQBN from it, so we can
compile for different boards from within the same repo.
Fixes#425.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
With moving to a monorepo, the plugin will always be compiled, so we want to
guard ourselves, to only compile when building for the ErgoDox. We do this with
an `#ifdef ARDUINO_AVR_ERGODOX` guard.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Move the documentation to `doc/plugin/Hardware-EZ-ErgoDox.md`, sources under
`src/kaleidoscope/plugin/` (appropriately namespaced). This is in preparation of
merging plugins into a single monorepo.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
With moving to a monorepo, the plugin will always be compiled, so we want to
guard ourselves, to only compile when building for the Atreus. We do this with
an `#ifdef ARDUINO_AVR_ATREUS` guard.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>
Move the documentation to `doc/plugin/Hardware-Technomancy-Atreus.md`. This is
in preparation of merging plugins into a single monorepo.
Signed-off-by: Gergely Nagy <algernon@keyboard.io>