- Notifications
You must be signed in to change notification settings - Fork148
Description
ElegantOTA shows the update progress in the webpage. I wanted it to also show on the device GLCD screen. So I used this callback function to get info
void onOTAProgress(size_t current, size_t final) { // Log every 1 second if (millis() - ota_progress_millis > 1000) { ota_progress_millis = millis(); Serial.printf("OTA Progress Current: %u bytes, Final: %u bytes\n", current, final); } }
When I use ElegantOTA demo.ino, this is what is seen on the serial monitor
OTA update started! Update Received: firmware.bin OTA Progress Current: 1436 bytes, Final: 0 bytes OTA Progress Current: 172320 bytes, Final: 170884 bytes OTA Progress Current: 348948 bytes, Final: 347512 bytes OTA Progress Current: 528448 bytes, Final: 527012 bytes OTA Progress Current: 709384 bytes, Final: 707948 bytes OTA Progress Current: 868780 bytes, Final: 867344 bytes OTA update finished successfully!
The value of variable final being zero throws error restarting the device and the current value being greater than final value does not give real time firmware update progress.
If I used the AsyncDemo.ino the serial monitor shows
OTA update started! Update Received: firmware.bin OTA Progress Current: 1436 bytes, Final: 868780 bytes OTA Progress Current: 172320 bytes, Final: 868780 bytes OTA Progress Current: 348948 bytes, Final: 868780 bytes OTA Progress Current: 528448 bytes, Final: 868780 bytes OTA Progress Current: 709384 bytes, Final: 868780 bytes OTA Progress Current: 867344 bytes, Final: 868780 bytes OTA update finished successfully!
Surprisingly the update progress is shown properly in the webpage for both the example files