aboutsummaryrefslogtreecommitdiff
path: root/lib/usbhost/arduino-1.0.1/cores/arduino/HID.cpp
diff options
context:
space:
mode:
authorPascal Getreuer <[email protected]>2025-04-22 00:59:49 -0700
committerGitHub <[email protected]>2025-04-22 09:59:49 +0200
commit73e2ef486ab7acf3763695cb3a3cf691451cdff3 (patch)
tree42fa19653935e7e2c7cc720accaf5ba17641d141 /lib/usbhost/arduino-1.0.1/cores/arduino/HID.cpp
parentb5f8f4d6a201e6a67d1ee483fe6d3327d98cb052 (diff)
downloadqmk_firmware-73e2ef486ab7acf3763695cb3a3cf691451cdff3.tar.gz
qmk_firmware-73e2ef486ab7acf3763695cb3a3cf691451cdff3.zip
[Bug][Core] Fix for Flow Tap: fix handling of distinct taps and timer updates. (#25175)
* Flow Tap bug fix. As reported by @amarz45 and @mwpardue, there is a bug where if two tap-hold keys are pressed in distinct taps back to back, then Flow Tap is not applied on the second tap-hold key, but it should be. In a related bug reported by @NikGovorov, if a tap-hold key is held followed by a tap of a tap-hold key, then Flow Tap updates its timer on the release of the held tap-hold key, but it should be ignored. The problem common to both these bugs is that I incorrectly assumed `tapping_key` is cleared to noevent once it is released, when actually `tapping_key` is still maintained for `TAPPING_TERM` ms after release (for Quick Tap). This commit fixes that. Thanks to @amarz45, @mwpardue, and @NikGovorov for reporting! Details: * Logic for converting the current tap-hold event to a tap is extracted to `flow_tap_key_if_within_term()`, which is now invoked also in the post-release "interfered with other tap key" case. This fixes the distinct taps bug. * The Flow Tap timer is now updated at the beginning of each call to `process_record()`, provided that there is no unsettled tap-hold key at that time and that the record is not for a mod or layer switch key. By moving this update logic to `process_record()`, it is conceptually simpler and more robust. * Unit tests extended to cover the reported scenarios. * Fix formatting. * Revision to fix @NikGovorov's scenario. The issue is that when another key is pressed while a layer-tap hasn't been settled yet, the `prev_keycode` remembers the keycode from before the layer switched. This can then enable Flow Tap for the following key when it shouldn't, or vice versa. Thanks to @NikGovorov for reporting! This commit revises Flow Tap in the following ways: * The previous key and timer are both updated from `process_record()`. This is slightly later in the sequence of processing than before, and by this point, a just-settled layer-tap should have taken effect so that the keycode from the correct layer is remembered. * The Flow Tap previous key and timer are updated now also on key release events, except for releases of modifiers and held layer switches. * The Flow Tap previous key and timer are now updated together, for simplicity. This makes the logic easier to think about. * A few additional unit tests, including @NikGovorov's scenario as "layer_tap_ignored_with_disabled_key_complex."
Diffstat (limited to 'lib/usbhost/arduino-1.0.1/cores/arduino/HID.cpp')
0 files changed, 0 insertions, 0 deletions