Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Reset function for Tap Dance skipped when multiple Tap Dance keys are used #13764

Closed
bmijanovich opened this issue Jul 28, 2021 · 6 comments

Comments

@bmijanovich
Copy link

bmijanovich commented Jul 28, 2021

Describe the Bug

This is hard to describe, apologies up front. Say we have the following scenario:

  • Tap Dance key 1, that sends a mouse button on a single tap, and enters layer 1 on a single hold.
  • Tap Dance key 2, that sends a mouse button on a single tap, and enters layer 2 on a single hold.
  • Tap Dance state determination that favors instant hold on interrupt (pressed state triggers hold regardless of TAPPING_TERM expiry
  • A keymap like this:
Layer 0: TD_KEY_1, TD_KEY_2
Layer 1: _______, FOO
Layer 2: BAR, _______

Then, quickly perform the following, maybe using a rolling motion:

  1. Press TD_KEY_1
  2. Press TD_KEY_2
  3. Release TD_KEY_1
  4. Release TD_KEY_2

What I would expect is for FOO to execute, and to end up in Layer 0. Instead, sometimes FOO executes and sometimes it doesn't, and I often end up stuck in Layer 2 until I tap TD_KEY_2 again.

This behavior works fine if you use a non-Tap Dance keycode on key 2 on Layer 0.

System Information

  • Keyboard: Ploopy Classic
    • Revision: 1.005
  • Operating system: Mac OS Catalina 10.15.7
  • AVR GCC version:
    N/A, using QMK Docker container
  • ARM GCC version:
    N/A, using QMK Docker container
  • QMK Firmware version:
    0.13.26
  • Any keyboard related software installed?
    No
@bmijanovich
Copy link
Author

@drashna
Copy link
Member

drashna commented Aug 9, 2021

Tap dances doesn't handle interrupts well, so it's not processing the "hold" part most likely, but instead, the tap part.

@bmijanovich
Copy link
Author

bmijanovich commented Aug 9, 2021 via email

@Anomalocaridid
Copy link

I had the same issue trying to create a tap dance key on the non-base layer of my Ploopy Classic Trackball. The issue seems to be caused by overwriting your keymap's static variable for the tap dance state (td_state in the tap dance examples in the documentation).

Since I was using ACTION_TAP_DANCE_FN(), I did not need a reset function that would make recording the state necessary and I was able to fix it by simply not overwriting the state variable and instead directly branching on the output of the function to determine the tap dance mode (cur_state in the examples).

I doubt this would work with ACTION_TAP_DANCE_FN_ADVANCED(). But it may be worth trying to store the previous tap dance state in the "finished" function in another variable before overwriting it and then restoring it at the end of the "reset" function.

@joukewitteveen
Copy link
Contributor

You could test against #16394. The reset logic was cleaned up a bit and indeed there were some subtle issues with keeping track of the 'active' tap dance that got fixed.

@joukewitteveen
Copy link
Contributor

I'm fairly sure this can be closed now that #16394 is merged.

@drashna drashna closed this as completed Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants