diff options
author | Wojciech Siewierski <wojciech.siewierski@onet.pl> | 2017-05-03 23:47:52 +0200 |
---|---|---|
committer | Wojciech Siewierski <wojciech.siewierski@onet.pl> | 2017-05-04 00:14:38 +0200 |
commit | 40fe30e4d6b521284fa3cb7ae217ebb6d013bcdf (patch) | |
tree | ee4dd692ca3039c3f717399541710ed54e7882b5 /quantum/dynamic_macro.h | |
parent | c8ac556e63c62078fe1edfc1a116c36ad34da8e3 (diff) | |
download | qmk_firmware-40fe30e4d6b521284fa3cb7ae217ebb6d013bcdf.tar.gz qmk_firmware-40fe30e4d6b521284fa3cb7ae217ebb6d013bcdf.zip |
dynamic_macro.h: Ignore all the initial key releases
Right after the user initiates the macro recording, they usually need
to release some keys used to access the DYN_REC_START layers. It makes
sense to ignore them.
Note: The keys used to access the DYN_REC_STOP key are *not* ignored.
Diffstat (limited to 'quantum/dynamic_macro.h')
-rw-r--r-- | quantum/dynamic_macro.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/quantum/dynamic_macro.h b/quantum/dynamic_macro.h index 939816a59..1a8ec4032 100644 --- a/quantum/dynamic_macro.h +++ b/quantum/dynamic_macro.h | |||
@@ -97,17 +97,24 @@ void dynamic_macro_play( | |||
97 | /** | 97 | /** |
98 | * Record a single key in a dynamic macro. | 98 | * Record a single key in a dynamic macro. |
99 | * | 99 | * |
100 | * @param macro_buffer[in] The start of the used macro buffer. | ||
100 | * @param macro_pointer[in,out] The current buffer position. | 101 | * @param macro_pointer[in,out] The current buffer position. |
101 | * @param macro_end2[in] The end of the other macro which shouldn't be overwritten. | 102 | * @param macro_end2[in] The end of the other macro which shouldn't be overwritten. |
102 | * @param direction[in] Either +1 or -1, which way to iterate the buffer. | 103 | * @param direction[in] Either +1 or -1, which way to iterate the buffer. |
103 | * @param record[in] The current keypress. | 104 | * @param record[in] The current keypress. |
104 | */ | 105 | */ |
105 | void dynamic_macro_record_key( | 106 | void dynamic_macro_record_key( |
107 | keyrecord_t *macro_buffer, | ||
106 | keyrecord_t **macro_pointer, | 108 | keyrecord_t **macro_pointer, |
107 | keyrecord_t *macro_end2, | 109 | keyrecord_t *macro_end2, |
108 | int8_t direction, | 110 | int8_t direction, |
109 | keyrecord_t *record) | 111 | keyrecord_t *record) |
110 | { | 112 | { |
113 | /* If we've just started recording, ignore all the key releases. */ | ||
114 | if (!record->event.pressed && *macro_pointer == macro_buffer) { | ||
115 | return; | ||
116 | } | ||
117 | |||
111 | if (*macro_pointer + direction != macro_end2) { | 118 | if (*macro_pointer + direction != macro_end2) { |
112 | **macro_pointer = *record; | 119 | **macro_pointer = *record; |
113 | *macro_pointer += direction; | 120 | *macro_pointer += direction; |
@@ -230,10 +237,10 @@ bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record) | |||
230 | /* Store the key in the macro buffer and process it normally. */ | 237 | /* Store the key in the macro buffer and process it normally. */ |
231 | switch (macro_id) { | 238 | switch (macro_id) { |
232 | case 1: | 239 | case 1: |
233 | dynamic_macro_record_key(¯o_pointer, r_macro_end, +1, record); | 240 | dynamic_macro_record_key(macro_buffer, ¯o_pointer, r_macro_end, +1, record); |
234 | break; | 241 | break; |
235 | case 2: | 242 | case 2: |
236 | dynamic_macro_record_key(¯o_pointer, macro_end, -1, record); | 243 | dynamic_macro_record_key(r_macro_buffer, ¯o_pointer, macro_end, -1, record); |
237 | break; | 244 | break; |
238 | } | 245 | } |
239 | return true; | 246 | return true; |