mirror of
https://github.com/btclock/btclock_v3.git
synced 2024-11-19 04:30:02 +01:00
Add OTA error handling
This commit is contained in:
parent
3456aceec2
commit
f92db527e1
@ -9,7 +9,7 @@ void setupOTA()
|
||||
ArduinoOTA.onStart(onOTAStart);
|
||||
|
||||
ArduinoOTA.onProgress(onOTAProgress);
|
||||
|
||||
ArduinoOTA.onError(onOTAError);
|
||||
ArduinoOTA.onEnd(onOTAComplete);
|
||||
|
||||
ArduinoOTA.setHostname(getMyHostname().c_str());
|
||||
@ -80,6 +80,14 @@ void downloadUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
void onOTAError(ota_error_t error) {
|
||||
Serial.println("\nOTA update error, restarting");
|
||||
Wire.end();
|
||||
SPI.end();
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
void onOTAComplete()
|
||||
{
|
||||
Serial.println("\nOTA update finished");
|
||||
|
@ -8,4 +8,5 @@ void onOTAStart();
|
||||
void handleOTATask(void *parameter);
|
||||
void onOTAProgress(unsigned int progress, unsigned int total);
|
||||
void downloadUpdate();
|
||||
void onOTAError(ota_error_t error);
|
||||
void onOTAComplete();
|
Loading…
Reference in New Issue
Block a user