Skip to content

Commit

Permalink
main.cpp: turn the relay a bit earlier of when rebooting
Browse files Browse the repository at this point in the history
Otherwise, a fast flicker happens, we want a proper shutdown (visual - 2 sec.) and a repower.
  • Loading branch information
ThomasDevoogdt committed Oct 11, 2020
1 parent 93f2574 commit 971cbb9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ void setupWebServer()
server->client().flush();
resetDnsServer();
resetWebServer();
digitalWrite(pins_arr, LOW); // prevent to fast flicker by early power-off
delay(2000);
ESP.restart();
});

Expand Down Expand Up @@ -738,6 +740,9 @@ bool setupOTA()
JsonObject& rootObject = jsonBuffer.createObject();
rootObject.set("ota", "success");
otaLogStorage.writeJson(rootObject);

digitalWrite(pins_arr, LOW); // prevent to fast flicker by early power-off
delay(2000);
});
ArduinoOTA.onError([](ota_error_t error) {
auto &logger = p_var->logger;
Expand Down

0 comments on commit 971cbb9

Please sign in to comment.