sync ACHORDION_STREAK fix and enable it again

This commit is contained in:
Christoph Cullmann 2024-08-12 12:24:59 +02:00
parent 01631f9d70
commit d893a9bca0
No known key found for this signature in database
2 changed files with 23 additions and 16 deletions

View file

@ -77,7 +77,13 @@ static void update_streak_timer(uint16_t keycode, keyrecord_t* record) {
// Calls `process_record()` with state set to RECURSING.
static void recursively_process_record(keyrecord_t* record, uint8_t state) {
achordion_state = STATE_RECURSING;
#if defined(POINTING_DEVICE_ENABLE) && defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE)
int8_t mouse_key_tracker = get_auto_mouse_key_tracker();
#endif
process_record(record);
#if defined(POINTING_DEVICE_ENABLE) && defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE)
set_auto_mouse_key_tracker(mouse_key_tracker);
#endif
achordion_state = state;
}
@ -118,21 +124,6 @@ static void settle_as_tap(void) {
tap_hold_record.event.pressed = false;
// Plumb tap release event.
recursively_process_record(&tap_hold_record, STATE_TAPPING);
#ifdef ACHORDION_STREAK
update_streak_timer(keycode, record);
if (is_streak && is_key_event && is_tap_hold && record->tap.count == 0) {
// If we are in a streak and resolved the current tap-hold key as a tap
// consider the next tap-hold key as active to be resolved next.
update_streak_timer(tap_hold_keycode, &tap_hold_record);
const uint16_t timeout = achordion_timeout(keycode);
tap_hold_keycode = keycode;
tap_hold_record = *record;
hold_timer = record->event.time + timeout;
achordion_state = STATE_UNSETTLED;
pressed_another_key_before_release = false;
return false;
}
#endif
}
bool process_achordion(uint16_t keycode, keyrecord_t* record) {
@ -262,6 +253,22 @@ bool process_achordion(uint16_t keycode, keyrecord_t* record) {
#endif // REPEAT_KEY_ENABLE
} else {
settle_as_tap();
#ifdef ACHORDION_STREAK
update_streak_timer(keycode, record);
if (is_streak && is_key_event && is_tap_hold && record->tap.count == 0) {
// If we are in a streak and resolved the current tap-hold key as a tap
// consider the next tap-hold key as active to be resolved next.
update_streak_timer(tap_hold_keycode, &tap_hold_record);
const uint16_t timeout = achordion_timeout(keycode);
tap_hold_keycode = keycode;
tap_hold_record = *record;
hold_timer = record->event.time + timeout;
achordion_state = STATE_UNSETTLED;
pressed_another_key_before_release = false;
return false;
}
#endif
}
recursively_process_record(record, achordion_state); // Re-process event.

View file

@ -38,7 +38,7 @@
// details see https://precondition.github.io/home-row-mods
// detect typing streaks
//#define ACHORDION_STREAK
#define ACHORDION_STREAK
// Enable rapid switch from tap to hold, disables double tap hold auto-repeat.
#define QUICK_TAP_TERM 0