Skip to content

Commit b9e6c4f

Browse files
authored
Workaround unsecure AP bug on restart. (#1343)
1 parent 4bbdead commit b9e6c4f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

main/main.ino

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,12 +1273,24 @@ void setup_wifimanager(bool reset_settings) {
12731273
InfoIndicatorON();
12741274
ErrorIndicatorON();
12751275
Log.notice(F("Connect your phone to WIFI AP: %s with PWD: %s" CR), WifiManager_ssid, WifiManager_password);
1276+
12761277
//fetches ssid and pass and tries to connect
12771278
//if it does not connect it starts an access point with the specified name
12781279
//and goes into a blocking loop awaiting configuration
12791280
if (!wifiManager.autoConnect(WifiManager_ssid, WifiManager_password)) {
12801281
Log.warning(F("failed to connect and hit timeout" CR));
12811282
delay(3000);
1283+
1284+
# ifdef ESP32
1285+
/* Workaround for bug in arduino core that causes the AP to become unsecure on reboot */
1286+
esp_wifi_set_mode(WIFI_MODE_AP);
1287+
esp_wifi_start();
1288+
wifi_config_t conf;
1289+
esp_wifi_get_config(WIFI_IF_AP, &conf);
1290+
conf.ap.ssid_hidden = 1;
1291+
esp_wifi_set_config(WIFI_IF_AP, &conf);
1292+
# endif
1293+
12821294
//reset and try again
12831295
watchdogReboot(3);
12841296
delay(5000);

0 commit comments

Comments
 (0)