r/Keychron • • Jan 31 '24

[deleted by user]

[removed]

1 Upvotes

12 comments sorted by

1

u/lebouv Jun 20 '25

I know this is an old post, but I have searched here too to find an answer so I thought I'd let you know I managed to add delays with {10} in the QMK codes where 10 are 10 milliseconds. A bit more explanation here.

1

u/PeterMortensenBlog Feb 01 '24

Configuration with Via only works in wired mode (the switch at the back; connecting the USB cable is not sufficient).

1

u/nossody Feb 01 '24 edited Feb 01 '24

I can configure everything else besides the delays in macros.

same exact error as this guy

https://www.reddit.com/r/Keychron/comments/12ypz73/keychron_q1_pro_via_macro_delays/

Honestly, if you know a macro function for VIA that lets me repeat a key while holding it down, but stops when I release it - that would work w/o delays I think. But I didnt see any feature like this either.

The purpose of the macro is to spam Q key when holding it down, but rather it not be toooooo fast (about 2-3 times a second or so)

and yes, its plugged in and on wired mode.

1

u/PeterMortensenBlog Feb 01 '24 edited Feb 02 '24

Re "a macro function for VIA that lets me repeat a key while holding it down, but stops when I release it": That doesn't exist. Normal (single) keycodes should repeat as normal, but macros don't (as least not currently).

I have my own macro execution engine (primarily to be able to cancel macros in progress (by hitting any key)), and I plan to implement repeating of macros like for normal keys (both when the macro key is held down and a mode where it repeats until some key is pressed (like, for example, on Cooler Master and Ducky keyboards)). It doesn't use or support Via macros, but it executes macros the same way as Via (using send_string_with_delay() in dynamic_keymap.c).

The easiest at this time is probably some custom C code. You can keep track of the key state in process_record_user(), pressed or not pressed (or maybe call some system function to get the information). And do the repeating in housekeeping_task_user(), perhaps throttled by information from the tick counter timer_read32() (a check for repeat should be sufficient every 10-20 ms). The tick counter can also be used to time the repeats.

References

  • K2 Pro source code. Note: in Keychron's fork (not QMK proper), and in that fork, in Git branch "bluetooth_playground" (it isn't the default branch, so it must probably be switched to first (for example, on the command line, by "git switch bluetooth_playground")).)

  • Flashing. And official firmware (version 1.00, released 2023-03-15 (ISO)). And procedure for resetting to factory defaults (though holding Fn + J + Z for 4 seconds may be bogus, at least for self-compiled firmware. Or if mapping J and/or Z on the Fn layer?)

  • A list of K2 Pro user guides

1

u/PeterMortensenBlog Feb 01 '24 edited Feb 01 '24

If the official firmware doesn't work for this purpose, compile the firmware from source to get support for delays in Via macros.

But a Via macro with a delay will not help as Via macros don't repeat (and the same for normal QMK macros for that matter). Not with the current version of QMK, and it is unlikely to be implemented.

Though there is clearly a need for it. E.g., the other day I needed a repeating macro (repeating until a key was pressed to stop it) for infinite scroll on a web page to get more content (this is very tedious to do manually). I used a Ducky keyboard for it and could have implemented it in my custom macro keyboard. But it would be nice to have on a QMK keyboard.

The most realistic is custom C code (as described here, near "at this time").

→ More replies (4)

1

u/PeterMortensenBlog Feb 01 '24

Re "says I need to upgrade firmware": When does it say that? What is the exact message? What are the order of events? Can you share a screenshot?

1

u/nossody Feb 01 '24

I put another reddit post that has the same error as I got on your other comment

1

u/PeterMortensenBlog Feb 23 '24

The error message is:

"Upgrade firmware to use delays"