mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-28 09:35:49 +03:00
[GH-ISSUE #1260] Need to Disable Interrupt before Saving Credentials! #1080
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#1080
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 @vginside on GitHub (Jun 14, 2021).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1260
Dear Sir,
I have a problem! My node MCU keeps getting reset after i save my new wifi credentials from config page. I found the problem is happening because my Global interrupts are ON (Interrupts are occurring every 10ms and i need it ON even when it is in AP mode). When in AP mode and after i enter new wifi credentials after clicking save, NodeMCU wont save credentials and reset the chip! Normally when updating EEPROM if Global Interrupts are ON same problem happens! If i turn off global Interrupts this problem dont happen. Can you please fix this problem? Solution is easy actually I mean just before saving credentials in EEPROM you need to disable Interrupts(using "noInterrupts();") and after saved you need to re-enable Global Interrupts(using "interrupts();")! If you can really fix this problem!
Also I'm have no idea how to edit library, but if you can just guide me how to edit the code to disable global Interrupt and Enable global Interrupts just before you write in EEPROM WIFI credentials i can also do it on my own!
Deeply awaiting your reply!
Best Regards!
@tablatronix commented on GitHub (Jun 14, 2021):
WM does not write to EEPROM, the ESP library does. Sounds like a ESP issue.
@vginside commented on GitHub (Jun 14, 2021):
Dear Sir,
Thanks for you quick reply... But is there some way to disable interrupt before calling save then re-enable it after save successful? Deeply awaiting your reply.
Best Regards!
@tablatronix commented on GitHub (Jun 14, 2021):
I think the ESP library should handle this already, are you using a recent version?
There are callbacks available
@vginside commented on GitHub (Jun 14, 2021):
Dear Sir,
Thanks for you reply... I'm using alpha 2.0.3 latest one.. I'm new to arduino so i dont know how to edit library! Can you guide me or write me code to disable and re-enable the same? Deeply awaiting your reply.
Best Regards!
@tablatronix commented on GitHub (Jun 14, 2021):
I mean ESP, is your ESP library up to date?
@vginside commented on GitHub (Jun 14, 2021):
Dear Sir,
Yes it is latest! 3.0.0
Best Regards!
@tablatronix commented on GitHub (Jun 14, 2021):
@vginside commented on GitHub (Jun 15, 2021):
Dear Sir,
Sorry due to time zone difference i'm replying late... I tried with above code but still the same problem.
Function "presaveWifiCallback" callback is called and that too it is called twice but "saveWifiCallback" is never called!
Also i tried using just callback function, with never even enabling the interrupt to test if callback are called but still "saveWifiCallback" is not called.
I'm getting serial log when keeping interrupt enable as follows:
"
*WM: [1] AutoConnect
*WM: [1] No Credentials are Saved, skipping connect
*WM: [2] Starting Config Portal
*WM: [3] WiFi station enable
*WM: [2] Disabling STA
*WM: [2] Enabling AP
*WM: [1] StartAP with SSID: ESP_WIFI
*WM: [2] AP has anonymous access!
*WM: [1] SoftAP Configuration
*WM: [1] --------------------
*WM: [1] ssid: ESP_WIFI
*WM: [1] password:
*WM: [1] ssid_len: 8
*WM: [1] channel: 1
*WM: [1] authmode:
*WM: [1] ssid_hidden:
*WM: [1] max_connection: 4
*WM: [1] country: CN
*WM: [1] beacon_interval: 100(ms)
*WM: [1] --------------------
*WM: [1] AP IP address: 192.168.4.1
*WM: [3] setupConfigPortal
*WM: [1] Starting Web Portal
*WM: [3] dns server started with ip: 192.168.4.1
*WM: [2] HTTP server started
*WM: [2] WiFi Scan completed in 2184 ms
*WM: [2] Config Portal Running, blocking, waiting for clients...
*WM: [2] <- HTTP Root
*WM: [3] -> 192.168.4.1
*WM: [3] lastconxresult: WL_IDLE_STATUS
*WM: [2] Scan is cached 21014 ms ago
*WM: [3] -> mobilesecuritycore-detection.norton.com
*WM: [2] <- Request redirected to captive portal
*WM: [3] -> mobilesecuritycore-detection.norton.com
*WM: [2] <- Request redirected to captive portal
*WM: [3] -> mobilesecuritycore-detection.norton.com
*WM: [2] <- Request redirected to captive portal
*WM: [3] -> mobilesecuritycore-detection.norton.com
*WM: [2] <- Request redirected to captive portal
*WM: [3] -> mobilesecuritycore-detection.norton.com
*WM: [2] <- Request redirected to captive portal
*WM: [2] <- HTTP Root
*WM: [3] -> 192.168.4.1
*WM: [3] lastconxresult: WL_IDLE_STATUS
*WM: [2] Scan is cached 21563 ms ago
*WM: [2] <- HTTP Root
*WM: [3] -> 192.168.4.1
*WM: [3] lastconxresult: WL_IDLE_STATUS
*WM: [2] Scan is cached 21590 ms ago
*WM: [2] <- HTTP Root
*WM: [3] -> 192.168.4.1
*WM: [3] lastconxresult: WL_IDLE_STATUS
*WM: [2] Scan is cached 21614 ms ago
*WM: [2] <- HTTP Root
*WM: [3] -> 192.168.4.1
*WM: [3] lastconxresult: WL_IDLE_STATUS
*WM: [2] Scan is cached 21640 ms ago
*WM: [2] <- HTTP Root
*WM: [3] -> 192.168.4.1
*WM: [3] lastconxresult: WL_IDLE_STATUS
*WM: [2] Scan is cached 21672 ms ago
*WM: [3] -> mobilesecuritycore-detection.norton.com
*WM: [2] <- Request redirected to captive portal
*WM: [2] <- HTTP Root
*WM: [3] -> 192.168.4.1
*WM: [3] lastconxresult: WL_IDLE_STATUS
*WM: [2] Scan is cached 21716 ms ago
*WM: [2] Portal Timeout In 119 seconds
*WM: [2] <- HTTP Root
*WM: [3] -> 192.168.4.1
*WM: [3] lastconxresult: WL_IDLE_STATUS
*WM: [2] WiFi Scan completed in 2183 ms
*WM: [2] <- HTTP Wifi
*WM: [2] Scan is cached 3133 ms ago
*WM: [1] 11 networks found
*WM: [2] AP: -34 Gohil's-Home
*WM: [2] AP: -44 Gohil_Jio24G
*WM: [2] AP: -59 DADI 2
*WM: [2] AP: -78 shree radhe 2Ghz
*WM: [2] AP: -79 Express Wi-Fi by Facebook
*WM: [2] AP: -81 Jigar_4G
*WM: [2] AP: -83 Vinits Den 4g
*WM: [2] AP: -83 hiteshp_4g
*WM: [2] AP: -86 Ritesh508
*WM: [2] AP: -91 TP-LINK_8044_RPT
*WM: [2] AP: -93 Shreeji 2.4G
*WM: [3] lastconxresult: WL_IDLE_STATUS
*WM: [3] Sent config page
*WM: [2] Portal Timeout In 116 seconds
*WM: [2] <- HTTP WiFi save
*WM: [3] Method: POST
[CALLBACK] presaveCallback fired
[CALLBACK] presaveCallback fired
*WM: [3] Sent wifi save page
*WM: [2] processing save
*WM: [2] Connecting as wifi client...
*WM: [3] STA static IP:
*WM: [2] setSTAConfig static ip not set, skipping
*WM: [1] CONNECTED:
*WM: [1] Connecting to NEW AP: Gohil's-Home
*WM: [3] Using Password: (My password)
*WM: [3] WiFi station enable
*WM: [3] enableSTA PERSISTENT ON
*WM: [1] connectTimeout not set, ESP waitForConnectResult...
User exception (panic/abort/assert)
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
Panic core_esp8266_main.cpp:137 __yield
ctx: cont
sp: 3ffffad0 end: 3fffffc0 offset: 0000
"
Deeply awaiting your reply.
@vginside commented on GitHub (Jun 15, 2021):
Dear Sir,
Just to illustrate my problem, Attached is a cut down version of my code as given below.
All you need is an NODEMCU and a clock generator every 10millisec (which i have on external interrupt pin!) You will notice ESP reset issue: (ofc i dont use wm.resetSettings, but problem is same as saving wifi credentials).
Hope this helps you identify the problem if it with ESP or library! Deeply awaiting your reply.
Best Regards!
@tablatronix commented on GitHub (Jun 15, 2021):
Where are you setting your callbacks? wm.setPreSaveConfigCallback(presaveWifiCallback);
Also wm probably needs to be global
@vginside commented on GitHub (Jun 15, 2021):
Dear Sir,
I have updated the program as you suggested, but still it wont work update code is as given below:
Serial Output is as follows:
"Program Start/Reset
*WM: [1] resetSettings
*WM: [3] WiFi station enable
*WM: [3] enableSTA PERSISTENT ON
--------------- CUT HERE FOR EXCEPTION DECODER ---------------
Exception (0):
epc1=0x4020dac8 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000
ctx: cont
sp: 3ffffb80 end: 3fffffc0 offset: 0190
3ffffd10: 00000000 0000000a 3ffffd83 00000008
"
It will keep resetting the ESP infinite times! with same message over serial port over and over. It wont even start in AP mode unless i remove the external interrupt! As soon as external interrupt is unplugged the program would work normally. Deeply awaiting your reply!
Best Regards!
@tablatronix commented on GitHub (Jun 16, 2021):
esp8266?
@tablatronix commented on GitHub (Jun 16, 2021):
No clue,
Pretty sure you cannot disable interrupts when using wifi, but it shouldn't crash, remove the serial print from your int handler and use a flag to handle this instead