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 22
22
#include " elegantWebpage.h"
23
23
24
24
25
+ size_t content_len;
26
+
25
27
class AsyncElegantOtaClass {
26
28
public:
27
29
@@ -47,19 +49,22 @@ class AsyncElegantOtaClass{
47
49
if (!index) {
48
50
49
51
#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
52
57
#endif
53
58
54
59
#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
56
61
#endif
57
62
Update.printError (Serial);
58
63
}
59
64
60
- #if defined(ESP8266)
65
+ /* #if defined(ESP8266)
61
66
Update.runAsync(true); // Tell the updaterClass to run in async mode
62
- #endif
67
+ #endif*/
63
68
64
69
}
65
70
@@ -98,4 +103,4 @@ class AsyncElegantOtaClass{
98
103
};
99
104
100
105
AsyncElegantOtaClass AsyncElegantOTA;
101
- #endif
106
+ #endif
You can’t perform that action at this time.
0 commit comments