Fix button interrupt after light sleep (#3587)

* Make ButtonThread instance extern
Previously was a static local instance in setup(). Now declared in ButtonThread.cpp, accessible via extern declaration in ButtonThread.

* Extract attachInterrupt() calls to public method; create matching method for detachInterrupt()

* Change suspension of button interrupts for light-sleep

* Fix declaration for ARCH_PORTDUINO

* Remove LOG_DEBUG used during testing

* Don't assume device has a button..

* Guard entire constructor code

* Don't use BUTTON_PIN with ARCH_PORTDUINO

---------

Co-authored-by: Manuel <71137295+mverch67@users.noreply.github.com>
This commit is contained in:
todd-herbert
2024-04-12 00:02:50 +12:00
committed by GitHub
parent 3bee6ce9c3
commit 8e29efcb50
4 changed files with 80 additions and 30 deletions

View File

@@ -188,9 +188,6 @@ uint32_t timeLastPowered = 0;
static Periodic *ledPeriodic;
static OSThread *powerFSMthread;
#if HAS_BUTTON || defined(ARCH_PORTDUINO)
static OSThread *buttonThread;
#endif
static OSThread *accelerometerThread;
static OSThread *ambientLightingThread;
SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0);