File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 2222#include " elegantWebpage.h"
2323
2424
25+ size_t content_len;
26+
2527class AsyncElegantOtaClass {
2628 public:
2729
@@ -47,19 +49,22 @@ class AsyncElegantOtaClass{
4749 if (!index) {
4850
4951 #if defined(ESP8266)
50- uint32_t maxSketchSpace = (ESP.getFreeSketchSpace () - 0x1000 ) & 0xFFFFF000 ;
51- if (!Update.begin (maxSketchSpace)){ // Start with max available size
52+ content_len = request->contentLength ();
53+ int cmd = (filename.indexOf (" spiffs" ) > -1 ) ? U_SPIFFS : U_FLASH;
54+ // uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
55+ Update.runAsync (true );
56+ if (!Update.begin (content_len, cmd)){ // Start with max available size
5257 #endif
5358
5459 #if defined(ESP32)
55- if (!Update.begin (UPDATE_SIZE_UNKNOWN)) { // Start with max available size
60+ if (!Update.begin (UPDATE_SIZE_UNKNOWN, cmd )) { // Start with max available size
5661 #endif
5762 Update.printError (Serial);
5863 }
5964
60- #if defined(ESP8266)
65+ /* #if defined(ESP8266)
6166 Update.runAsync(true); // Tell the updaterClass to run in async mode
62- #endif
67+ #endif*/
6368
6469 }
6570
@@ -98,4 +103,4 @@ class AsyncElegantOtaClass{
98103};
99104
100105AsyncElegantOtaClass AsyncElegantOTA;
101- #endif
106+ #endif
You can’t perform that action at this time.
0 commit comments