Separate effect and held timeouts

Fixes #5.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/389/head
Gergely Nagy 8 years ago
parent da2bc4d656
commit c7994fb33c

@ -131,6 +131,17 @@ modifiers and one-shot layer keys. It has the following methods:
>
> Defaults to 40.
### `.holdTimeOut`
> The number of loop iterations to wait before considering a held one-shot key
> as intentionally held. In this case, the one-shot effect will not trigger when
> the key is released. In other words, holding a one-shot key at least this
> long, and then releasing it, will not trigger the one-shot effect.
>
> Not strictly a method, it is a variable one can assign a new value to.
>
> Defaults to 5.
## Further reading
Starting from the [example][plugin:example] is the recommended way of getting

@ -25,6 +25,7 @@ namespace Akela {
uint8_t OneShot::Timer = 0;
uint8_t OneShot::timeOut = 40;
uint8_t OneShot::holdTimeOut = 5;
uint32_t OneShot::State = 0;
uint32_t OneShot::stickyState = 0;
uint32_t OneShot::pressedState = 0;
@ -213,7 +214,7 @@ namespace Akela {
} else {
if (key_toggled_off (keyState)) {
clearPressed (idx);
if (hasTimedOut ()) {
if (Timer >= holdTimeOut) {
cancelOneShot (idx);
}
}

@ -37,6 +37,7 @@ namespace Akela {
static void cancel (bool withStickies);
static void cancel (void) { cancel (false); };
static uint8_t timeOut;
static uint8_t holdTimeOut;
static bool isModifierActive (Key key);

Loading…
Cancel
Save