From 7fb30b9830feeb2b20d894e267b39dcafa628d4d Mon Sep 17 00:00:00 2001 From: Luke A Date: Fri, 12 Apr 2024 13:52:26 -0400 Subject: [PATCH] Macro Press Fix (#962) * Single line fix for macro press. This was a fix for hold-repeat that messed up the press macro option. * Set the input held duration on EVERY frame instead of just the first --- src/addons/input_macro.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/addons/input_macro.cpp b/src/addons/input_macro.cpp index 7b67fd210..b6fced924 100644 --- a/src/addons/input_macro.cpp +++ b/src/addons/input_macro.cpp @@ -163,7 +163,7 @@ void InputMacro::runCurrentMacro() { Macro& macro = inputMacroOptions->macroList[macroPosition]; // Stop Macro if released (ON PRESS & ON HOLD REPEAT) - if (inputMacroOptions->macroList[macroPosition].macroType != ON_TOGGLE && + if (inputMacroOptions->macroList[macroPosition].macroType == ON_HOLD_REPEAT && !isMacroTriggerHeld && macro.interruptible) { reset(); return; @@ -226,12 +226,15 @@ void InputMacro::runCurrentMacro() { reset(); // On repeat, reset but keep the button held } else { macroInputPosition = 0; // On Hold-Repeat or On Toggle = start macro again - macroStartTime = currentMicros; MacroInput& newMacroInput = macro.macroInputs[macroInputPosition]; uint32_t newMacroInputDuration = newMacroInput.duration + newMacroInput.waitDuration; macroInputHoldTime = newMacroInputDuration <= 0 ? INPUT_HOLD_US : newMacroInputDuration; } } + } else { + MacroInput& newMacroInput = macro.macroInputs[macroInputPosition]; + uint32_t newMacroInputDuration = newMacroInput.duration + newMacroInput.waitDuration; + macroInputHoldTime = newMacroInputDuration <= 0 ? INPUT_HOLD_US : newMacroInputDuration; } } }