sblantipodi / arduino_bootstrapper

Utility classes for bootstrapping Arduino projects with Wifi management, OTA upload management, memory management, MQTT and queue management. (ESP8266/ESP32 ready)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Justification of the SPIFFS.format() instruction when initializing WiFi credentials with OTA web server ?

Pronoe opened this issue · comments

Hello David,
in the case of WiFi credentials and other parameters being initialized by Web server, before writing these parameters in the setup.json file, you have an instruction SPIFFS.format() in the case of the ESP32 and nothing similar for the ESP8266 (see line 528 in WifiManager.cpp).
What is the aim of this instruction and why isn't it implemented for the ESP8266 ?
Also this format instruction is a bit annoying for me, because it erases my other configuration files when I want to change credentials through Web .
I would prefer a solution with a dedicated BootstrapManager.eraseFileSystem() instruction that could be called if required by the application code rather than automatic formatting.
However to avoid any change to existing code, a setup option parameter extern bool autoEraseFileSystem could be added in Helpers.h with its value set by default to true in Helpers.cpp (in the same way as extern bool fastDisconnectionManagement.
I have already added in this way a parameter extern bool forceWebServer to manage activation on demand of the Web server as a response to issue #9.
I will provide soon after some testing, a pull request with these modifications, if you agree.

I removed that SPIFFS.format() in the 1.2.7 on the createWebServer() function, it is unnecessary.
thank you Pronoe, a BootstrapManager.eraseFileSystem() function will be implemented in the future, as always, pull request are always appreciated :)

OK, perfect.
I have already prepared the modifications to implement the BootstrapManager.eraseFileSystem() function (quite simple).
I will test it in the coming days after having forked the last 1.12.7 release.

Hello,
release v1.17.7 has suppressed the unnecessary SPIFFS.format() instruction for the ESP32 and I have tested this modification and this is OK now.
I think now that the creation of a specific BootstrapManager.eraseFileSystem() is unnecessary because a simple SPIFFS.format() or LittleFS.format() instruction can do the job in the application code.
So I have closed this issue.