mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-19 17:22:59 +00:00
make esp32 deepsleep button wakeup functional again (#2854)
* make deepsleep button wakeup functional again * Remove unused var * Cleanup comment * suppress screen wake on button * add resume screen * trunk fmt * added missing #ifdef --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -95,7 +95,29 @@ void initDeepSleep()
|
||||
{
|
||||
#ifdef ARCH_ESP32
|
||||
bootCount++;
|
||||
const char *reason;
|
||||
wakeCause = esp_sleep_get_wakeup_cause();
|
||||
|
||||
switch (wakeCause) {
|
||||
case ESP_SLEEP_WAKEUP_EXT0:
|
||||
reason = "ext0 RTC_IO";
|
||||
break;
|
||||
case ESP_SLEEP_WAKEUP_EXT1:
|
||||
reason = "ext1 RTC_CNTL";
|
||||
break;
|
||||
case ESP_SLEEP_WAKEUP_TIMER:
|
||||
reason = "timer";
|
||||
break;
|
||||
case ESP_SLEEP_WAKEUP_TOUCHPAD:
|
||||
reason = "touchpad";
|
||||
break;
|
||||
case ESP_SLEEP_WAKEUP_ULP:
|
||||
reason = "ULP program";
|
||||
break;
|
||||
default:
|
||||
reason = "reset";
|
||||
break;
|
||||
}
|
||||
/*
|
||||
Not using yet because we are using wake on all buttons being low
|
||||
|
||||
@@ -106,7 +128,6 @@ void initDeepSleep()
|
||||
|
||||
#ifdef DEBUG_PORT
|
||||
// If we booted because our timer ran out or the user pressed reset, send those as fake events
|
||||
const char *reason = "reset"; // our best guess
|
||||
RESET_REASON hwReason = rtc_get_reset_reason(0);
|
||||
|
||||
if (hwReason == RTCWDT_BROWN_OUT_RESET)
|
||||
@@ -118,9 +139,6 @@ void initDeepSleep()
|
||||
if (hwReason == TG1WDT_SYS_RESET)
|
||||
reason = "intWatchdog";
|
||||
|
||||
if (wakeCause == ESP_SLEEP_WAKEUP_TIMER)
|
||||
reason = "timeout";
|
||||
|
||||
LOG_INFO("Booted, wake cause %d (boot count %d), reset_reason=%s\n", wakeCause, bootCount, reason);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user