mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #200] _tryWPS = true; #161
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#161
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 @johnpica on GitHub (Jul 23, 2016).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/200
If I set _tryWPS = true;
and the WPS fails then the configuration of the access point doen't have an IP
_WM:
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 0
_WM: START WPS
*WM: END WPS
_WM: SET AP STA
Entered config mode
0.0.0.0
ESP13799641
*WM:
*WM: Configuring access point...
*WM: ESP13799641
_WM: AP IP address:
*WM: 0.0.0.0
*WM: HTTP server started
@tzapu commented on GitHub (Jul 24, 2016):
hi
this is exactly why i have not made the function public, have not found a way to make it work if it fails to connect yet
alex
@johnpica commented on GitHub (Jul 24, 2016):
Hi
I use this workaround... upload first the sketch example ESP8266WiFi/WifiAccessPoint
after I upload my sketch... It looks like if I do like this on my esp8266-13 I get IP if WPS fails
//WiFi.mode(WIFI_STA); //comment
delay(1000);
// Called to check if SSID and password has already been stored by previous WPS call.
// The SSID and password are stored in flash memory and will survive a full power cycle.
// Calling ("",""), i.e. with blank string parameters, appears to use these stored values.
WiFi.begin("","");
// Long delay required especially soon after power on.
delay(7000);
// Check if WiFi is already connected and if not, begin the WPS process.
if (WiFi.status() != WL_CONNECTED) {
Serial.println("\nAttempting wifi connection ...");
WiFi.beginWPSConfig();
// Another long delay required.
delay(3000);
if (WiFi.status() == WL_CONNECTED) {
Serial.println("Connected!");
Serial.println(WiFi.localIP());
Serial.println(WiFi.SSID());
Serial.println(WiFi.macAddress());
}
else {
Serial.println("Connection failed!");
//creem un captive AP
Serial.print("Configuring access point...");
//WiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wifiManager;
//reset settings - for testing
//wifiManager.resetSettings();
//set callback that gets called when connecting to previous WiFi fails, and enters Access Point mode
wifiManager.setAPCallback(configModeCallback);
//fetches ssid and pass and tries to connect
//if it does not connect it starts an access point with the specified name
//here "AutoConnectAP"
//and goes into a blocking loop awaiting configuration
if(!wifiManager.autoConnect()) {
Serial.println("failed to connect and hit timeout");
//reset and try again, or maybe put it to deep sleep
ESP.reset();
delay(1000);
}
}
else {
Serial.println("\nConnection already established.");
}
@johnpica commented on GitHub (Jul 24, 2016):
ignore my last comment... the problem now is that the WPS function is not working anymore.
@malebuffy commented on GitHub (Apr 29, 2017):
found a workaround..
make a fake connection before trying to reconnect with wifimanager after a failed wps connection
WiFi.begin("foobar",""); // make a failed connection