ESP32 WebUpdate?

perigalacticon
Posts: 15
Joined: Thu Dec 07, 2017 3:59 am

ESP32 WebUpdate?

Postby perigalacticon » Tue May 08, 2018 3:21 am

I am looking for an example sketch similar to WebUpdater.ino sketch for the ESP8266 that lets you upload a new sketch to a hosted webpage from a bin file on your computer. I haven't found it yet, does this sketch exist somewhere for the ESP32?

CalinB
Posts: 15
Joined: Tue May 08, 2018 4:20 pm

Re: ESP32 WebUpdate?

Postby CalinB » Tue May 08, 2018 4:29 pm

I saw an example some time ago for esp32 webupdate...
HERE i have a class implemented for this.
Take a look.
Will take 5 minutes to adapt the code to your needs.

1163167506
Posts: 30
Joined: Mon Jun 11, 2018 5:52 am

Re: ESP32 WebUpdate?

Postby 1163167506 » Wed Jun 13, 2018 3:09 am

I once modified it by looking at Arduino esp32's own OTA upgrade program to WebUpdate, you need to know the way HTTP uploads files, several key points.

1.web uploads bin files through Content-Type: application/octet-stream mode

2. code



If (canBegin)

{

Serial.println ("111Error Occurred. Error:" + String (Update.getError ());

Size_t written = Update.writeStream (client); //wait write 1~3min



If (written = = contentLength) {

Serial.println ("Written:" + String (written) + "successfully");

}

Else

{

Serial.println ("Written only:" + String (written) + "/" + String (contentLength) + "Retry?";

/ / retry??

/ / execOTA ();

}



If (Update.end ())

{

Serial.println ("OTA done!");

If (Update.isFinished ())

{

Serial.println ("Update successfully completed. Rebooting.");

ESP.restart ();

}

Else

{

Serial.println ("Update not finished? Something went wrong!");

}

}

Else

{

Serial.println ("Error Occurred. Error:" + String (Update.getError ());

}

}

Else

{

Serial.println ("cat not begin");

}

Who is online

Users browsing this forum: No registered users and 138 guests