Firmware flow
How a short gamepad button press is tracked
Two separate press and release helpers.
When the press helper is called
When the release helper is called
The press helper sends one button press and records its start time when the button is not already held. A separately called release helper releases it once the configured hold time has elapsed.
The caller decides when each helper runs. This overview does not imply a blocking wait or prove the complete input mapping.
Read the implementation
press/release functions · selected source lines 94–107. Source inspection is not a hardware test.
void tapButtonIfNeeded(int btn, bool &pressedFlag, uint32_t &startedFlag) {
if (!pressedFlag) {
bleGamepad.press(btn);
pressedFlag = true;
startedFlag = millis();
}
}
void releaseIfElapsed(int btn, bool &pressedFlag, uint32_t &startedFlag) {
if (pressedFlag && (millis() - startedFlag >= (uint32_t)PRESS_MS)) {
bleGamepad.release(btn);
pressedFlag = false;
}
}Open the exact source-level diagramTechnical notes
Encoder input
setupEncoder() handles physical input for translation into game-controller actions.
Button activation
tapButtonIfNeeded() handles button activation, with timing separate from the duration of the physical input.
Timed release
releaseIfElapsed() handles timed release to complete a button tap over the BLE interface.