-->
Page 1 of 1

Sketch Data Uploading Over the air (OTA)

PostPosted: Sat Apr 01, 2017 8:05 am
by Sn4k3r
I use a good library called ESP8266HTTPUpdateServer. It's very useful for uploading sketch but I have to upload sketch data too. Do you have any experience with it? Any ideas?
I need to have an opportunity for creating .bin file which will containe sketch data and then upload this file using web browser.

Re: Sketch Data Uploading Over the air (OTA)

PostPosted: Sat Apr 01, 2017 9:17 am
by rudy

Re: Sketch Data Uploading Over the air (OTA)

PostPosted: Sun Apr 02, 2017 2:57 pm
by Sn4k3r
Thanks very much.
It's a pity but it does not work. It tries to update sketch but it failed "magic byte" check.
But I understood the idea.
I'll try to fix the code.

Re: Sketch Data Uploading Over the air (OTA)

PostPosted: Sun Apr 02, 2017 3:24 pm
by Sn4k3r
I fixed it!
Code should be:

action='?cmd=0'
action='?cmd=100'

and

_command = _server->arg("cmd").toInt();

should be before

if(!Update.begin(maxSketchSpace, _command)){//start with max available size

Code: Select allconst char* ESP8266HTTPUpdateServer::_serverIndex =
R"(<html><body><form method='POST' action='?cmd=0' enctype='multipart/form-data'>
        <input type='hidden' name='cmd' value='0'>
                   <input type='file' name='update'>
                  <input type='submit' value='Update Flash'>
               </form>
          <form method='POST' action='?cmd=100' enctype='multipart/form-data'>
        <input type='hidden' name='cmd' value='100'>
                  <input type='file' name='update'>
                  <input type='submit' value='Update Spiffs'>
                </form>
          </body></html>)";



Code: Select all_command = _server->arg("cmd").toInt();
      
      if(!Update.begin(maxSketchSpace, _command)){//start with max available size
          if (_serial_output) Update.printError(Serial);
        }