1
0
Fork 0

Improve one shot hold

This commit is contained in:
Cat /dev/Nulo 2022-02-24 15:39:33 -03:00
parent c6e976889f
commit 428530799b

View file

@ -1,5 +1,7 @@
#include "oneshot.h" #include "oneshot.h"
// https://github.com/daliusd/qmk_firmware/blob/daliusd-redox/keyboards/ferris/keymaps/daliusd/oneshot.c
void update_oneshot( void update_oneshot(
oneshot_state *state, oneshot_state *state,
uint16_t mod, uint16_t mod,
@ -39,7 +41,11 @@ void update_oneshot(
} }
if (!is_oneshot_ignored_key(keycode)) { if (!is_oneshot_ignored_key(keycode)) {
switch (*state) { switch (*state) {
case os_down_unused:
*state = os_down_used;
break;
case os_up_used: case os_up_used:
*state = os_up_unqueued;
unregister_code(mod); unregister_code(mod);
break; break;
case os_up_queued: case os_up_queued:
@ -53,9 +59,6 @@ void update_oneshot(
if (!is_oneshot_ignored_key(keycode)) { if (!is_oneshot_ignored_key(keycode)) {
// On non-ignored keyup, consider the oneshot used. // On non-ignored keyup, consider the oneshot used.
switch (*state) { switch (*state) {
case os_down_unused:
*state = os_down_used;
break;
case os_up_used: case os_up_used:
*state = os_up_unqueued; *state = os_up_unqueued;
unregister_code(mod); unregister_code(mod);