You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This isn't a complaint about the project it's just a reflection from an end-user using the library in a non-standard development environment (custom emacs C++ IDE, esp-idf)
I think it's worth mentioning that it's unnecessarily difficult to access the spiffs mountpoint with vfs_api.cpp in the Arduino vfs library that Audio.cpp relies on. There's a lot less gymnastics to get it to just work with the esp-idf implementation of spiffs, and percentage wise trying to get SPIFFS.h to play nicely with the esp-idf configuration for spiffs (e.g., nonstandard data directory name such as spiffs_data) has been that largest bottleneck in my project with the least amount of sense to it
Here's an example of what I mean
FILE *file = fopen("/spiffs_data/load-test.txt", "r");
printf("Trying to call the spiffs data load test file read from audio.cpp, does it work? \n");
if(file ==NULL)
{
printf("audio.cpp spiffsdata path isn't working \n"); ESP_LOGE(TAG,"audio.cpp spiffsdata File does not exist!");
} else { printf("audio.cpp spiffsdata path is working! \n");
char line[256]; while(fgets(line, sizeof(line), file) != NULL)
{ printf(line);
}
fclose(file);
}
easy access, works as intended
(apologies for poor formatting, I use tabs and github has horrible spacing on them)
filesystem not mounted error. Now I need to check my imports, examine the arduino library code (IMO rather confusing to read because vfs_api.cpp references to _mountpoint variable that is difficult to locate, couldn't find it in .cpp or .h), spend many hours to figure out why it doesn't work for little reward.
One possible solution could be to simply state in the documentation how to pass the file bitstream to Audio.cpp directly, as this will cover many use-cases and isn't obvious to me.
If I take a look at SPIFFS.h in arduino/libraries, I see
which seems to hardcode the path for the spiffs data directory to spiffs. Same for a reference to _mountpoint in vfs_api (but it's unclear whether mountpoint itself is hardcoded to /spiffs) But in esp-idf, you can make the path anything you want. In my case it's spiffs_data. That just isn't a good idea in my opinion. Perhaps that is more of a complaint for the arduino people
How I fixed my problem
Ensure spiffs is the directory (not spiffs_data or similar)
Do not declare normal esp_vfs_spiffs_register (will cause not mounted error even though it is mounted), probbaly need to report this to arduino devs
call as following (e.g., files.cpp)
#include<stdio.h>
#include"FS.h"
#include"SPIFFS.h"
#include"esp_spiffs.h"
#include"esp_log.h"
#defineTAG"spiffs"voidsetup_filesystem(void) {
printf("Trying to run with SPIFFS.h \n");
if (SPIFFS.begin()) {
printf("Spiffs began! \n");
File writeFile = SPIFFS.open("/trying-to-access-this-shit.txt", "w");
writeFile.print("Fucking annoying");
vTaskDelay(1000);
writeFile.close();
File arduinoFile = SPIFFS.open("/load-test.txt", "r");
if (!arduinoFile) {
printf("Arduino file not working sadly \n");
return;
} else {
printf("Arduino file works! \n");
// printf(Arduinofile.read());
}
} else {
printf("Spiffs did not begin correctly");
}
Import into audio.cpp
#import"files.cpp"
The text was updated successfully, but these errors were encountered:
This isn't a complaint about the project it's just a reflection from an end-user using the library in a non-standard development environment (custom emacs C++ IDE, esp-idf)
I think it's worth mentioning that it's unnecessarily difficult to access the spiffs mountpoint with vfs_api.cpp in the Arduino vfs library that Audio.cpp relies on. There's a lot less gymnastics to get it to just work with the esp-idf implementation of spiffs, and percentage wise trying to get SPIFFS.h to play nicely with the esp-idf configuration for spiffs (e.g., nonstandard data directory name such as spiffs_data) has been that largest bottleneck in my project with the least amount of sense to it
Here's an example of what I mean
easy access, works as intended
(apologies for poor formatting, I use tabs and github has horrible spacing on them)
audio.connecttoFS(SPIFFS, "/spiffs_data/bell.mp3");
filesystem not mounted error. Now I need to check my imports, examine the arduino library code (IMO rather confusing to read because vfs_api.cpp references to _mountpoint variable that is difficult to locate, couldn't find it in .cpp or .h), spend many hours to figure out why it doesn't work for little reward.
One possible solution could be to simply state in the documentation how to pass the file bitstream to Audio.cpp directly, as this will cover many use-cases and isn't obvious to me.
If I take a look at
SPIFFS.h
in arduino/libraries, I seewhich seems to hardcode the path for the spiffs data directory to spiffs. Same for a reference to _mountpoint in vfs_api (but it's unclear whether mountpoint itself is hardcoded to /spiffs) But in esp-idf, you can make the path anything you want. In my case it's spiffs_data. That just isn't a good idea in my opinion. Perhaps that is more of a complaint for the arduino people
How I fixed my problem
Import into audio.cpp
The text was updated successfully, but these errors were encountered: