Skip to content

Commit 5d2ed76

Browse files
John Doeigrr
authored andcommitted
fix WebUpload example
1 parent fcfb03e commit 5d2ed76

File tree

1 file changed

+2
-4
lines changed
  • hardware/esp8266com/esp8266/libraries/ESP8266WebServer/examples/WebUpdate

1 file changed

+2
-4
lines changed

hardware/esp8266com/esp8266/libraries/ESP8266WebServer/examples/WebUpdate/WebUpdate.ino

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ void setup(void){
3030
Serial.setDebugOutput(true);
3131
WiFiUDP::stopAll();
3232
Serial.printf("Update: %s\n", upload.filename.c_str());
33-
uint32_t maxSketchSpace = ((ESP.getFreeSketchSpace() + ESP.getSketchSize()) / 2) & 0xFFFFF000;
33+
uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
3434
if(!Update.begin(maxSketchSpace)){//start with max available size
3535
Update.printError(Serial);
36-
return;
3736
}
3837
} else if(upload.status == UPLOAD_FILE_WRITE){
3938
if(Update.write(upload.buf, upload.currentSize) != upload.currentSize){
4039
Update.printError(Serial);
41-
return;
4240
}
4341
} else if(upload.status == UPLOAD_FILE_END){
4442
if(Update.end(true)){ //true to set the size to the current progress
@@ -59,7 +57,7 @@ void setup(void){
5957
server.begin();
6058
MDNS.addService("http", "tcp", 80);
6159

62-
Serial.println("Ready! Open http:\/\/%s.local in your browser\n", host);
60+
Serial.printf("Ready! Open http://%s.local in your browser\n", host);
6361
} else {
6462
Serial.println("WiFi Failed");
6563
}

0 commit comments

Comments
 (0)