const__pageData=JSON.parse('{"title":"Dynamic Macros: Record and Replay Macros in Runtime","description":"","frontmatter":{},"headers":[],"relativePath":"features/dynamic_macros.md","filePath":"features/dynamic_macros.md"}');
const_hoisted_1=/* @__PURE__ */createStaticVNode('<h1id="dynamic-macros-record-and-replay-macros-in-runtime"tabindex="-1">DynamicMacros:RecordandReplayMacrosinRuntime<aclass="header-anchor"href="#dynamic-macros-record-and-replay-macros-in-runtime"aria-label="Permalink to "Dynamic Macros: Record and Replay Macros in Runtime""></a></h1><p>QMKsupportstemporarymacroscreatedonthefly.WecalltheseDynamicMacros.Theyaredefinedbytheuserfromthekeyboardandarelostwhenthekeyboardisunpluggedorotherwiserebooted.</p><p>Youcanstoreoneortwomacrosandtheymayhaveacombinedtotalof128keypresses.YoucanincreasethissizeatthecostofRAM.</p><p>Toenablethem,firstinclude<code>DYNAMIC_MACRO_ENABLE=yes</code>inyour<code>rules.mk</code>.Then,addthefollowingkeystoyourkeymap:</p><table><thead><tr><th>Key</th><th>Alias</th><th>Description</th></tr></thead><tbody><tr><td><code>QK_DYNAMIC_MACRO_RECORD_START_1</code></td><td><code>DM_REC1</code></td><td>StartrecordingMacro1</td></tr><tr><td><code>QK_DYNAMIC_MACRO_RECORD_START_2</code></td><td><code>DM_REC2</code></td><td>StartrecordingMacro2</td></tr><tr><td><code>QK_DYNAMIC_MACRO_PLAY_1</code></td><td><code>DM_PLY1</code></td><td>ReplayMacro1</td></tr><tr><td><code>QK_DYNAMIC_MACRO_PLAY_2</code></td><td><code>DM_PLY2</code></td><td>ReplayMacro2</td></tr><tr><td><code>QK_DYNAMIC_MACRO_RECORD_STOP</code></td><td><code>DM_RSTP</code></td><td>Finishthemacrothatiscurrentlybeingrecorded.</td></tr></tbody></table><p>Thatshouldbeeverythingnecessary.</p><p>Tostartrecordingthemacro,presseither<code>DM_REC1</code>or<code>DM_REC2</code>.</p><p>Tofinishtherecording,pressthe<code>DM_RSTP</code>layerbutton.Youcanalsopress<code>DM_REC1</code>or<code>DM_REC2</code>againtostoptherecording.</p><p>Toreplaythemacro,presseither<code>DM_PLY1</code>or<code>DM_PLY2</code>.</p><p>Itispossibletoreplayamacroaspartofamacro.It'soktoreplaymacro2whilerecordingmacro1andviceversabutnevercreaterecursivemacrosi.e.macro1thatreplaysmacro1.Ifyoudosoandthekeyboardwillgetunresponsive,unplugthekeyboardandplugitagain.Youcandisablethiscompletelybydefining<code>DYNAMIC_MACRO_NO_NESTING</code>inyour<code>config.h</code>file.</p><divclass="tipcustom-block"><pclass="custom-block-title">TIP</p><p>Forthedetailsabouttheinternalsofthedynamicmacros,pleasereadthecommentsinthe<code>process_dynamic_macro.h</code>and<code>process_dynamic_macro.c</code>files.</p></div><h2id="customization"tabindex="-1">Customization<aclass="header-anchor"href="#customization"aria-label="Permalinkto"Customization""></a></h2><p>Thereareanumberofoptionsaddedthatshouldallowsomeadditionaldegreeofcustomization</p><table><thead><tr><th>Define</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><code>DYNAMIC_MACRO_SIZE</code></td><td>128</td><td>SetstheamountofmemorythatDynamicMacroscanuse.Thisisalimitedresource,dependentonthecontroller.</td></tr><tr><td><code>DYNAMIC_MACRO_USER_CALL</code></td><td><em>Notdefined</em></td><td>Definingthisfallsbacktousingtheuser<code>keymap.c</code>filetotriggerthemacrobehavior.</td></tr><tr><td><code>DYNAMIC_MACRO_NO_NESTING</code></td><td><em>NotDefined</em></td><td>Definingthisdisablestheabilitytocallamacrofromanothermacro(nestedmacros).</td></tr><tr><td><code>DYNAMIC_MACRO_DELAY</code></td><td><em>NotDefined</em></td><td>Setsthewaitingtime(msunit)whensendingeachkey.</td></tr></tbody></table><p>IftheLEDsstartblinkingduringtherecordingwitheachkeypress,itmeansthereisnomorespaceforthemacrointhemacrobuffer.Tofitthemacroin,eithermaketheothermacroshorter(theysharethesamebuffer)orincreasethebuffersizebyaddingthe<code>DYNAMIC_MACRO_SIZE</code>defineinyour<code>config.h</code>(defaultvalue:128;pleasereadthecommentsforitintheheader).</p><h3id="dy