From 9d0a69042191843bc4de880e16870f4f3d849a6b Mon Sep 17 00:00:00 2001 From: John Doe Date: Sat, 4 Jul 2015 00:46:58 +0300 Subject: [PATCH] fix WebUpload example --- libraries/ESP8266WebServer/examples/WebUpdate/WebUpdate.ino | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libraries/ESP8266WebServer/examples/WebUpdate/WebUpdate.ino b/libraries/ESP8266WebServer/examples/WebUpdate/WebUpdate.ino index b411d234e..4962b35e8 100644 --- a/libraries/ESP8266WebServer/examples/WebUpdate/WebUpdate.ino +++ b/libraries/ESP8266WebServer/examples/WebUpdate/WebUpdate.ino @@ -30,15 +30,13 @@ void setup(void){ Serial.setDebugOutput(true); WiFiUDP::stopAll(); Serial.printf("Update: %s\n", upload.filename.c_str()); - uint32_t maxSketchSpace = ((ESP.getFreeSketchSpace() + ESP.getSketchSize()) / 2) & 0xFFFFF000; + uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000; if(!Update.begin(maxSketchSpace)){//start with max available size Update.printError(Serial); - return; } } else if(upload.status == UPLOAD_FILE_WRITE){ if(Update.write(upload.buf, upload.currentSize) != upload.currentSize){ Update.printError(Serial); - return; } } else if(upload.status == UPLOAD_FILE_END){ if(Update.end(true)){ //true to set the size to the current progress @@ -59,7 +57,7 @@ void setup(void){ server.begin(); MDNS.addService("http", "tcp", 80); - Serial.println("Ready! Open http:\/\/%s.local in your browser\n", host); + Serial.printf("Ready! Open http://%s.local in your browser\n", host); } else { Serial.println("WiFi Failed"); }