ESP32 WebUpdate?
-
- Posts: 15
- Joined: Thu Dec 07, 2017 3:59 am
ESP32 WebUpdate?
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?
Re: ESP32 WebUpdate?
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.
HERE i have a class implemented for this.
Take a look.
Will take 5 minutes to adapt the code to your needs.
-
- Posts: 30
- Joined: Mon Jun 11, 2018 5:52 am
Re: ESP32 WebUpdate?
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");
}
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 98 guests