-->
Page 1 of 4

Can I initialize SPIFFS from code ?

PostPosted: Fri Feb 26, 2016 1:36 am
by RogerClark
To save uploading an empty SPIFFS file to the ESP8266, does anyone know if I can init the SPIFFS in the code

I took a look at the SPIFFS header in the ESP8266 Arduino repo

https://github.com/esp8266/Arduino/blob ... s/spiffs.h

But I can't see anything about how to initialise the SPIFFS :-(

Re: Can I initialize SPIFFS from code ?

PostPosted: Fri Feb 26, 2016 9:32 am
by martinayotte
Hi Roger,

You should not include "spiffs.h" directly, but use the "FS.h" instead.

Code: Select allif (!SPIFFS.begin()) {
      Serial.println("SPIFFS failed to mount !");
}
else {
      SPIFFS.format();
      Serial.println("SPIFFS fortmatted !");
}

Re: Can I initialize SPIFFS from code ?

PostPosted: Sat Feb 27, 2016 5:03 am
by RogerClark
Thanks Martin

That will save a lot of time

Re: Can I initialize SPIFFS from code ?

PostPosted: Wed Mar 02, 2016 10:01 pm
by RogerClark
Another silly question, but how fast is SPIFFS supposed to be?

I'm reading in 160 chars into a String, and it is taken quite a long time, i.e looks like hundreds of milliseconds

Perhaps reading into a String is very inefficient ?