Add a debounce time parameter and use it in the runOnce method to debounce the key.

This commit is contained in:
whywilson
2025-06-17 06:05:45 +08:00
committed by Jonathan Bennett
parent 7a38368494
commit 8ba98ae873
3 changed files with 9 additions and 8 deletions

View File

@@ -21,8 +21,9 @@ bool UpDownInterruptImpl1::init()
input_broker_event eventUp = INPUT_BROKER_UP;
input_broker_event eventPressed = INPUT_BROKER_SELECT;
unsigned long debounceMs = moduleConfig.canned_message.rotary1_enabled ? 100 : 300;
UpDownInterruptBase::init(pinDown, pinUp, pinPress, eventDown, eventUp, eventPressed, UpDownInterruptImpl1::handleIntDown,
UpDownInterruptImpl1::handleIntUp, UpDownInterruptImpl1::handleIntPressed);
UpDownInterruptImpl1::handleIntUp, UpDownInterruptImpl1::handleIntPressed, debounceMs);
inputBroker->registerSource(this);
return true;
}