Added support for case where ONESHOT_TAP_TOGGLE is unset

This commit is contained in:
Krister Svanlund 2024-01-19 23:59:47 +01:00
parent 399f17f84b
commit f24a2b6127

View File

@ -665,18 +665,18 @@ void process_action(keyrecord_t *record, action_t action) {
if (tap_count >= ONESHOT_TAP_TOGGLE) { if (tap_count >= ONESHOT_TAP_TOGGLE) {
reset_oneshot_layer(); reset_oneshot_layer();
set_oneshot_layer(action.layer_tap.val, ONESHOT_TOGGLED); set_oneshot_layer(action.layer_tap.val, ONESHOT_TOGGLED);
} else { } else if (get_oneshot_layer() != action.layer_tap.val) {
if (get_oneshot_layer() != action.layer_tap.val) {
layer_off(action.layer_tap.val); layer_off(action.layer_tap.val);
} else { } else {
clear_oneshot_layer_state(ONESHOT_PRESSED); clear_oneshot_layer_state(ONESHOT_PRESSED);
} }
} }
}
# else # else
if (event.pressed) { if (event.pressed) {
layer_on(action.layer_tap.val); layer_on(action.layer_tap.val);
set_oneshot_layer(action.layer_tap.val, ONESHOT_START); set_oneshot_layer(action.layer_tap.val, ONESHOT_START);
} else if (get_oneshot_layer() != action.layer_tap.val) {
layer_off(action.layer_tap.val);
} else { } else {
clear_oneshot_layer_state(ONESHOT_PRESSED); clear_oneshot_layer_state(ONESHOT_PRESSED);
if (tap_count > 1) { if (tap_count > 1) {