Skip to content
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

SdFat version? #9

Closed
hicksan opened this issue Sep 10, 2021 · 2 comments
Closed

SdFat version? #9

hicksan opened this issue Sep 10, 2021 · 2 comments

Comments

@hicksan
Copy link

hicksan commented Sep 10, 2021

This looks like a really fantastic library and I would love to be able to use it.

I am building a project on an ESP8266 Wemos D1 board and therefore have to use the ESP8266 version of SdFat.

Can this library be made to work with SdFat instead of SD.h? I have tried but not succeeded getting anything to compile.

@michalmonday
Copy link
Owner

Hello, I'm using Arduino 1.8.15 and Esp8266 boards for Arduino package (2.5.0). I tried to compile SD card example for "Generic esp8266 board" and "LOLIN(WEMOS) D1 mini Pro" and in both cases it compiled successfully.

Are you using Platformio by any chance? If yes, then possibly the suggestion from this issue will be helpful.

I never used SdFat library on its own, it seems low level and I'm not sure how to integrate it. If you manage to read a file byte by byte (or in chunks), then you could just supply it to CSV_Parser object as shown in this example.

@hicksan
Copy link
Author

hicksan commented Sep 11, 2021

The following code works with SdFat:

Looking at CSV-Parser.cpp, line 4 :
#include <SD.h>
I have replaced this with:
#include <SdFat.h>
using namespace sdfat;
SdFat sd;

Then line 111:
File csv_file = SD.open(f_name);
if (!csv_file) {
...
becomes:
File csv_file;
if (!csv_file.open(f_name, FILE_READ)) {
...

This works with SdFat.

Yes SD.h does work with ESP8266, but not with all other libraries and I was unable to get it working with my particular configuration of modules where I finally managed to get SdFat working. My understanding is that SdFat is more recent, more powerful and better supported - but I may be completely wrong. Subject to the changes above it works fine and my CSV files are parsing beautifully. Job done.

Thank you so much for a fantastic library that has saved me a whole pile of work. And thank you also for responding to issue threads - I know it must be a huge burden but it really helps users getting started and want you to know how much it is appreciated.

@hicksan hicksan closed this as completed Sep 11, 2021
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

2 participants