mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 21:01:25 +01:00
wifi 2nd try kludge
This commit is contained in:
parent
3aef54c0fe
commit
bdd87e7399
@ -21,6 +21,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
#include "esp_wifi.h"
|
||||||
#include "WifiESP32.h"
|
#include "WifiESP32.h"
|
||||||
#include "DIAG.h"
|
#include "DIAG.h"
|
||||||
#include "RingStream.h"
|
#include "RingStream.h"
|
||||||
@ -110,6 +111,21 @@ bool WifiESP::setup(const char *SSid,
|
|||||||
wifiUp = true;
|
wifiUp = true;
|
||||||
} else {
|
} else {
|
||||||
DIAG(F("Could not connect to Wifi SSID %s"),SSid);
|
DIAG(F("Could not connect to Wifi SSID %s"),SSid);
|
||||||
|
DIAG(F("Forcing one more Wifi restart"));
|
||||||
|
esp_wifi_start();
|
||||||
|
esp_wifi_connect();
|
||||||
|
tries=40;
|
||||||
|
while (WiFi.status() != WL_CONNECTED && tries) {
|
||||||
|
Serial.print('.');
|
||||||
|
tries--;
|
||||||
|
delay(500);
|
||||||
|
}
|
||||||
|
if (WiFi.status() == WL_CONNECTED) {
|
||||||
|
DIAG(F("Wifi STA IP 2nd try %s"),WiFi.localIP().toString().c_str());
|
||||||
|
wifiUp = true;
|
||||||
|
} else {
|
||||||
|
DIAG(F("Fail 2nd try"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!haveSSID) {
|
if (!haveSSID) {
|
||||||
|
Loading…
Reference in New Issue
Block a user