OTA and Update.h

jchastine
Posts: 1
Joined: Sun Jul 12, 2020 10:27 pm

OTA and Update.h

Postby jchastine » Sun Jul 12, 2020 10:48 pm

Good morning/evening! I'm trying to use the Update class for OTA but am having difficulty. What I'd like to do is read the file size from a server (via sockets), read a .bin file in chunks of 4K from the network and write those chunks to the updater, then end the update process. The basic code structure is:

Update.begin(<filesize>);
while (<more bytes to read>) {
read into buffer;
amountWritten = Update.write (buffer, bytes read);
}
Update.end();

It looks like subsequent calls to Update.write() after the first call return a value of 0, but the first time returns the value 4096. I think I have a wrong mental model for how this works, but looking at this, it should:

https://github.com/espressif/arduino-es ... c/Update.h

Unfortunately, I can't use the web browser version...

Thanks for any insight you have.

Who is online

Users browsing this forum: sraposo and 23 guests