mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1213] Can't reconnect with waitForConnectResult after disconnect #1035
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#1035
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 @Primus007 on GitHub (Feb 15, 2021).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1213
Basic Infos
Arduino IDE 1.8.13
Hardware
WiFimanager Branch/Release:
Esp8266/Esp32:
Hardware: ESP-12e, esp01, esp25
ESP Core Version: 2.4.0, staging
Description
I use your WifiManager to connect to my home Network. It works fine. But after i get some infos from the internet i disconnect the wifi in my Code. it should reconnect if i press a button. but if i do that, always the AP Config mode fires up and i get the error: [ERROR] wifi begin failed
Settings in IDE
Module: Wemos D1 & R2 mini
Additional libraries:
Sketch
The serial result:
First connect:
conn_result: 3
Wifi is connected!
Wifi Disconnected
Try to RECONNECT to wifi SSID: InProg1
Is WiFi Configured and saved: YES
SSID: InProg1
conn_result: 0
Wifi is NOT connected!
I use the WiFi.waitForConnectResult(10000); method because i want limit the waiting time to connect (10 Seconds).
The first connect works fine. But if i disconnect an try to connect again with the same method as before, then no connection is possible. The result is: WL_IDLE_STATUS.
Why can i not connect again with the same method as before after a disconnect?
Is it impossible? Is there another way to reconnect to the same wifi with a limit time method for connection?
Thank's for Help.
@tablatronix commented on GitHub (Feb 15, 2021):
Try a non persistent disconnect first, stuff gets stuck in esp and I suspect there are some lib bugs or sdk bugs atm.
wm.disconnect();
Or try connecting twice, another esp bug
@Primus007 commented on GitHub (Feb 15, 2021):
A second try to connect again does not solve the problem.
How do i an non persistent disconnect?
@tablatronix commented on GitHub (Feb 15, 2021):
using the wm func i pasted above
@Primus007 commented on GitHub (Feb 15, 2021):
I use wm.disconnect(); for disconnect . You can see it in the code in my first post.
At first i connect with: WiFi.waitForConnectResult(10000);
Then a delay
Then wm.disconnect();
and then again
WiFi.waitForConnectResult(10000);
The first connect works fine, the second not. Why?
What are the alternatives for a reconnect to the saved wifi with a connection timeout eg waitForConnectResult(10000)?
@tablatronix commented on GitHub (Feb 16, 2021):
Ah sorry did not see that not sure whats going on
@tablatronix commented on GitHub (Feb 16, 2021):
Ill see what mine does, maybe try a diff version for esp?
@Primus007 commented on GitHub (Feb 16, 2021):
I have tryed Core v2.7.0 - .4 always the same problem. Arduino sdk or Visual Studio always the same problem.
I have also tryed the latest Wifimanager master version. Same problem.
the result of 3 trying to connect again after the disconnect with debug messages. you see after the disonnect are no new debug messages.
try to connect to wifi SSID: Inprog111
Is WiFi Configured and saved: YES
SSID: Inprog111
wifi evt: 2
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 11
cnt
connected with Inprog111, channel 5
dhcp client start...
wifi evt: 0
ip:192.168.1.75,mask:255.255.255.0,gw:192.168.1.1
wifi evt: 3
conn_result: 3
Wifi is connected!
*WM: [1] Disconnecting
state: 5 -> 0 (0)
rm 0
Wifi Disconnected
wifi evt: 1
STA disconnect: 8
first try
Try to RECONNECT to wifi SSID: Inprog111
Is WiFi Configured and saved: YES
SSID: Inprog111
conn_result: 0
Wifi is NOT connected!
Second try
Try to RECONNECT to wifi SSID: Inprog111
Is WiFi Configured and saved: YES
SSID: Inprog111
conn_result: 0
Wifi is NOT connected!
third try
Try to RECONNECT to wifi SSID: Inprog111
Is WiFi Configured and saved: YES
SSID: Inprog111
conn_result: 0
Wifi is NOT connected!
@tablatronix commented on GitHub (Feb 16, 2021):
Where are you actually starting wifi ?
@Primus007 commented on GitHub (Feb 16, 2021):
I have startet the wifimanager config portal and setup my wifi one times.
In the sketch from my first post is no start wifi. it is all what you see in my first post.
I use this line
int conn_result = WiFi.waitForConnectResult(10000); // connect try it for 10 secondsto connect to the bevore saved wifi. I use this because i want to continue my program if the wifi is not available. a wifi connection is not absolutely necessary for my program
How should i start wifi? WiFi.begin need ssid and password. i want to connect to the saved WiFi.
@tablatronix commented on GitHub (Feb 16, 2021):
WiFi.begin() or wm autoconnect
That just waits for the result to change, it should be in a loop, you should relook at examples as this is wrong
@Primus007 commented on GitHub (Feb 16, 2021):
Many thanks you for your help. Now it's working.
I didn't know that it was just waiting for the result. I was confused that it connected at the first try.