Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
15.15k stars 3.28k forks source link

SPIFFS issue #130

Closed Adrian8x closed 5 years ago

Adrian8x commented 5 years ago

I have the following issue when I activate SPIFFS. I installed and uninstalled the ESPasyncwebserver library but without success. What's wrong or should I disable/enable some defs in code? If I disable (#define USEFS), the code is compiled ok.

Thank you!

Build options changed, rebuilding all C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled04_file.ino: In function 'String getContentType(String)':

wled04_file:55: error: base operand of '->' has non-pointer type 'AsyncWebServer'

if(server->hasArg("download")) return "application/octet-stream";

        ^

C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled04_file.ino: In function 'bool handleFileRead(String)':

wled04_file:80: error: base operand of '->' has non-pointer type 'AsyncWebServer'

 size_t sent = server->streamFile(file, contentType);

                     ^

C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled04_file.ino: In function 'void handleFileUpload()':

wled04_file:88: error: base operand of '->' has non-pointer type 'AsyncWebServer'

if(server->uri() != "/edit") return;

        ^

wled04_file:89: error: 'HTTPUpload' was not declared in this scope

HTTPUpload& upload = server->upload();

^

wled04_file:89: error: 'upload' was not declared in this scope

HTTPUpload& upload = server->upload();

           ^

wled04_file:89: error: base operand of '->' has non-pointer type 'AsyncWebServer'

HTTPUpload& upload = server->upload();

                          ^

wled04_file:90: error: 'UPLOAD_FILE_START' was not declared in this scope

if(upload.status == UPLOAD_FILE_START){

                   ^

wled04_file:96: error: 'UPLOAD_FILE_WRITE' was not declared in this scope

} else if(upload.status == UPLOAD_FILE_WRITE){

                          ^

wled04_file:100: error: 'UPLOAD_FILE_END' was not declared in this scope

} else if(upload.status == UPLOAD_FILE_END){

                          ^

C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled04_file.ino: In function 'void handleFileDelete()':

wled04_file:108: error: base operand of '->' has non-pointer type 'AsyncWebServer'

if(server->args() == 0) return server->send(500, "text/plain", "BAD ARGS");

        ^

wled04_file:108: error: base operand of '->' has non-pointer type 'AsyncWebServer'

if(server->args() == 0) return server->send(500, "text/plain", "BAD ARGS");

                                    ^

wled04_file:108: error: return-statement with a value, in function returning 'void' [-fpermissive]

if(server->args() == 0) return server->send(500, "text/plain", "BAD ARGS");

                                                                        ^

wled04_file:109: error: base operand of '->' has non-pointer type 'AsyncWebServer'

String path = server->arg(0);

                   ^

wled04_file:112: error: base operand of '->' has non-pointer type 'AsyncWebServer'

 return server->send(500, "text/plain", "BAD PATH");

              ^

wled04_file:112: error: return-statement with a value, in function returning 'void' [-fpermissive]

 return server->send(500, "text/plain", "BAD PATH");

                                                  ^

wled04_file:114: error: base operand of '->' has non-pointer type 'AsyncWebServer'

 return server->send(404, "text/plain", "FileNotFound");

              ^

wled04_file:114: error: return-statement with a value, in function returning 'void' [-fpermissive]

 return server->send(404, "text/plain", "FileNotFound");

                                                      ^

wled04_file:116: error: base operand of '->' has non-pointer type 'AsyncWebServer'

server->send(200, "text/plain", "");

     ^

C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled04_file.ino: In function 'void handleFileList()':

wled04_file:121: error: base operand of '->' has non-pointer type 'AsyncWebServer'

if(!server->hasArg("dir")) {server->send(500, "text/plain", "BAD ARGS"); return;}

         ^

wled04_file:121: error: base operand of '->' has non-pointer type 'AsyncWebServer'

if(!server->hasArg("dir")) {server->send(500, "text/plain", "BAD ARGS"); return;}

                                 ^

wled04_file:123: error: base operand of '->' has non-pointer type 'AsyncWebServer'

String path = server->arg("dir");

                   ^

wled04_file:142: error: base operand of '->' has non-pointer type 'AsyncWebServer'

server->send(200, "text/json", output);

     ^

C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled04_file.ino: In function 'void handleFileCreate()':

wled04_file:146: error: base operand of '->' has non-pointer type 'AsyncWebServer'

if(server->args() == 0)

        ^

wled04_file:147: error: base operand of '->' has non-pointer type 'AsyncWebServer'

 return server->send(500, "text/plain", "BAD ARGS");

              ^

wled04_file:147: error: return-statement with a value, in function returning 'void' [-fpermissive]

 return server->send(500, "text/plain", "BAD ARGS");

                                                  ^

wled04_file:148: error: base operand of '->' has non-pointer type 'AsyncWebServer'

String path = server->arg(0);

                   ^

wled04_file:151: error: base operand of '->' has non-pointer type 'AsyncWebServer'

 return server->send(500, "text/plain", "BAD PATH");

              ^

wled04_file:151: error: return-statement with a value, in function returning 'void' [-fpermissive]

 return server->send(500, "text/plain", "BAD PATH");

                                                  ^

wled04_file:153: error: base operand of '->' has non-pointer type 'AsyncWebServer'

 return server->send(500, "text/plain", "FILE EXISTS");

              ^

wled04_file:153: error: return-statement with a value, in function returning 'void' [-fpermissive]

 return server->send(500, "text/plain", "FILE EXISTS");

                                                     ^

wled04_file:158: error: base operand of '->' has non-pointer type 'AsyncWebServer'

 return server->send(500, "text/plain", "CREATE FAILED");

              ^

wled04_file:158: error: return-statement with a value, in function returning 'void' [-fpermissive]

 return server->send(500, "text/plain", "CREATE FAILED");

                                                       ^

wled04_file:159: error: base operand of '->' has non-pointer type 'AsyncWebServer'

server->send(200, "text/plain", "");

     ^

C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled18_server.ino: In function 'void initServer()':

wled18_server:109: error: no matching function for call to 'AsyncWebServer::on(const char [6], WebRequestMethod, void (&)())'

 server.on("/edit", HTTP_PUT, handleFileCreate);

                                              ^

C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled18_server.ino:109:50: note: candidates are:

In file included from C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled00.ino:42:0:

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:409:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, ArRequestHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, ArRequestHandlerFunction onRequest);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:409:30: note: candidate expects 2 arguments, 3 provided

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:410:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, WebRequestMethodComposite, ArRequestHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:410:30: note: no known conversion for argument 3 from 'void()' to 'ArRequestHandlerFunction {aka std::function<void(AsyncWebServerRequest*)>}'

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:411:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, WebRequestMethodComposite, ArRequestHandlerFunction, ArUploadHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest, ArUploadHandlerFunction onUpload);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:411:30: note: candidate expects 4 arguments, 3 provided

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:412:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, WebRequestMethodComposite, ArRequestHandlerFunction, ArUploadHandlerFunction, ArBodyHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest, ArUploadHandlerFunction onUpload, ArBodyHandlerFunction onBody);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:412:30: note: candidate expects 5 arguments, 3 provided

wled18_server:110: error: no matching function for call to 'AsyncWebServer::on(const char [6], WebRequestMethod, void (&)())'

 server.on("/edit", HTTP_DELETE, handleFileDelete);

                                                 ^

C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled18_server.ino:110:53: note: candidates are:

In file included from C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled00.ino:42:0:

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:409:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, ArRequestHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, ArRequestHandlerFunction onRequest);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:409:30: note: candidate expects 2 arguments, 3 provided

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:410:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, WebRequestMethodComposite, ArRequestHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:410:30: note: no known conversion for argument 3 from 'void()' to 'ArRequestHandlerFunction {aka std::function<void(AsyncWebServerRequest*)>}'

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:411:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, WebRequestMethodComposite, ArRequestHandlerFunction, ArUploadHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest, ArUploadHandlerFunction onUpload);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:411:30: note: candidate expects 4 arguments, 3 provided

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:412:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, WebRequestMethodComposite, ArRequestHandlerFunction, ArUploadHandlerFunction, ArBodyHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest, ArUploadHandlerFunction onUpload, ArBodyHandlerFunction onBody);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:412:30: note: candidate expects 5 arguments, 3 provided

C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled18_server.ino: In lambda function:

wled18_server:111: error: base operand of '->' has non-pointer type 'AsyncWebServer'

 server.on("/edit", HTTP_POST, [](){ server->send(200, "text/plain", ""); }, handleFileUpload);

                                           ^

C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled18_server.ino: In function 'void initServer()':

wled18_server:111: error: no matching function for call to 'AsyncWebServer::on(const char [6], WebRequestMethod, initServer()::__lambda24, void (&)())'

 server.on("/edit", HTTP_POST, [](){ server->send(200, "text/plain", ""); }, handleFileUpload);

                                                                                             ^

C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled18_server.ino:111:97: note: candidates are:

In file included from C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled00.ino:42:0:

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:409:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, ArRequestHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, ArRequestHandlerFunction onRequest);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:409:30: note: candidate expects 2 arguments, 4 provided

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:410:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, WebRequestMethodComposite, ArRequestHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:410:30: note: candidate expects 3 arguments, 4 provided

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:411:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, WebRequestMethodComposite, ArRequestHandlerFunction, ArUploadHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest, ArUploadHandlerFunction onUpload);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:411:30: note: no known conversion for argument 3 from 'initServer()::__lambda24' to 'ArRequestHandlerFunction {aka std::function<void(AsyncWebServerRequest*)>}'

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:412:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, WebRequestMethodComposite, ArRequestHandlerFunction, ArUploadHandlerFunction, ArBodyHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest, ArUploadHandlerFunction onUpload, ArBodyHandlerFunction onBody);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:412:30: note: candidate expects 5 arguments, 4 provided

wled18_server:112: error: no matching function for call to 'AsyncWebServer::on(const char [6], WebRequestMethod, void (&)())'

 server.on("/list", HTTP_GET, handleFileList);

                                            ^

C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled18_server.ino:112:48: note: candidates are:

In file included from C:\Users\rpup\AppData\Local\Temp\arduino_modified_sketch_268563\wled00.ino:42:0:

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:409:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, ArRequestHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, ArRequestHandlerFunction onRequest);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:409:30: note: candidate expects 2 arguments, 3 provided

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:410:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, WebRequestMethodComposite, ArRequestHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:410:30: note: no known conversion for argument 3 from 'void()' to 'ArRequestHandlerFunction {aka std::function<void(AsyncWebServerRequest*)>}'

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:411:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, WebRequestMethodComposite, ArRequestHandlerFunction, ArUploadHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest, ArUploadHandlerFunction onUpload);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:411:30: note: candidate expects 4 arguments, 3 provided

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:412:30: note: AsyncCallbackWebHandler& AsyncWebServer::on(const char*, WebRequestMethodComposite, ArRequestHandlerFunction, ArUploadHandlerFunction, ArBodyHandlerFunction)

 AsyncCallbackWebHandler& on(const char* uri, WebRequestMethodComposite method, ArRequestHandlerFunction onRequest, ArUploadHandlerFunction onUpload, ArBodyHandlerFunction onBody);

                          ^

C:\Program Files (x86)\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:412:30: note: candidate expects 5 arguments, 3 provided

exit status 1 base operand of '->' has non-pointer type 'AsyncWebServer'

Aircoookie commented 5 years ago

Hi! Do you want to add a custom functionality that depends on SPIFFS? I haven't been using it for more than 2 years, and EspAsyncWebserver requires different code to work with spiffs. Once i implement a better preset/custom palette/playlist feature, I will need SPIFFS again. Right now it doesn't work. If you have a good reason for it, i might re-add support sooner :)

Adrian8x commented 5 years ago

Hi,

It's easier for me to develop/debug the HTML if I upload html's to FS and not to convert every time from gzip to array.

Aircoookie commented 5 years ago

That makes sense! Since I soon will need the SPIFFS again anyways, I'll restore the functionality very soon!

Adrian8x commented 5 years ago

That's great! I'm home designer and I create personalized decors sometimes with lights. I don't have so much time and knowledge to develop too deep firmware's. Lights are a little part of what I do. I'm focused more at forms. I just want to create interface(logo, themes...) more personalized to users, to change their architectural lights so I need to change easy the HTML and to upload on ESP via HTML interface with a single button.

Thank you so much! You made a great library!

Aircoookie commented 5 years ago

SPIFFS is now supported again in latest master! You need to toggle the 3 headers in wled00.ino to enable it. After that, you can use the /edit page to upload or change SPIFFS content. Serving arbitrary files (including gzipped) from SPIFFS (and index.htm/index_mobile.htm) is also supported if you toggle on #define WLED_ENABLE_FS_SERVING :)

Adrian8x commented 5 years ago

I tested your last repository with SPIFFS and it works perfect.

Thank you a lot for your help and for this peace of firmware art!