Add string macro advanced key support#22
Conversation
|
Oh I thought we want to implement the single linked list in case we want to support full macro in the future? |
|
Yes you are right this was simpler for me to write 😢 |
|
By full macro, I meant macro system where we support setting delay for each action, and possibly pointing the event to the next one to create a loop etc. I don't really have the full picture of how it will look like, but I imagine either the web configurator or the firmware to walk through the macro and compact/garbage collect the linked list buffer if it is full. Each node can have a key, delay in matrix cycle/milliseconds (potentially 0 so we can press a character and shift and the same time), and the next node. For the first simple version, I think maybe we can start with just a linked list of characters to support sending string for now, and keep the UI you proposed for hmkconf since the UI for the full macro system probably requires a lot of thought. For the garbage collection, I meant something like:
Might be too complex but I'm open for suggestions. Sorry for the back and forth, but it's kinda sad that if one day, we implement this macro system then its functionality will overlap with this PR. |
|
No issues I love the conversation! The proposed cleanup is quite sophisticated but also very bulletproof! |
|
Hello! I added another 2 bytes per "step" as a pointer to the next item in the list. BTW I dont think we need garbage collection neceserily. One disadvantage is that now with 512 byte space we only get around 100 total macro "steps" were before we were at 170. But this does make our list much more scalable. Let me know what you think.
Cheers! |
|
Thanks for making the changes. I'm sick right now, so not sure if you can review this soon though. |
|
Hey Pep! |
peppapighs
left a comment
There was a problem hiding this comment.
I left some comments from my first glance at the code. Let me know your thought and thank you for writing this PR!
As for your questions:
- I agree with keeping the firmware clean. It probably doesn't matter in practice anyway whether we do it in the same cycle or not.
- I think let's leave that aside for now. I still don't have a good picture of how the UI/UX would be like if we support repeating/looping. I suppose the implementation should not be too difficult since we are essentially implementing a tiny state machine. Open for some ideas though.
| break; | ||
|
|
||
| case STRING_MACRO_ACTION_TAP: | ||
| layout_register(state->key, node->keycode); |
There was a problem hiding this comment.
Not sure if I'm missing something but maybe we can use deferred action here for tapping, so that the tick rate config is in effect for this too.
There was a problem hiding this comment.
I tested this and I dont think we can use deferred tap here.
Mainly because the macro needs to run in order. In the situation where we have "PRESS shift, TAP a, RELEASE shift"
The release shift might happen (due to the tick of the macro) before the deferred tap has finished.
If you really prefer using deferred tap I suggest we do either:
A) hard wire a wait after macro TAP based on the tick time of deferred macro before moving to the next item in the list.
B) Add a callback from the deferred macro function to know that it has finished before moving to the next item on the list.
In both this situations the disadvantage is that the taps of macros will not be as fast as possible (currently next matrix scan cycle) but this might be acceptable. Let me know your thoughts on this.
There was a problem hiding this comment.
I'm generally ok with A) to keep it consistent with tap-hold and DKS. I acknowledge the disadvantage here, but it's probably doesn't matter in practice.
|
Done except the last point which I would like to discuss a bit more. I have some UI ideas about making loops etc but maybe we can leave that for later indeed! |
As discussed here is a first draft for the string macro:)
I used AI to help make a UI for testing but it looks quite smart:
peppapighs/hmkconf#7