[GH-ISSUE #949] Reset Setting including Spiffs.fomart -> ESP8266 #802

Open
opened 2026-02-28 01:27:07 +03:00 by kerem · 15 comments
Owner

Originally created by @bgersmann on GitHub (Sep 26, 2019).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/949

Basic Infos

Hardware

WiFimanager Branch/Release:

  • [ X] Master
  • Development

Esp8266/Esp32:

  • [X ] ESP8266
  • ESP32

Hardware: ESP-12e, esp01, esp25

  • ESP01
  • [X ] ESP12 E/F/S (nodemcu, wemos, feather)
  • Other

ESP Core Version: 2.4.0, staging

  • 2.3.0
  • [ X] 2.5.2
  • staging (master/dev)

Description

Hi,

I'm using a local copy of the library, because I added a "Spiffs.format()" to the reset function.
Is there any easy way to do this without the local copy? Could you maybe add it as an optional parameter to the reset function?

Thanks in advance.

Originally created by @bgersmann on GitHub (Sep 26, 2019). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/949 ### Basic Infos #### Hardware **WiFimanager Branch/Release:** - [ X] Master - [ ] Development **Esp8266/Esp32:** - [X ] ESP8266 - [ ] ESP32 **Hardware: ESP-12e, esp01, esp25** - [ ] ESP01 - [X ] ESP12 E/F/S (nodemcu, wemos, feather) - [ ] Other **ESP Core Version: 2.4.0, staging** - [ ] 2.3.0 - [ X] 2.5.2 - [ ] staging (master/dev) ### Description Hi, I'm using a local copy of the library, because I added a "Spiffs.format()" to the reset function. Is there any easy way to do this without the local copy? Could you maybe add it as an optional parameter to the reset function? Thanks in advance.
Author
Owner

@tablatronix commented on GitHub (Sep 26, 2019):

hmm, WM does not use Spiffs, so it would make no sense to add this.

Maybe use a callout to user code?

<!-- gh-comment-id:535624648 --> @tablatronix commented on GitHub (Sep 26, 2019): hmm, WM does not use Spiffs, so it would make no sense to add this. Maybe use a callout to user code?
Author
Owner

@Joennuh commented on GitHub (Sep 26, 2019):

Some examples DO use SPIFFS to save extra parameters. Like this one: https://github.com/tzapu/WiFiManager/blob/master/examples/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino
An SPIFFS reset function would be nice but I believe it is not absolutely necessary for the core functionality of WiFiManager.

<!-- gh-comment-id:535629302 --> @Joennuh commented on GitHub (Sep 26, 2019): Some examples DO use SPIFFS to save extra parameters. Like this one: https://github.com/tzapu/WiFiManager/blob/master/examples/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino An SPIFFS reset function would be nice but I believe it is not absolutely necessary for the core functionality of WiFiManager.
Author
Owner

@tablatronix commented on GitHub (Sep 26, 2019):

yeah examples.
I am going to try to add a define or auto detect spiffs and do it like that

<!-- gh-comment-id:535629804 --> @tablatronix commented on GitHub (Sep 26, 2019): yeah examples. I am going to try to add a define or auto detect spiffs and do it like that
Author
Owner

@tablatronix commented on GitHub (Sep 26, 2019):

Ok so WiFiManager::erase(bool opt) already exists and has an optional flag

in esp32 this can erase NVS

In esp8266 I can make it erase spiffs ( if spiffs was compiled and is incuded etc )
I just have to figure out error handling and stuff

<!-- gh-comment-id:535637079 --> @tablatronix commented on GitHub (Sep 26, 2019): Ok so WiFiManager::erase(bool opt) already exists and has an optional flag in esp32 this can erase NVS In esp8266 I can make it erase spiffs ( if spiffs was compiled and is incuded etc ) I just have to figure out error handling and stuff
Author
Owner

@tablatronix commented on GitHub (Sep 26, 2019):

I think I will just leave it seperate, so you have to call it twice for now

<!-- gh-comment-id:535638262 --> @tablatronix commented on GitHub (Sep 26, 2019): I think I will just leave it seperate, so you have to call it twice for now
Author
Owner

@tablatronix commented on GitHub (Sep 26, 2019):

Will have to test of course, as of now they are seperate, I can work on combining them later if they work and I can figure out error handling.

as of now

on esp8266
erase() will erase wificonfig via "ESP.eraseConfig()" or sector wipe if WM_FIXERASECONFIG
erase(true) will erase spiffs ONLY

on esp32
erase() will erase wifi config via disconnect
erase(true) will erase NVS if WM_ERASE_NVS and nvs_flash_h

All will return bool result

<!-- gh-comment-id:535641764 --> @tablatronix commented on GitHub (Sep 26, 2019): Will have to test of course, as of now they are seperate, I can work on combining them later if they work and I can figure out error handling. as of now on esp8266 `erase()` will erase wificonfig via "ESP.eraseConfig()" or sector wipe if `WM_FIXERASECONFIG` `erase(true)` will erase spiffs ONLY on esp32 `erase()` will erase wifi config via disconnect `erase(true)` will erase NVS if `WM_ERASE_NVS` and `nvs_flash_h` All will return bool result
Author
Owner

@tablatronix commented on GitHub (Sep 26, 2019):

you can test with this

  if (!SPIFFS.begin()) {
    Serial.println("Failed to mount file system");
    return;
  }
    FSInfo info;
    SPIFFS.info(info);
    Serial.printf("Total: %u\nUsed: %u\nBlock: %u\nPage: %u\nMax open files: %u\nMax path len: %u\n",
                  info.totalBytes,
                  info.usedBytes,
                  info.blockSize,
                  info.pageSize,
                  info.maxOpenFiles,
                  info.maxPathLength
                 );
<!-- gh-comment-id:535654979 --> @tablatronix commented on GitHub (Sep 26, 2019): you can test with this ```C++ if (!SPIFFS.begin()) { Serial.println("Failed to mount file system"); return; } FSInfo info; SPIFFS.info(info); Serial.printf("Total: %u\nUsed: %u\nBlock: %u\nPage: %u\nMax open files: %u\nMax path len: %u\n", info.totalBytes, info.usedBytes, info.blockSize, info.pageSize, info.maxOpenFiles, info.maxPathLength ); ```
Author
Owner

@tablatronix commented on GitHub (Sep 26, 2019):

hmm not working, let me fix it

<!-- gh-comment-id:535657125 --> @tablatronix commented on GitHub (Sep 26, 2019): hmm not working, let me fix it
Author
Owner

@tablatronix commented on GitHub (Sep 26, 2019):

of course it wont work, doh, I cannot detect spiffs defined in sketch.. ugh C++ linker is so anoying sometimes

<!-- gh-comment-id:535701059 --> @tablatronix commented on GitHub (Sep 26, 2019): of course it wont work, doh, I cannot detect spiffs defined in sketch.. ugh C++ linker is so anoying sometimes
Author
Owner

@Ruandv commented on GitHub (Jan 15, 2020):

@tablatronix is this something that I can have a look at for you? Can i maybe put it as part of an exampe?

<!-- gh-comment-id:574788353 --> @Ruandv commented on GitHub (Jan 15, 2020): @tablatronix is this something that I can have a look at for you? Can i maybe put it as part of an exampe?
Author
Owner

@tablatronix commented on GitHub (Jan 15, 2020):

Well I was hoping to have it automatic but I do not see any way to do it ill have to add some flags or params to let users do it instead

<!-- gh-comment-id:574828803 --> @tablatronix commented on GitHub (Jan 15, 2020): Well I was hoping to have it automatic but I do not see any way to do it ill have to add some flags or params to let users do it instead
Author
Owner

@Ruandv commented on GitHub (Jan 15, 2020):

Suggestion:
Why don't you rename thebool WiFiManager::erase(bool opt) to bool WiFiManager::format() ?
then bool WiFiManager::erase() will still only do WiFi_eraseConfig and
bool WiFiManager::format() will then go and do spiffs.format() and call WiFi_eraseConfig

<!-- gh-comment-id:574845674 --> @Ruandv commented on GitHub (Jan 15, 2020): _Suggestion:_ Why don't you rename the`bool WiFiManager::erase(bool opt)` to `bool WiFiManager::format()` ? then `bool WiFiManager::erase()` will still only do `WiFi_eraseConfig` and `bool WiFiManager::format()` will then go and do `spiffs.format()` and call `WiFi_eraseConfig`
Author
Owner

@Ruandv commented on GitHub (Feb 22, 2020):

Is there any objections to my suggestion above? If not then I'm willing to try and implement it.

<!-- gh-comment-id:589917856 --> @Ruandv commented on GitHub (Feb 22, 2020): Is there any objections to my suggestion above? If not then I'm willing to try and implement it.
Author
Owner

@tablatronix commented on GitHub (Feb 22, 2020):

Yeah but that's not really the problem, the problem is this only works with spiffs enabled. And I cannot see how we can determine that since user can do it themselves in their code or other librarys

<!-- gh-comment-id:589923925 --> @tablatronix commented on GitHub (Feb 22, 2020): Yeah but that's not really the problem, the problem is this only works with spiffs enabled. And I cannot see how we can determine that since user can do it themselves in their code or other librarys
Author
Owner

@Ruandv commented on GitHub (Feb 22, 2020):

Ok thanks now I understand the bigger problem.

On Sat, 22 Feb 2020, 08:20 Shawn A, notifications@github.com wrote:

Yeah but that's not really the problem, the problem is this only works
with spiffs enabled.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/tzapu/WiFiManager/issues/949?email_source=notifications&email_token=AAR4TXDHPTLW7T5BDRVIDE3REC74DA5CNFSM4I2VQOU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMUYMVI#issuecomment-589923925,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAR4TXCV43QENAE4IFZY32TREC74DANCNFSM4I2VQOUQ
.

<!-- gh-comment-id:589925118 --> @Ruandv commented on GitHub (Feb 22, 2020): Ok thanks now I understand the bigger problem. On Sat, 22 Feb 2020, 08:20 Shawn A, <notifications@github.com> wrote: > Yeah but that's not really the problem, the problem is this only works > with spiffs enabled. > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/tzapu/WiFiManager/issues/949?email_source=notifications&email_token=AAR4TXDHPTLW7T5BDRVIDE3REC74DA5CNFSM4I2VQOU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMUYMVI#issuecomment-589923925>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AAR4TXCV43QENAE4IFZY32TREC74DANCNFSM4I2VQOUQ> > . >
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#802
No description provided.