-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working when FS_NO_GLOBALS is defined #111
Comments
maybe it would work fine if I replace all FS/File instances with fs::FS/fs::File and not need a define |
Maybe, I am not really familiar with name spaces in C. If you have a branch you want me to test this, let me know. |
I am affected by
|
I have the same issue (SPIFFS and SD) and solved it by doing the essentially the same thing but with:
upfront. BTW/ same changes seem to be necessary in WebResponseImpl.h and WebHandlerImpl.h. Thanks for a really nice package. |
@boblemaire can you get https://gist.github.com/probonopd/aef8eb21d5c56dc96b7a1910ae58a4aa to compile? If so, how? If yes, this is a bug that should be fixed in the library? Thanks for your help. |
probonopd,
inserted at the start of
I wouldn't go so far as to call it a bug as a lack of support for SD. ESPAsyncWebServer appears to have been written expressly for the ESP which has a native file system in the SPIFFs. So the file support is for the SPIFFs file system, which is simpler than the FAT file system on an SD card. Maybe it would have been better to call the File class something different like SPFile as was suggested in the lead post, but that's history. Sounds like me-no-dev is open to making an accommodation and I suspect something will be done. In a previous discussion that I came across the basic FS.h SD.h issue was resolved with the FS_NO_GLOBALS definition. Seems that ESPAsyncWebServer is just another instance of it. All that said, this thing is fantastic. It is very well designed and coded (IMHO), and flexible enough to handle just about anything, including SD once you get compiled.
|
Thank you very much @boblemaire for your very helpful and detailed comment, you made me really happy as I am now unblocked in my further development of that sketch 👍 I agree that @me-no-dev's Async* libraries are a great plus and actually I wonder whether they could be made the default at some point. Each time I start an ESP project I tend to avoid external dependencies, but at some point it's always suggested to port the code to Async*. |
How would we get rid of the |
I'm not comfortable having a conversation about this in the GitHub issues space. This developer is contributing some fine software, and I don't want to detract from his or her efforts with what amounts to a forum. I'm happy to have helped you get compiled. Good Luck. |
@boblemaire totally agree and I also don't want to detract @me-no-dev. Again, thanks for your help, highly appreciated. 👍 |
Hi
I just started using your library and in my sketch I am using the SD library as well as the SPIFFS library. This can be done by defining
FS_NO_GLOBALS
before including the#include <FS.h>
Now to access spiff files an
fs::
has to be added before everFile
andFS
declaration when creating SPIFFS file objects.I added the following code in ESPAsyncWebServer.h and replaced all instances of
FS
andFile
with the defines.Now the files are served from the SPIFFs and I am still able to use the SD card for datalogging. The only disadvantage is that files cannot be served from the SD card by using the handler. I did not try this but there is probably a way to create another handler for SD files, just not sure how this would be done as I do not fully understand yet how your library actually works its magic.
Also I am not sure if the ESPAsyncWebServer.h is the right file to put the defines, maybe there is a better (more global) scope?
Would be great if you could add this functionality to your library so it is compatible with
FS_NO_GLOBALS
The text was updated successfully, but these errors were encountered: