Skip to content

Commit 836012b

Browse files
committed
fix(esp32): Fix wake ups on error
If setup() fails at any stage, we must schedule the RTC wake up before returning. Otherwise the device won't work again without a manual reset.
1 parent b910968 commit 836012b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

esp32/m5stack_timer_camera_x.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,20 @@ void setup() {
4848

4949
if (!configureCamera()) {
5050
Serial.println("Camera configuration failed, halting");
51+
TimerCAM.Power.timerSleep(SLEEP_INTERVAL_SECS);
5152
return;
5253
}
5354

5455
WiFiClient wifi = connectToWiFi();
5556
if (WiFi.status() != WL_CONNECTED) {
5657
Serial.println("WiFi connection failed, halting");
58+
TimerCAM.Power.timerSleep(SLEEP_INTERVAL_SECS);
5759
return;
5860
}
5961

6062
if (!sendImage(wifi, batLevel, batVoltage)) {
6163
Serial.println("Image upload failed, halting");
64+
TimerCAM.Power.timerSleep(SLEEP_INTERVAL_SECS);
6265
return;
6366
}
6467

0 commit comments

Comments
 (0)