aboutsummaryrefslogtreecommitdiff
path: root/quantum/dynamic_macro.h
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2017-05-04 01:37:46 +0200
committerWojciech Siewierski <wojciech.siewierski@onet.pl>2017-05-04 01:42:09 +0200
commit4b50ea15a954de2e6062aa7228bd1f9f76669ce7 (patch)
treec8ecf1bbb2c23ba09f38e2b295d7ed5357b990fb /quantum/dynamic_macro.h
parent436d661775178fb62b46afdc3d755fdb413dcb35 (diff)
downloadqmk_firmware-4b50ea15a954de2e6062aa7228bd1f9f76669ce7.tar.gz
qmk_firmware-4b50ea15a954de2e6062aa7228bd1f9f76669ce7.zip
dynamic_macro.h: Do not save the keys being held when stopping the recording
More specifically, we save them and then place the `macro_end` pointer before them so they are essentially ignored and the other macro may freely overwrite them.
Diffstat (limited to 'quantum/dynamic_macro.h')
-rw-r--r--quantum/dynamic_macro.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/quantum/dynamic_macro.h b/quantum/dynamic_macro.h
index 9e7845c99..c4017aec9 100644
--- a/quantum/dynamic_macro.h
+++ b/quantum/dynamic_macro.h
@@ -127,10 +127,22 @@ void dynamic_macro_record_key(
127 * End recording of the dynamic macro. Essentially just update the 127 * End recording of the dynamic macro. Essentially just update the
128 * pointer to the end of the macro. 128 * pointer to the end of the macro.
129 */ 129 */
130void dynamic_macro_record_end(keyrecord_t *macro_pointer, keyrecord_t **macro_end) 130void dynamic_macro_record_end(
131 keyrecord_t *macro_buffer,
132 keyrecord_t *macro_pointer,
133 int8_t direction,
134 keyrecord_t **macro_end)
131{ 135{
132 dynamic_macro_led_blink(); 136 dynamic_macro_led_blink();
133 137
138 /* Do not save the keys being held when stopping the recording,
139 * i.e. the keys used to access the layer DYN_REC_STOP is on.
140 */
141 while (macro_pointer != macro_buffer &&
142 (macro_pointer - direction)->event.pressed) {
143 macro_pointer -= direction;
144 }
145
134 *macro_end = macro_pointer; 146 *macro_end = macro_pointer;
135} 147}
136 148
@@ -222,10 +234,10 @@ bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record)
222 * starts. */ 234 * starts. */
223 switch (macro_id) { 235 switch (macro_id) {
224 case 1: 236 case 1:
225 dynamic_macro_record_end(macro_pointer, &macro_end); 237 dynamic_macro_record_end(macro_buffer, macro_pointer, +1, &macro_end);
226 break; 238 break;
227 case 2: 239 case 2:
228 dynamic_macro_record_end(macro_pointer, &r_macro_end); 240 dynamic_macro_record_end(r_macro_buffer, macro_pointer, -1, &r_macro_end);
229 break; 241 break;
230 } 242 }
231 macro_id = 0; 243 macro_id = 0;