mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 13:16:45 +00:00
Code cleanup
This commit is contained in:
parent
0b2dd01c5e
commit
c10d3f3ede
@ -2,10 +2,10 @@
|
|||||||
For full license information read the LICENSE file in the project folder */
|
For full license information read the LICENSE file in the project folder */
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <ArduinoOTA.h>
|
#include <ArduinoOTA.h>
|
||||||
#include "ArduinoJson.h"
|
#include "ArduinoJson.h"
|
||||||
#include "ArduinoLog.h"
|
|
||||||
|
|
||||||
#include "hasp_conf.h"
|
#include "hasp_conf.h"
|
||||||
|
|
||||||
@ -98,7 +98,6 @@ void otaSetup(void)
|
|||||||
Log.error(TAG_OTA, F("%s failed (%s)"), buffer, error);
|
Log.error(TAG_OTA, F("%s failed (%s)"), buffer, error);
|
||||||
haspProgressMsg(F("ESP OTA FAILED"));
|
haspProgressMsg(F("ESP OTA FAILED"));
|
||||||
// delay(5000);
|
// delay(5000);
|
||||||
// haspSendCmd("page " + String(nextionActivePage));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
#if HASP_USE_MQTT > 0
|
#if HASP_USE_MQTT > 0
|
||||||
@ -154,30 +153,27 @@ void otaHttpUpdate(const char * espOtaUrl)
|
|||||||
HTTPUpdate httpUpdate;
|
HTTPUpdate httpUpdate;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
httpUpdate.rebootOnUpdate(false);
|
httpUpdate.rebootOnUpdate(false); // We do that ourselves
|
||||||
t_httpUpdate_return returnCode = httpUpdate.update(otaClient, espOtaUrl);
|
t_httpUpdate_return returnCode = httpUpdate.update(otaClient, espOtaUrl);
|
||||||
|
|
||||||
switch(returnCode) {
|
switch(returnCode) {
|
||||||
case HTTP_UPDATE_FAILED:
|
case HTTP_UPDATE_FAILED:
|
||||||
Log.error(TAG_FWUP, F("HTTP_UPDATE_FAILED error %i %s"), httpUpdate.getLastError(),
|
Log.error(TAG_FWUP, F("HTTP_UPDATE_FAILED error %i %s"), httpUpdate.getLastError(),
|
||||||
httpUpdate.getLastErrorString().c_str());
|
httpUpdate.getLastErrorString().c_str());
|
||||||
// nextionSetAttr("p[0].b[1].txt", "\"HTTP Update\\rFAILED\"");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HTTP_UPDATE_NO_UPDATES:
|
case HTTP_UPDATE_NO_UPDATES:
|
||||||
Log.notice(TAG_FWUP, F("HTTP_UPDATE_NO_UPDATES"));
|
Log.notice(TAG_FWUP, F("HTTP_UPDATE_NO_UPDATES"));
|
||||||
// nextionSetAttr("p[0].b[1].txt", "\"HTTP Update\\rNo update\"");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HTTP_UPDATE_OK:
|
case HTTP_UPDATE_OK:
|
||||||
Log.notice(TAG_FWUP, F("HTTP_UPDATE_OK"));
|
Log.notice(TAG_FWUP, F("HTTP_UPDATE_OK"));
|
||||||
// nextionSetAttr("p[0].b[1].txt", "\"HTTP Update\\rcomplete!\\r\\rRestarting.\"");
|
|
||||||
dispatch_reboot(true);
|
dispatch_reboot(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HASP_USE_MDNS > 0
|
#if HASP_USE_MDNS > 0
|
||||||
mdnsStart();
|
mdnsStart();
|
||||||
#endif
|
#endif // HASP_USE_MDNS
|
||||||
// nextionSendCmd("page " + String(nextionActivePage));
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif // ARDUINO_ARCH_ESP8266 || ARDUINO_ARCH_ESP32
|
Loading…
x
Reference in New Issue
Block a user