@perryc:
Can you somehow share your code? I can not send you a pm (it seems that this is blocked for new users; why?)
Jaap
How to use virtual file system.?
Re: How to use virtual file system.?
I have it working now, works very well, reading and writing a file to flash.
I am using it with ardunio and had to increase the task stack to run the espidf vfs_fat example.
Should be able to compile the wear leveling code example and add the custom file partition for the filesystem and it will work.
Phil.
I am using it with ardunio and had to increase the task stack to run the espidf vfs_fat example.
Should be able to compile the wear leveling code example and add the custom file partition for the filesystem and it will work.
Phil.
Re: How to use virtual file system.?
Interesting.
How was it done?
How was it done?
Re: How to use virtual file system.?
Take a look at: viewtopic.php?f=18&t=1901jgfrmesp wrote:Yes, that precisely the case. Spiffs raw (so without vfs) works fine.
As soon as I use the vfs part (I used the code at https://github.com/nkolban/esp32-snippe ... vfs/spiffs)m I can not read the file back (I can not see if it is written in the first place).
Best,
Jaap
Re: How to use virtual file system.?
Hello, I'm new on ESP32 ( have only little experience in programming) and currently working on a simple webserver. ESP starts in AP-mode.
I hope to find a solution for the following issue and kindly ask for help:
I would like to load a file that contains my html-code.
I tried to simply use the FS.h library and the code that was used on ESP8266 since I could not find a reference guide for the ESP32 libraries that i undestood.
I compiled in Arduino IDE and also PlatformIO.
In Arduino I used the library from espressif github https://github.com/espressif/arduino-esp32
Error is: " 'SPIFFS' was not declared in this scope "
Heres the important part of my code:
I hope to find a solution for the following issue and kindly ask for help:
I would like to load a file that contains my html-code.
I tried to simply use the FS.h library and the code that was used on ESP8266 since I could not find a reference guide for the ESP32 libraries that i undestood.
I compiled in Arduino IDE and also PlatformIO.
In Arduino I used the library from espressif github https://github.com/espressif/arduino-esp32
Error is: " 'SPIFFS' was not declared in this scope "
Heres the important part of my code:
Code: Select all
#include <FS.h>
#include <WiFi.h>
#define DEBUGMODE 1
/*Wifi Access data*/
const char* ssid_ap = "AccessPoint";
const char* password_ap = "12345678";
const char * ssid_sta = "<SSID>";
const char * password_sta = "<Password>";
/* set global variables */
byte WiFiMode = 0; // WIFI_STA = 1 = Workstation WIFI_AP = 2 = Accesspoint
int request_counter;
String sHTML;
String sHTMLRequest;
/* Create instance of server on Port 80 */
WiFiServer server(80);
WiFiClient client;
void setup() {
/*start serial communication */
Serial.begin(115200);
SPIFFS.format();
Serial.println("Spiffs formatted");
/* start WiFi as workstation (STA), if not possible
start as Acess Point initialize server */
WiFi_Start_STA();
if (WiFiMode == 0) WiFi_Start_AP();
}
void loop() {
/* Check if a client has connected */
client = server.available();
if (!client)
{
return;
}
/*Wait for the client to send data */
Serial.println("neuer Client verbunden");
/*Count Aufruf der Seite: */
request_counter ++;
unsigned long clTimeout = millis()+250;
while(!client.available() && (millis()<clTimeout) )
{
delay(1);
}
if(millis()>clTimeout)
{
Serial.println("time-out bei Client-Verbindung!");
return;
}
/****** open html files *******/
SPIFFS.begin();
File f = SPIFFS.open("/home.txt", "r");
if (!f) {
Serial.println("file open failed");
}
f.close();
}
Re: How to use virtual file system.?
Sorry for slow reply jgfrmesp - I'd not seen this thread was still active. Is there any reason we'd not want to move on to using the wear leveling driver that's now in the esp-idf? So far it's been working well in my tests other than I've not solved how to flash a prebuilt filesystem.
Perry
Perry
Who is online
Users browsing this forum: Bing [Bot], dzungpv, Majestic-12 [Bot] and 85 guests