Skip to content

Smart config will not reconnect automatically after restart #810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bill-orange opened this issue Nov 5, 2017 · 4 comments
Closed

Smart config will not reconnect automatically after restart #810

bill-orange opened this issue Nov 5, 2017 · 4 comments

Comments

@bill-orange
Copy link

Hardware:

Board: ESP32 Wemos
Core Installation/update date: not sure, latest, I think
IDE name: Arduino IDE
Flash Frequency: 80Mhz
Upload Speed: 115200

Description:

SmartConfig behave differently on ESP32 than ESP8266. Both connect using the phone APP just fine. Upon a restart the ESP8266 will reconnect. The ESP32 will not reconnect and will search until I use the phone APP again to provide credentials.

Shouldn't they behave the same and reconnect? Could there be something in my ESP32 code inhibiting re-connection?

Sketch:

Standard examples embedded in my lengthy sketch.

/

@bill-orange
Copy link
Author

bill-orange commented Nov 5, 2017

I added:

sta_conf->bssid_set = 0;

to the .cpp file and recompiled. It made no difference. If I reset the ESP32 it searches forever until I use the phone app. Is there any else I need to do to effect the change? I started testing from an esptool erase, just to be fair :) I presume that the intended behavior would be that the SSID and PASSWORD would be preserved on a esp.restart call or on a reboot button press. On power loss, the credentials would be lost. That's how the ESP8266 version seems to work. It sure would be nice if a flag could be set to preserve the credentials in EEPROM for a power loss, if desired. I can see how this would be a security risk in some situations, however.

Here's my connect function:

void setupWiFi () {
/* Set ESP32 to WiFi Station mode /
WiFi.mode(WIFI_AP_STA);
/ start SmartConfig */
WiFi.beginSmartConfig();

/* Wait for SmartConfig packet from mobile */
Serial.println("Waiting for SmartConfig.");
while (!WiFi.smartConfigDone()) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("SmartConfig done.");

/* Wait for WiFi to connect to AP */
Serial.println("Waiting for WiFi");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("WiFi Connected.");
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
}

Here's verbose debug:

entry 0x40078a3c
[D][WiFiGeneric.cpp:265] _eventCallback(): Event: 14 - AP_STACONNECTED
[D][WiFiGeneric.cpp:265] _eventCallback(): Event: 14 - AP_STACONNECTED
[D][WiFiGeneric.cpp:265] _eventCallback(): Event: 14 - AP_STACONNECTED
Waiting for SmartConfig.
.........[D][WiFiSTA.cpp:621] _smartConfigCallback(): Status: FIND_CHANNEL
.....................................................................

@bill-orange
Copy link
Author

bill-orange commented Nov 10, 2017

I think we can close this issue. I still think, that as an objective, smartConfig should behave the same on an ESP32 as it does on an ESP8266 for software portability.

@johnty
Copy link

johnty commented Feb 13, 2018

any updates on this? would be great if this could work the same as the esp8266!

@NareshDealer
Copy link

I m having similar problem.. where the ssid and password is not getting stored and i need to resupply the ssid and password.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants