mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-05 07:07:38 +03:00
better isWakeupByPowerButton
This commit is contained in:
parent
bab513cc95
commit
482a4c3d46
@ -298,7 +298,12 @@ bool isWakeupAfterFlashing() {
|
||||
|
||||
bool isWakeupByPowerButton() {
|
||||
const auto wakeupCause = esp_sleep_get_wakeup_cause();
|
||||
return wakeupCause == ESP_SLEEP_WAKEUP_GPIO;
|
||||
const auto resetReason = esp_reset_reason();
|
||||
if (isUsbConnected()) {
|
||||
return wakeupCause == ESP_SLEEP_WAKEUP_GPIO;
|
||||
} else {
|
||||
return (wakeupCause == ESP_SLEEP_WAKEUP_UNDEFINED) && (resetReason == ESP_RST_POWERON);
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user