Double or No tapKey triggered randomly by ifPrimary/ifSecondary

Firstly, apologies if this has been covered in another thread. I searched and found a few discussions that covered this sort of stuff, but nothing close enough for me to jump in. If I’ve missed something, please advis :slight_smile:

I was using resolveSecondary to provide me with tapdance-esque functionality - primarily holding “a”, “s”, “c” etc. keys for >280ms will add “ctrl” to them. The resolveSecondary worked very nicely, with the occasional false positive (usually due to me being tired and typing slower hahaha).

The Primary/Secondary has been trickier to get right - I’m getting a lot of (for example) “aa” or " " when I’m typing “a”, and am getting higher than normal occurrences of false Secondary positives. Another intermittent thing I’ve noticed is I’ll need to type “s” several times for it to stop registering the Sec (ironically just happened as I typed this - it tried to save the webpage - spooky!!).

$onInit

set macroEngine.extendedCommands 1
set secondaryRole.defaultStrategy advanced
set secondaryRole.advanced.timeout 380
set secondaryRole.advanced.timeoutAction secondary
set secondaryRole.advanced.triggerByRelease 0
set secondaryRole.advanced.safetyMargin 0
set secondaryRole.advanced.doubletapToPrimary 0

macro selectAll (mapped to “a” key)

$ifSecondary advancedStrategy final tapKey LC-a
$ifPrimary advancedStrategy final tapKey a

Happy to turn on logging, debugging etc., to get some visibility into what’s being executed behind the scenes, but thought I’d raise this here first in case there’s a “duh” coding error lol.

Any help appreciated and i LOVE my UHK <3 <3

I’m getting a lot of (for example) “aa”

That’s strange. Are you sure this was caused by the migration, and is not a (e.g.,) keyswitch related problem? ( Fixing misbehaving keys - Ultimate Hacking Keyboard )

Quick test seems to work just fine for me. If you share your UserConfig, I will give it a try…

Good point, never considered a hardware issue - will swap the “a” keyswitch with another known working one and advise. Still getting the other keys “sticking” to secondary role for several keypresses though so here’s the full config: UHK Config 2023-11-28 - Pastebin.com

More than happy for any suggestions, critiques etc. Have done the bare minimum to get what I needed happening and cleaning it up is on my ever-growing todo list lol

I’ve started following the “Fixing Misbehaving Keys” steps and noticed the “clean your module contacts you filthy pig” steps, including the loosen & fasten screws steps.

I’ve been getting random instances of the trackball stopping responding. Switching to my mouse layer for minute or so “fixes” it, as does a disconnect/reconnect of keyboard (but not module). Was going to raise this as a separate issue but am now wondering if possibly related…?

I’ve been getting random instances of the trackball stopping responding. Switching to my mouse layer for minute or so “fixes” it, as does a disconnect/reconnect of keyboard (but not module). Was going to raise this as a separate issue but am now wondering if possibly related…?

Well, I have been seeing similar problems with right side modules, so it is probably an independent problem.

1 Like

I’ve swapped my “a” keyswitch with my “g” keyswitch so will see how the phantom repeating etc goes

Another issue which is intermittent but reasonably frequent - holding down SHIFT then typing S then C results in CTRL-S being sent when S is pressed (this happens for 2-4 keypresses of the S key, when “S” finally appears, I assume the CTRL has stopped being sent) then CTRL-C being sent when C key is pressed.

If I wait for several seconds, then SHIFT S C, it works fine every time

Tried to edit earlier post but time had expired…

After a day of testing, have had no phantom repeats/blanks on the “a” key, so am guessing is either a faulty keyswitch, or given that there have been no “g” problems, possibly keyswitch just needed re-seating? Either way, all good on that front.

1 Like

possibly keyswitch just needed re-seating?

That is possible. (It usually helps to bend the legs a little so that they are tensioned against side of the hot-swap socket.)

1 Like

Issue with false positives for secondary action is still occurring, haven’t been able to find a combo of settings in $init to mitigate it. Are there any debugging settings I can turn on to identify what’s causing them?

Hmpf. I have tried a 2 minute typing test with a slightly modified version of your keymap (to produce shift+letters instead of ctrl+letters), and had no problem.

  • How often is this happening?

  • How fast typist are you? (60wpm here)

  • Is it happening during writing, or in some specific situations?

  • Have you tried disabling backlight (to rule out power issues)?

  • Tried with different computer (to rule out other strange issues)?

  • How often is this happening?

    • Multiple times a day
  • How fast typist are you? (60wpm here)

    • Just tested myself, 62wpm :kissing_heart:
  • Is it happening during writing, or in some specific situations?

    • Specific situations, it seems. When I’m typing out a block of text it doesn’t seem to happen, but when I’m typing individual characters, sometimes with mouse clicks between them, it seems to happen more. Also, I’ve noticed that (e.g.) the “S” secondary will stick until I click the “S” key 3 times.
  • Have you tried disabling backlight (to rule out power issues)?

    • Yes, no change (FYI the “a” I just typed in “change” triggered the secondary “ctrl-a” just now)
  • Tried with different computer (to rule out other strange issues)?

    • Not yet, excellent idea, will give it a shot and post results

Well, as to debugging settings, there is the statsRecordKeyTiming command, which however would only be useful if you could reproduce the issue, as the status buffer will stop recording when it gets filled…

(Normal usage is tap statsRecordKeyTiming, reproduce the issue, tap statsRecordKeyTiming again, focus text editor, tap printStatus.)

I guess I can prepare a firmware that will clear it instead, so you can leave the debug thing running in the background…

Thanks!! I’ll give this a shot and let you know.

Well this almost never happens in testing - caught an example almost immediately!!! Let me know if this helps, I haven’t had a chance to dig into it yet.

Below was:
LeftClick on Trackball Module
key “s”
2 LeftClicks
key “s” (secondary triggered)
key “s” (sec triggered)
key “s” (primary)
LeftClick

DOWN 131 5236382 5236382
UP 131 5236511 5236510
DOWN 80 5236605 5236605
UP 80 5236723 5236607
DOWN 131 5238593 5238593
UP 131 5238707 5238706
DOWN 131 5238760 5238760
UP 131 5238860 5238860
DOWN 80 5239020 5239020
UP 80 5239103 5239102
DOWN 80 5240602 5240601
UP 80 5240700 5240700
DOWN 80 5241275 5241275
UP 80 5241411 5241275
DOWN 131 5242855 5242855
UP 131 5242973 5242973
1 Like

Hm, that’s strange. I do see there three short simple “s” key taps. No reason to produce secondaries, indeed.

BTW, I don’t think you need a macro for that. You’ve already set up your advancedStrategy as a default in your $onInit together with the default parameters. You could now just map the primary and secondary scancodes directly in Agent. No need to go through a macro.

That’d be great to do - I was wondering about a way to do this but couldn’t figure it out. Using Agent → Keypress and assigning the primary scancode to A was fine but the secondary role appears to only allow modifiers by themselves, not in conjunction with the primary. Hopefully I’ve missed something, as having macros for all these 2 line command sets is a bit cluttery :smiley:

Got another “S” phantom secondary activation. I’d added statsActiveKeys and statsActiveMacros to my debugging keys so hit them after activating statsRecordTiming, then printed:

DOWN 80 8320423 8320423
UP 80 8320519 8320519
DOWN 31 8322075 8322075
DOWN 2 8323916 8323916
keyid/previous/current/debouncing
 2/ 1/ 1/ 1/ 31/ 1/ 1/ 0/UP 2 8324114 8324113
 DOWN 3 8325902 8325902
 Macro playing:  1
 macro/slot/adr/properties
  statsActiveMacros/ 0/ 0/
  s: 0 0 0 1: 0 
  UP 3 8326085 8326085
  UP 31 8326235 8326235

You do need a macro for that. The regular secondary role does not allow custom actions.