Skip to content

Commit 157a166

Browse files
committed
esp32.cpp: make shouldReboot code non blocking.
1 parent 5549a1c commit 157a166

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

SmartEVSE-3/src/esp32.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3083,14 +3083,12 @@ void loop() {
30833083
#endif
30843084
_LOG_I("L1: %.1f A L2: %.1f A L3: %.1f A Isum: %.1f A\n", (float)MainsMeter.Irms[0]/10, (float)MainsMeter.Irms[1]/10, (float)MainsMeter.Irms[2]/10, (float)Isum/10);
30853085

3086-
#if AUTOMATED_TESTING
3087-
if (shouldReboot) {
3088-
#else
3089-
// a reboot is requested, but we kindly wait until EV is not charging
3086+
// a reboot is requested, but we kindly wait until EV is not charging
3087+
static uint8_t RebootDelay = 5;
30903088
if (shouldReboot && State != STATE_C) { //slaves in STATE_C continue charging when Master reboots
3091-
delay(5000); //give user some time to read any message on the webserver
3092-
#endif
3093-
ESP.restart();
3089+
if (RebootDelay-- == 0) { //give user some time to read any message on the webserver
3090+
ESP.restart(); //use non-blocking code so network_loop() keeps working.
3091+
}
30943092
}
30953093

30963094
// TODO move this to a once a minute loop?

0 commit comments

Comments
 (0)