diff --git a/src/input/ButtonThread.cpp b/src/input/ButtonThread.cpp index 32882f7ae..1d26e0758 100644 --- a/src/input/ButtonThread.cpp +++ b/src/input/ButtonThread.cpp @@ -274,7 +274,12 @@ int32_t ButtonThread::runOnce() } } btnEvent = BUTTON_EVENT_NONE; - return 50; + + // only pull when the button is pressed, we get notified via IRQ on a new press + if (!userButton.isIdle() || waitingForLongPress) { + return 50; + } + return INT32_MAX; } /* diff --git a/src/main.cpp b/src/main.cpp index 635664eb7..38c8e8ca5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1002,6 +1002,7 @@ void setup() config.pullupSense = INPUT_PULLUP; config.intRoutine = []() { UserButtonThread->userButton.tick(); + UserButtonThread->setIntervalFromNow(0); runASAP = true; BaseType_t higherWake = 0; mainDelay.interruptFromISR(&higherWake); @@ -1022,6 +1023,7 @@ void setup() touchConfig.pullupSense = pullup_sense; touchConfig.intRoutine = []() { TouchButtonThread->userButton.tick(); + TouchButtonThread->setIntervalFromNow(0); runASAP = true; BaseType_t higherWake = 0; mainDelay.interruptFromISR(&higherWake); @@ -1041,6 +1043,7 @@ void setup() cancelConfig.pullupSense = pullup_sense; cancelConfig.intRoutine = []() { CancelButtonThread->userButton.tick(); + CancelButtonThread->setIntervalFromNow(0); runASAP = true; BaseType_t higherWake = 0; mainDelay.interruptFromISR(&higherWake); @@ -1061,6 +1064,7 @@ void setup() backConfig.pullupSense = pullup_sense; backConfig.intRoutine = []() { BackButtonThread->userButton.tick(); + BackButtonThread->setIntervalFromNow(0); runASAP = true; BaseType_t higherWake = 0; mainDelay.interruptFromISR(&higherWake); @@ -1095,6 +1099,7 @@ void setup() userConfig.pullupSense = pullup_sense; userConfig.intRoutine = []() { UserButtonThread->userButton.tick(); + UserButtonThread->setIntervalFromNow(0); runASAP = true; BaseType_t higherWake = 0; mainDelay.interruptFromISR(&higherWake); @@ -1112,6 +1117,7 @@ void setup() userConfigNoScreen.pullupSense = pullup_sense; userConfigNoScreen.intRoutine = []() { UserButtonThread->userButton.tick(); + UserButtonThread->setIntervalFromNow(0); runASAP = true; BaseType_t higherWake = 0; mainDelay.interruptFromISR(&higherWake);