Skip to content

Commit

Permalink
Macro Press Fix (OpenStickCommunity#962)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
arntsonl authored Apr 12, 2024
1 parent 9efe004 commit 7fb30b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/addons/input_macro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 7fb30b9

Please sign in to comment.