Skip to content

Commit

Permalink
Added Wait time to sending each Keys for Dynamic Macros function (#16800
Browse files Browse the repository at this point in the history
)

Co-authored-by: Joel Challis <git@zvecr.com>
  • Loading branch information
FREEWING-JP and zvecr authored Jul 2, 2022
1 parent 0856b36 commit 9dc7b9d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/feature_dynamic_macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ There are a number of options added that should allow some additional degree of
|`DYNAMIC_MACRO_SIZE` |128 |Sets the amount of memory that Dynamic Macros can use. This is a limited resource, dependent on the controller. |
|`DYNAMIC_MACRO_USER_CALL` |*Not defined* |Defining this falls back to using the user `keymap.c` file to trigger the macro behavior. |
|`DYNAMIC_MACRO_NO_NESTING` |*Not Defined* |Defining this disables the ability to call a macro from another macro (nested macros). |
|`DYNAMIC_MACRO_DELAY` |*Not Defined* |Sets the waiting time (ms unit) when sending each key. |


If the LEDs start blinking during the recording with each keypress, it means there is no more space for the macro in the macro buffer. To fit the macro in, either make the other macro shorter (they share the same buffer) or increase the buffer size by adding the `DYNAMIC_MACRO_SIZE` define in your `config.h` (default value: 128; please read the comments for it in the header).
Expand Down
1 change: 1 addition & 0 deletions docs/ja/feature_dynamic_macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ QMK はその場で作られた一時的なマクロをサポートします。
| `DYNAMIC_MACRO_SIZE` | 128 | 動的マクロが使用できるメモリ量を設定します。これは限られたリソースであり、コントローラに依存します。 |
| `DYNAMIC_MACRO_USER_CALL` | *定義なし* | これを定義すると、ユーザの `keymap.c` ファイルを使ってマクロが起動されます。 |
| `DYNAMIC_MACRO_NO_NESTING` | *定義なし* | これを定義すると、別のマクロからマクロを呼び出す(入れ子になったマクロ)機能を無効にします。 |
| `DYNAMIC_MACRO_DELAY` | *定義なし* | 各キーを送信する時の待ち時間(ms単位)を設定します。 |


記録中にキーを押すたびに LED が点滅し始めた場合は、マクロバッファにマクロを入れるスペースがもう無いことを意味します。マクロを入れるには、他のマクロ(それらは同じバッファを共有します)を短くするか、`config.h``DYNAMIC_MACRO_SIZE` 定義を追加することでバッファを増やします(デフォルト値: 128; ヘッダ内のコメントを読んでください)。
Expand Down
3 changes: 3 additions & 0 deletions quantum/process_keycode/process_dynamic_macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ void dynamic_macro_play(keyrecord_t *macro_buffer, keyrecord_t *macro_end, int8_
while (macro_buffer != macro_end) {
process_record(macro_buffer);
macro_buffer += direction;
#ifdef DYNAMIC_MACRO_DELAY
wait_ms(DYNAMIC_MACRO_DELAY);
#endif
}

clear_keyboard();
Expand Down

0 comments on commit 9dc7b9d

Please sign in to comment.