I've established FW OTA update over ESP32 AP. I'm sending image in a single request with segmented packets(This is way faster than sending multiple requests). However, this forces me to continuously receive data in handler with 'http_req_recv'. This prevents me to take care of other http requests during ota update. My problem is I also want to report number of bytes esp32 received continuously such that I can update my progress bar on web page. I've tried to send periodic get requests but as I said, esp idf http server is busy with receiving ota image, it responds all those request right after ota image is completely received.
Another alternative is keeping track of number of bytes sent(client side implementation). I'm using fetch api and if possible this also works for me but I couldn't find reliable source for this.
I'm using IDF 5.0.1
HTTP Server - Progress bar on front end
Re: HTTP Server - Progress bar on front end
The OTA i created for myself also uses a web page with a progress bar.
What i did was have the webpage itself show the progress by what it has sent so far, and not have it updated by the ESP32.
What i did was have the webpage itself show the progress by what it has sent so far, and not have it updated by the ESP32.
Re: HTTP Server - Progress bar on front end
Unfortunately the ESP32 httpd is not designed for multiple concurrent requests. I was surprised by how much difficulty I had trying to find an embedded C HTTP server that is!
I ultimately gave up and now simply start *two* HTTP servers on the ESP32 for this purpose. When a firmware upload is sent to the 'main' server (eg. "http://192.168.0.1/ota_upload"), it redirects the request to the 'upload' server (eg. "http://192.168.0.1:8080/ota_upload"). While this is an ugly workaround, it's quick and easy, and completely invisible to the average user so it's a neat solution from that perspective.
There's also this: https://github.com/espressif/esp-idf/pull/11190. It wasn't compatible with this use-case when I last looked into it but I can't recall why or how.
I ultimately gave up and now simply start *two* HTTP servers on the ESP32 for this purpose. When a firmware upload is sent to the 'main' server (eg. "http://192.168.0.1/ota_upload"), it redirects the request to the 'upload' server (eg. "http://192.168.0.1:8080/ota_upload"). While this is an ugly workaround, it's quick and easy, and completely invisible to the average user so it's a neat solution from that perspective.
There's also this: https://github.com/espressif/esp-idf/pull/11190. It wasn't compatible with this use-case when I last looked into it but I can't recall why or how.
-
- Posts: 6
- Joined: Wed Jan 25, 2023 6:19 am
Re: HTTP Server - Progress bar on front end
How do you keep track of number of bytes sent? If I can get it, I can divide it to total file size, get ratio and update my progress bar accordingly.
Who is online
Users browsing this forum: No registered users and 124 guests