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

Mod Tap or Tap Dance requires two taps to initiate #16855

Open
3 tasks
pzrsa opened this issue Apr 15, 2022 · 5 comments
Open
3 tasks

Mod Tap or Tap Dance requires two taps to initiate #16855

pzrsa opened this issue Apr 15, 2022 · 5 comments

Comments

@pzrsa
Copy link

pzrsa commented Apr 15, 2022

Describe the Bug

Whenever I use my keyboard again after a while, mod tap or tap dance do not work when tapping once. For mod tap I have to press twice for it to activate atleast once. Also for tap dance I cannot even activate single tap key as I'm only handling the state for single tap and single hold.

For example if I have a mod tap setup to send Control on hold and Z on tap, it will not send Z on the first tap. Instead it would only send after tapping it again for the second time. Hold works perfectly fine in all cases, but tapping does not.

The only way I have managed to find a fix is by unplugging the USB-C cable and replugging it into the microcontroller.

System Information

Keyboard: Cantor
Revision (if applicable):
Operating system: macOS
qmk doctor output:

Ψ QMK Doctor is checking your environment.
Ψ CLI version: 1.0.0
Ψ QMK home: /Users/parsa/qmk_firmware
Ψ Detected macOS 12.3.
Ψ Git branch: master
Ψ Repo version: 0.16.7
Ψ CLI installed in virtualenv.
Ψ All dependencies are installed.
Ψ Found arm-none-eabi-gcc version 8.3.1
Ψ Found avr-gcc version 8.4.0
Ψ Found avrdude version 6.4
Ψ Found dfu-util version 0.11
Ψ Found dfu-programmer version 0.7.2
Ψ Submodules are up to date.
Ψ QMK is ready to go

Any keyboard related software installed?

  • AutoHotKey (Windows)
  • Karabiner (macOS)
  • Other:

Additional Context

The Cantor keyboard has not been merged yet into the master branch, however this is the pr for adding it.

And here is my keymap.

There has been another PR with the same issue and microcontroller, but I'm not sure if it stems from the keyboard going to sleep.

@pzrsa pzrsa closed this as completed Apr 15, 2022
@pzrsa pzrsa changed the title ModTap or Tap Dance Mod Tap or Tap Dance requires two taps to initiate Apr 15, 2022
@pzrsa pzrsa reopened this Apr 15, 2022
@jtai
Copy link

jtai commented Apr 16, 2022

I've experienced the same issue with my cantor. The problem can often (but not always) be triggered by putting my Mac to sleep for a few minutes. I think I may have also seen it once or twice during active use of the computer.

I was able to reproduce the issue with a variant of the very basic default cantor keymap that has one of the keys changed to a mod tap key. I have tried both the master branch with ChibiOS 20.3.4 and the develop branch with ChibiOS 21.11.1 but they both exhibit the issue.

I have also tried capturing debug logs by enabling console, enabling debug, and defining DEBUG_ACTION, but unfortunately I cannot seem to reproduce the problem when debugging is enabled.

@pzrsa
Copy link
Author

pzrsa commented Apr 16, 2022

Thats exactly whats happening. Glad to hear I'm not the only one experiencing this issue.

For Tap Dance I can activate a single tap on the spacebar by pressing a modifier right before. So I tap CMD once and tap spacebar right after and it counts as a tap. Pressing again by itself or with a letter does not seem to do anything.

I believe this might a blackpill issue just with the other PR I linked as for that it was the result of the microcontroller.

Also on the mac login screen the tap works as it should, and then after logging in it goes back to not working.

@jtai
Copy link

jtai commented Apr 16, 2022

I am also relieved it's not just me since the issue seems somewhat obscure.

Although my keymap has a tap dance key, I don't normally have a tap function assigned to it. But based on your comment, for experimentation purposes I assigned KC_SPC to it to see if it would also break, and it does. However, I also added some code to the tap dance handler to toggle the built in LED on the blackpill, and surprisingly, that part works. So it seems like the tap logic is fine -- it's just the key that doesn't get sent. That seems to line up with the findings in this comment on that older issue.

Here's the relevant code:

static bool dance_led = false;

void dance_finished(qk_tap_dance_state_t *state, void *user_data) {
    switch (state->count) {
        case 1:
            if (!state->pressed) {
                dance_led = !dance_led;
                uint16_t level = dance_led ? LED_PIN_ON_STATE : ~LED_PIN_ON_STATE;
                writePin(LED_CAPS_LOCK_PIN, level);

                tap_code(KC_SPC);
            }
            break;

You also need the following in config.h

#define LED_CAPS_LOCK_PIN C13
#define LED_PIN_ON_STATE 0

Finally, one difference in our experiences -- when it occurs, the issue affects me on the login screen after waking up from suspend and persists after logging in. In the password input if I tap the mod tap key, nothing happens.

@rhruiz
Copy link
Contributor

rhruiz commented Apr 21, 2022

Same issue here. I am using a board with a STM32F411 mcu just like the blackpill that cantor uses

@manna-harbour
Copy link
Contributor

Seems to be the same issue as #16406.

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