Three button macro broken with Agent/Firmware Update

I recently updated Agent/Firmware because it wouldn’t let me save macros to UHK 60.

But now these macros are broken and I can’t seem to fix them.

If I pressed j + k + l at the same time it would switch to fn3 layer.

ifShortcut 16 17 final toggleLayer fn3
ifShortcut 17 16 final toggleLayer fn3
holdKey j

ifShortcut 15 17 final toggleLayer fn3
ifShortcut 17 15 final toggleLayer fn3
holdKey k

ifShortcut 15 16 final toggleLayer fn3
ifShortcut 16 15 final toggleLayer fn3
holdKey l

Now nothing happens.

I switched them to this which toggled the layer

ifShortcut k final toggleLayer fn3
ifShortcut l final toggleLayer fn3
holdKey j

ifShortcut l final toggleLayer fn3
ifShortcut j final toggleLayer fn3
holdKey k

ifShortcut k final toggleLayer fn3
ifShortcut j final toggleLayer fn3
holdKey l

but after it toggles, it presses whatever is on the j or k or l keys on the fn3 layer.

I was looking for a delay after the toggle, but couldn’t seem to find?

Or does anyone know how to rewrite so i can press j + k + l and use the fn3 layer, without it pressing j or k or l fn3 buttons?

If the upgrade caused behavior change, then it is a bug → [macros][bug] ifShortcut issues · Issue #1202 · UltimateHackingKeyboard/firmware · GitHub

1 Like

A little while ago, on the path from firmware v11.x to firmware v12.x the key ids changed. It makes sense to use the text labels instead of the numeric ids.

As @kareltucek wrote, there may be additional bugs involved.

3 Likes

Thanks for opening the ticket.

Thanks for the extra info

@jello, I have tested this, and it seems to work correctly:

ifShortcut k l final toggleLayer fn
ifShortcut l k final toggleLayer fn
holdKey j

Let me know if it still has some issues. Closing the github issue until then.

@kareltucek thanks for looking at it. I just turned the macros on again. I have them set on j , k , and l so it doesn’t matter which three I hit. And it works now! Without hitting the next layer buttons.

Sorry for your troubles. Maybe unplugging the keyboard in the last few days helped or restarting my computer. Thanks!

1 Like

The first post macros are wrong ;-). No worries.

Kudos go to Max who has remembered the v11 to v12 key id changes.

When i had it set to this (which works now):

ifShortcut k l final toggleLayer fn3
ifShortcut l k final toggleLayer fn3
holdKey j

ifShortcut l j final toggleLayer fn3
ifShortcut j l final toggleLayer fn3
holdKey k

ifShortcut j k final toggleLayer fn3
ifShortcut k j final toggleLayer fn3
holdKey l

The keyboard didn’t register anything. It only toggled when like this but then brought up the bug:

ifShortcut k final toggleLayer fn3
ifShortcut l final toggleLayer fn3
holdKey j

ifShortcut l final toggleLayer fn3
ifShortcut j final toggleLayer fn3
holdKey k

ifShortcut k final toggleLayer fn3
ifShortcut j final toggleLayer fn3
holdKey l

Regardless, thanks again for looking at it.

@maexxx thanks for the help!

You should be able to use orGate to simplify the macros.

Bind this macro to the j key:

ifShortcut orGate k l final toggleLayer fn3
holdKey j

This will toggle the layer when j+k or j+l are pressed together.

Of course you will also want to bind corresponding, similar macros to the k and l keys.

@maexxx amazing. I didn’t know there was an ‘or’ operator.

But when I simplify with the orGate operator it reintroduces the bug I was having.

I have vim arrow keys on my fn3, so when I’m in a word processor it inevitably hits one of the arrow keys after toggling the layer. Misplacing the cursor.

when I have it like this,

ifShortcut k l final toggleLayer fn3
ifShortcut l k final toggleLayer fn3
holdKey j

ifShortcut l j final toggleLayer fn3
ifShortcut j l final toggleLayer fn3
holdKey k

ifShortcut j k final toggleLayer fn3
ifShortcut k j final toggleLayer fn3
holdKey l

it works. the cursor stays in the same spot.

What’s your intended use case? I the following table what you want to achieve?

press this (together) result
j j
j+k toggleLayer fn3
j+l toggleLayer fn3
k k
k+j toggleLayer fn3
k+l toggleLayer fn3
l l
l+k toggleLayer fn3
l+j toggleLayer fn3
j+k+l toggleLayer fn3

I want to press j + k + l (or any combination of j + k + l , (e.g., jkl, klj, ljk, jlk, etc… ) at the same time to toggle the layer on.

Ah, all of them together only!

press this (together) result
j j
j+k jk
j+l jl
k k
k+j kj
k+l kl
l l
l+k lk
l+j lj
j+k+l toggleLayer fn3

I think this should work then:

On j key:

ifShortcut anyOrder k l final toggleLayer fn3
holdKey j

And of course add corresponding macros to the other keys, with the letters rotated.

anyOrder ensures that j+k+l and j+l+k are both recognised.

2 Likes

The anyOrder command doesn’t seem to work with three button presses.

After configuring the macro for the j , k, and l buttons I opened blank page in a word processor and pressed the three button’s ten times and got numerous misfires.

You may be right that anyOrder does not work correctly on the UHK 80. @kareltucek ?

I haven’t tested this with UHK 60 yet, but it seems to have problems on UHK 80 using firmware 13.0.1.

Fix ifShortcut anyOrder, broken probably by event refactor. by kareltucek · Pull Request #1208 · UltimateHackingKeyboard/firmware · GitHub

Thanks for report!

1 Like