diff --git a/build/esp12e/firmware.bin b/build/esp12e/firmware.bin index bc064c4..07c69b7 100644 Binary files a/build/esp12e/firmware.bin and b/build/esp12e/firmware.bin differ diff --git a/include/version.h b/include/version.h index 83aced3..a4d01ec 100644 --- a/include/version.h +++ b/include/version.h @@ -1,9 +1,9 @@ #ifndef BUILD_NUMBER - #define BUILD_NUMBER 47 + #define BUILD_NUMBER 48 #endif #ifndef VERSION - #define VERSION "v0.1.47 - 2023-11-28 18:50:16.207931" + #define VERSION "v0.1.48 - 2023-11-28 19:08:40.189843" #endif #ifndef VERSION_SHORT - #define VERSION_SHORT "v0.1.47" + #define VERSION_SHORT "v0.1.48" #endif diff --git a/src/myOTA.cpp b/src/myOTA.cpp index 6f5c0c1..e3233c1 100644 --- a/src/myOTA.cpp +++ b/src/myOTA.cpp @@ -34,7 +34,7 @@ void setupOTALocal() { showInsideInfo("LU:Restarting.."); }); ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) { - Serial.printf("Progress:%u%%\r", (progress / (total / 100))); + Serial.printf("LU: Progress:%u%%\r", (progress / (total / 100))); { char infoBuffer[LCD_COLUMNS]; sprintf(infoBuffer, "LU:P:%u%%", (progress / (total / 100))); @@ -73,22 +73,28 @@ void handleOTALocal() { void handleOTARemote() { WiFiClient client; - Serial.println("Updating from remote..."); - showInsideInfo("RU:Start"); - t_httpUpdate_return ret = ESPhttpUpdate.update(client, "http://patient.bendtherules.in/build/esp12e/firmware.bin", VERSION_SHORT); - switch(ret) { - case HTTP_UPDATE_FAILED: - Serial.print("update:Update failed. Reason - "); - Serial.println(ESPhttpUpdate.getLastErrorString()); - showInsideInfo("RU:Failed"); - break; - case HTTP_UPDATE_NO_UPDATES: - Serial.println("update:Update no Update."); - showInsideInfo("RU:Skip"); - break; - case HTTP_UPDATE_OK: - Serial.println("update:Update ok."); // may not be called since we reboot the ESP - showInsideInfo("RU:Done"); - break; - } + ESPhttpUpdate.setLedPin(LED_BUILTIN, LOW); + ESPhttpUpdate.onStart([]() { + Serial.println("RU: Started"); + showInsideInfo("RU:Started"); + }); + ESPhttpUpdate.onEnd([]() { + Serial.println("RU: Finished. Restarting.."); + showInsideInfo("RU:Restarting.."); + }); + ESPhttpUpdate.onProgress([](unsigned int progress, unsigned int total) { + Serial.printf("RU: Progress:%u%%\r", (progress / (total / 100))); + { + char infoBuffer[LCD_COLUMNS]; + sprintf(infoBuffer, "RU:P:%u%%", (progress / (total / 100))); + showInsideInfo(infoBuffer); + } + }); + ESPhttpUpdate.onError([](int err) { + Serial.printf("RU: Failed with code %d\n", err); + Serial.println(ESPhttpUpdate.getLastErrorString()); + showInsideInfo("RU:Failed"); + }); + + t_httpUpdate_return ret = ESPhttpUpdate.update(client, "http://patient.bendtherules.in/build/esp12e/firmware.bin"); } diff --git a/versioning b/versioning index 801f180..31ff414 100644 --- a/versioning +++ b/versioning @@ -1 +1 @@ -47 \ No newline at end of file +48 \ No newline at end of file