mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #892] storeSTAmode and persistent(true) / (false) #756
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#756
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ortegafernando on GitHub (May 29, 2019).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/892
Hi, I am using since last week the ota branch. (I have check development source code and for this question is the same)
After configuring my wemos with wifimanager, it we reset it I get this serial output with "wm.debugPlatformInfo();"
After checking source code, I can see how wifimanager uses persistent(false) and (true) to get managed not to corrupt flash memory.
But I can see here these two lines:
It is because storeSTAmode variable is set to true in wifimanager.h.
Then, I understand that everytime the ESP8266 begins/resets it will write once to flash.
It is not an issue but I want to understand the risk of brick my device because of corrupted flash vs setting storeSTAmode = false
Thanks a lot.
Basic Infos
Hardware
WiFimanager Branch/Release:
Esp8266/Esp32:
Hardware: ESP-12e, esp01, esp25
ESP Core Version: 2.4.0, staging
@tablatronix commented on GitHub (May 29, 2019):
Esp only saves flash if it differs, so no it should not matter, I think I added that to prevent saving the wifi if it fails or for testing the autoconnect autocp failover repeatedly.
Not sure what it is exactly you have a problem with or are trying to fix
@tablatronix commented on GitHub (May 29, 2019):
by brick your esp do you mean wear out the flash? There is no way to corrupt flash, aside from some esp bugs, you can always erase flash or reload a sketch..
@ortegafernando commented on GitHub (May 30, 2019):
Hi, it is about this two lines that I get in serial output every time ESP8266 boots or reset itself (for example after sleep):
It is because storeSTAmode variable is set to true in wifimanager.h, so we get "enableSTA PERSISTENT ON" so our ESP8266 chip saves in flash the STA mode.
As you say, you added (development branch) code to prevent saving the wifi credentials every time if they aren't changed (THANKS A LOT FOR THAT), but you can see that every time the esp8266 boots or reset it self (after sleep for example), we are saving to flash the STA mode.
Yesterday I checked your code (development branch and ota branch) and I finally finished to this function:
As you can see, with storeSTAmode == true, we finally call to "wifi_set_opmode", and not to "wifi_set_opmode_current". I have read that "wifi_set_opmode" saves mode to flash memory.
(check page 37 of https://www.espressif.com/sites/default/files/documentation/2c-esp8266_non_os_sdk_api_reference_en.pdf
So could it wil be bad/good to avoid that and put storeSTAmode = false? Why we need to save mode ?
I hope your understand me now, sorry for my bad explanations and english
@tablatronix commented on GitHub (May 31, 2019):
Hmm let me check, I see what you mean now. Good point
@ortegafernando commented on GitHub (May 31, 2019):
Thanks a lot to check it.
@tablatronix commented on GitHub (May 31, 2019):
I mean the espressif docs say it will "write to flash if changed" , to me this means it handles all flash writes and ignores them if not needed, But since we cannot see their code, I might just add a extra check to not save if already set to the same mode. Just in case.
Now I am curious, I might break out my scope and see if I can log flash writes on an esp board
@ortegafernando commented on GitHub (Jun 3, 2019):
I understand what you mean. Yes, it makes us doubt about if it is really flashing or not.
Any way ... is it neccesary ? Why we need to save the mode ?
I could change my WifiManager.h file, but I prefer to keepmy libraries as yours to get any update without any problem. (I am now using OTA branch).
If you think that it is not neccesary to save the WIFI MODE to flash, may we have to change WifiManager.h and change storeSTAmode to FALSE.
May be I don't understand correctly how wifimanager works, but I dont think that storeSTAmode has to be TRUE.
Regards,
@tablatronix commented on GitHub (Jun 3, 2019):
Well you have to set it at some point so esp auto-connect works