Allowing Pressing the Start Buttons Again to Stop Dynamic Macro Recording (#9446)

master
Dongfeng Yu 2020-07-08 04:59:13 +08:00 committed by GitHub
parent 03c790a0f2
commit 666cb44673
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -18,7 +18,7 @@ That should be everything necessary.
To start recording the macro, press either `DYN_REC_START1` or `DYN_REC_START2`. To start recording the macro, press either `DYN_REC_START1` or `DYN_REC_START2`.
To finish the recording, press the `DYN_REC_STOP` layer button. To finish the recording, press the `DYN_REC_STOP` layer button. You can also press `DYN_REC_START1` or `DYN_REC_START2` again to stop the recording.
To replay the macro, press either `DYN_MACRO_PLAY1` or `DYN_MACRO_PLAY2`. To replay the macro, press either `DYN_MACRO_PLAY1` or `DYN_MACRO_PLAY2`.

View File

@ -216,11 +216,13 @@ bool process_dynamic_macro(uint16_t keycode, keyrecord_t *record) {
} else { } else {
/* A macro is being recorded right now. */ /* A macro is being recorded right now. */
switch (keycode) { switch (keycode) {
case DYN_REC_START1:
case DYN_REC_START2:
case DYN_REC_STOP: case DYN_REC_STOP:
/* Stop the macro recording. */ /* Stop the macro recording. */
if (record->event.pressed) { /* Ignore the initial release if (record->event.pressed ^ (keycode != DYN_REC_STOP)) { /* Ignore the initial release
* just after the recoding * just after the recording
* starts. */ * starts for DYN_REC_STOP. */
switch (macro_id) { switch (macro_id) {
case 1: case 1:
dynamic_macro_record_end(macro_buffer, macro_pointer, +1, &macro_end); dynamic_macro_record_end(macro_buffer, macro_pointer, +1, &macro_end);