Added enterDeepSleep() for NRF52 and shutdownPeripherals() for ESP32

This commit is contained in:
Kevin Le committed 2026-09-19 18:37:03 +07:00
1 parent 166fd6a941
commit d9c42964eb
41 files changed
+120 -115

No files matched your search

+9 -5
View File
@@ -45,11 +45,7 @@ bool ESP32Board::startOTAUpdate(const char* id, char reply[]) {
}
#endif
void ESP32Board::powerOff() {
enterDeepSleep(0); // Do not wakeup
}
void ESP32Board::enterDeepSleep(uint32_t secs) {
void ESP32Board::shutdownPeripherals() {
// Power off the display if any
#ifdef DISPLAY_CLASS
display.turnOff();
@@ -74,6 +70,14 @@ void ESP32Board::enterDeepSleep(uint32_t secs) {
// Flush serial buffers
Serial.flush();
delay(100);
}
void ESP32Board::powerOff() {
enterDeepSleep(0); // Do not wakeup
}
void ESP32Board::enterDeepSleep(uint32_t secs) {
shutdownPeripherals();
// Clear stale wakeup sources to avoid ghost wakeup
// This is required when Power Management and automatic lightsleep are enabled