mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Code cleanup
This commit is contained in:
parent
ae060eb2b4
commit
a0fd12879c
@ -145,34 +145,16 @@ void otaHttpUpdate(const char * espOtaUrl)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
|
|
||||||
// ESPhttpUpdate.onStart(update_started);
|
// ESPhttpUpdate.onStart(update_started);
|
||||||
// ESPhttpUpdate.onEnd(update_finished);
|
// ESPhttpUpdate.onEnd(update_finished);
|
||||||
// ESPhttpUpdate.onProgress(update_progress);
|
// ESPhttpUpdate.onProgress(update_progress);
|
||||||
// ESPhttpUpdate.onError(update_error);
|
// ESPhttpUpdate.onError(update_error);
|
||||||
|
ESP8266HTTPUpdate httpUpdate;
|
||||||
t_httpUpdate_return returnCode = ESPhttpUpdate.update(otaClient, espOtaUrl);
|
|
||||||
|
|
||||||
switch(returnCode) {
|
|
||||||
case HTTP_UPDATE_FAILED:
|
|
||||||
Log.error(TAG_FWUP, "FWUP: HTTP_UPDATE_FAILED error %d %s", ESPhttpUpdate.getLastError(),
|
|
||||||
ESPhttpUpdate.getLastErrorString().c_str());
|
|
||||||
// nextionSetAttr("p[0].b[1].txt", "\"HTTP Update\\rFAILED\"");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HTTP_UPDATE_NO_UPDATES:
|
|
||||||
Log.notice(TAG_FWUP, F("HTTP_UPDATE_NO_UPDATES"));
|
|
||||||
// nextionSetAttr("p[0].b[1].txt", "\"HTTP Update\\rNo update\"");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HTTP_UPDATE_OK:
|
|
||||||
Log.notice(TAG_FWUP, F("HTTP_UPDATE_OK"));
|
|
||||||
// nextionSetAttr("p[0].b[1].txt", "\"HTTP Update\\rcomplete!\\r\\rRestarting.\"");
|
|
||||||
dispatchReboot(true);
|
|
||||||
delay(5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
HTTPUpdate httpUpdate;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
httpUpdate.rebootOnUpdate(false);
|
||||||
t_httpUpdate_return returnCode = httpUpdate.update(otaClient, espOtaUrl);
|
t_httpUpdate_return returnCode = httpUpdate.update(otaClient, espOtaUrl);
|
||||||
|
|
||||||
switch(returnCode) {
|
switch(returnCode) {
|
||||||
@ -194,8 +176,6 @@ void otaHttpUpdate(const char * espOtaUrl)
|
|||||||
delay(5000);
|
delay(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HASP_USE_MDNS > 0
|
#if HASP_USE_MDNS > 0
|
||||||
mdnsStart();
|
mdnsStart();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user