extract Version from define
Some checks failed
Test compiling project / test (push) Failing after 1m33s
Some checks failed
Test compiling project / test (push) Failing after 1m33s
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include <HTTPClient.h>
|
||||
|
||||
#include <vector>
|
||||
#include <ArduinoLog.h>
|
||||
#include <HTTPUpdate.h>
|
||||
|
||||
|
||||
OTA::OTA(String server_url, String currentVersion, String currentDeviceConfiguration) {
|
||||
@@ -71,6 +73,36 @@ Firmware OTA::createErrorResponse(const String& errorMsg) {
|
||||
};
|
||||
}
|
||||
|
||||
void OTA::run_ota_update(String url) {
|
||||
Log.verbose("Starting OTA upgrade");
|
||||
HTTPUpdate httpUpdate;
|
||||
httpUpdate.onStart(update_started);
|
||||
httpUpdate.onEnd(update_finished);
|
||||
httpUpdate.onProgress(update_progress);
|
||||
httpUpdate.onError(update_error);
|
||||
Serial.println("RUNNING OTA");
|
||||
|
||||
WiFiClientSecure client;
|
||||
client.setInsecure();
|
||||
|
||||
t_httpUpdate_return ret = httpUpdate.update(client, "https://iot.tobiasmaier.me/firmware/waterlevel/INA233/1_1_1.bin");
|
||||
// t_httpUpdate_return ret = httpUpdate.update(client, "https://iot.tobiasmaier.me", 443, "/firmware/waterlevel/INA233/1_0_1.bin");
|
||||
|
||||
switch (ret) {
|
||||
case HTTP_UPDATE_FAILED:
|
||||
Serial.printf("HTTP_UPDATE_FAILED Error (%d): %s\n", httpUpdate.getLastError(), httpUpdate.getLastErrorString().c_str());
|
||||
break;
|
||||
|
||||
case HTTP_UPDATE_NO_UPDATES:
|
||||
Serial.println("HTTP_UPDATE_NO_UPDATES");
|
||||
break;
|
||||
|
||||
case HTTP_UPDATE_OK:
|
||||
Serial.println("HTTP_UPDATE_OK");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user