Skip to content

Make SD Class be able to coexist with SPIFFS #1524

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

Closed
me-no-dev opened this issue Jan 28, 2016 · 6 comments
Closed

Make SD Class be able to coexist with SPIFFS #1524

me-no-dev opened this issue Jan 28, 2016 · 6 comments

Comments

@me-no-dev
Copy link
Collaborator

we should rework this to use the same API (will look into it)
but this is for now
me-no-dev@72c2c3f

@tzapu
Copy link
Contributor

tzapu commented Mar 14, 2016

hi, if this is to be done at some point, maybe it s worth adding long file names as well and this suggestion here
#641
SdFat lib with LFN support https://github.com./tannewt/SdFat

@igrr
Copy link
Member

igrr commented Jun 2, 2016

Fixed in 43fb139

@igrr igrr closed this as completed Jun 2, 2016
@DedeHai
Copy link

DedeHai commented Oct 15, 2016

Do you have an example on how to use the two file systems side by side? Something like open, access and close a file on SPIFFs then on SD card.

Edit:
I figured it out and to save others the hassle, here is a simple example:

#define FS_NO_GLOBALS //allow spiffs to coexist with SD card, define BEFORE including FS.h
#include <FS.h> //spiff file system

//accessing SPIFFS files, add 'fs::' in front of the file declaration, the rest is done as usual:
   fs::File file = SPIFFS.open(path, "r");  //add the namespace 
   size_t sent = server.streamFile(file, contentType); //stream file to webclient
   file.close();

//accessing SD card files is done the usual way:
 File dataFile = SD.open(filename, FILE_WRITE); //create the file
      if (dataFile) {
        String header = "Logfile created at "  + getTimeString();
        dataFile.println(header);
      }
      dataFile.close();

@Bushii7
Copy link

Bushii7 commented Sep 16, 2017

full code please :/

@duckylock
Copy link

This not really works for me. The namespace error disappeared but the read / write experience seams to not working for me. In your code you dont use any include SD.h is it a mistake or...? And if it missed where is it suppose to go? Before? After? Thanks

@d-a-v
Copy link
Collaborator

d-a-v commented Feb 21, 2019

@duckylock you may try #5525 (soon to be merged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants