Skip to content

Commit 971cbb9

Browse files
main.cpp: turn the relay a bit earlier of when rebooting
Otherwise, a fast flicker happens, we want a proper shutdown (visual - 2 sec.) and a repower.
1 parent 93f2574 commit 971cbb9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ void setupWebServer()
359359
server->client().flush();
360360
resetDnsServer();
361361
resetWebServer();
362+
digitalWrite(pins_arr, LOW); // prevent to fast flicker by early power-off
363+
delay(2000);
362364
ESP.restart();
363365
});
364366

@@ -738,6 +740,9 @@ bool setupOTA()
738740
JsonObject& rootObject = jsonBuffer.createObject();
739741
rootObject.set("ota", "success");
740742
otaLogStorage.writeJson(rootObject);
743+
744+
digitalWrite(pins_arr, LOW); // prevent to fast flicker by early power-off
745+
delay(2000);
741746
});
742747
ArduinoOTA.onError([](ota_error_t error) {
743748
auto &logger = p_var->logger;

0 commit comments

Comments
 (0)