[GH-ISSUE #1527] Persistent custom values #1303

Closed
opened 2026-02-28 01:29:29 +03:00 by kerem · 3 comments
Owner

Originally created by @pablopeu on GitHub (Nov 28, 2022).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1527

Is there a way to make the defined custom values to be persistant?

` WiFiManagerParameter custom_User_ID("User_ID", "Used ID", "", 30);

WiFiManagerParameter custom_Bot_Token("Bot_Token", "BOT token", "", 46);

wm.addParameter(&custom_User_ID);

wm.addParameter(&custom_Bot_Token);
`

This is my example of the values I want to keep across reboots/resets, does the library allows for this, or I need to write/retrieve them by myself from say EEPROM?

Thanks

Originally created by @pablopeu on GitHub (Nov 28, 2022). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1527 Is there a way to make the defined custom values to be persistant? ` WiFiManagerParameter custom_User_ID("User_ID", "Used ID", "", 30); WiFiManagerParameter custom_Bot_Token("Bot_Token", "BOT token", "", 46); wm.addParameter(&custom_User_ID); wm.addParameter(&custom_Bot_Token); ` This is my example of the values I want to keep across reboots/resets, does the library allows for this, or I need to write/retrieve them by myself from say EEPROM? Thanks
kerem 2026-02-28 01:29:29 +03:00
  • closed this issue
  • added the
    Question
    label
Author
Owner

@tablatronix commented on GitHub (Nov 28, 2022):

you need to save them to fs yourself

<!-- gh-comment-id:1329802133 --> @tablatronix commented on GitHub (Nov 28, 2022): you need to save them to fs yourself
Author
Owner

@pablopeu commented on GitHub (Nov 29, 2022):

solved it by using the Effortless SPIFFS library (https://github.com/thebigpotatoe/Effortless-SPIFFS)

`
String usid = custom_User_ID.getValue();
String toke = custom_Bot_Token.getValue();

if (usid !=""){
fileSystem.saveToFile("/usid.txt", usid);
}
if (usid ==""){
fileSystem.openFromFile("/usid.txt", usid);
userid = usid.toInt(); //userid is global
}

if (toke !=""){
fileSystem.saveToFile("/toke.txt", toke);
}
if (toke ==""){
fileSystem.openFromFile("/toke.txt", toke);
toke.toCharArray(buf, 80); // char token[80] is global
}`

<!-- gh-comment-id:1330005354 --> @pablopeu commented on GitHub (Nov 29, 2022): solved it by using the Effortless SPIFFS library (https://github.com/thebigpotatoe/Effortless-SPIFFS) ` String usid = custom_User_ID.getValue(); String toke = custom_Bot_Token.getValue(); if (usid !=""){ fileSystem.saveToFile("/usid.txt", usid); } if (usid ==""){ fileSystem.openFromFile("/usid.txt", usid); userid = usid.toInt(); //userid is global } if (toke !=""){ fileSystem.saveToFile("/toke.txt", toke); } if (toke ==""){ fileSystem.openFromFile("/toke.txt", toke); toke.toCharArray(buf, 80); // char token[80] is global }`
Author
Owner

@tablatronix commented on GitHub (Nov 29, 2022):

Consider using littlefs, spiffs has been deprecated

<!-- gh-comment-id:1330715477 --> @tablatronix commented on GitHub (Nov 29, 2022): Consider using littlefs, spiffs has been deprecated
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#1303
No description provided.