Fixed #541 - Work around to bug in espressif softap event handler

1.2-legacy
Jm Casler 2020-12-12 22:37:07 -08:00
rodzic 46781357df
commit 86952c5456
3 zmienionych plików z 24 dodań i 7 usunięć

Wyświetl plik

@ -1009,12 +1009,15 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
- WL_NO_SHIELD: assigned when no WiFi shield is present; - WL_NO_SHIELD: assigned when no WiFi shield is present;
*/ */
if (WiFi.status() == WL_CONNECTED || isSoftAPForced()) { if (WiFi.status() == WL_CONNECTED || isSoftAPForced() || radioConfig.preferences.wifi_ap_mode) {
if (radioConfig.preferences.wifi_ap_mode || isSoftAPForced()) { if (radioConfig.preferences.wifi_ap_mode || isSoftAPForced()) {
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.softAPIP().toString().c_str())); display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.softAPIP().toString().c_str()));
} else { } else {
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.localIP().toString().c_str())); display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "IP: " + String(WiFi.localIP().toString().c_str()));
} }
display->drawString(x + SCREEN_WIDTH - display->getStringWidth("(" + String(WiFi.softAPgetStationNum()) + "/4)"),
y + FONT_HEIGHT_SMALL * 1, "(" + String(WiFi.softAPgetStationNum()) + "/4)");
} else if (WiFi.status() == WL_NO_SSID_AVAIL) { } else if (WiFi.status() == WL_NO_SSID_AVAIL) {
display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "SSID Not Found"); display->drawString(x, y + FONT_HEIGHT_SMALL * 1, "SSID Not Found");
} else if (WiFi.status() == WL_CONNECTION_LOST) { } else if (WiFi.status() == WL_CONNECTION_LOST) {

Wyświetl plik

@ -178,9 +178,10 @@ void createSSLCert()
NULL); /* Task handle. */ NULL); /* Task handle. */
DEBUG_MSG("Waiting for SSL Cert to be generated.\n"); DEBUG_MSG("Waiting for SSL Cert to be generated.\n");
if (isCertReady) { while (!isCertReady) {
DEBUG_MSG(".\n"); DEBUG_MSG(".");
delayMicroseconds(1000); delay(1000);
yield();
} }
DEBUG_MSG("SSL Cert Ready!\n"); DEBUG_MSG("SSL Cert Ready!\n");
} }

Wyświetl plik

@ -23,6 +23,8 @@ char ourHost[16];
bool forcedSoftAP = 0; bool forcedSoftAP = 0;
bool APStartupComplete = 0;
bool isSoftAPForced() bool isSoftAPForced()
{ {
return forcedSoftAP; return forcedSoftAP;
@ -41,6 +43,10 @@ bool isWifiAvailable()
// strcpy(radioConfig.preferences.wifi_ssid, ""); // strcpy(radioConfig.preferences.wifi_ssid, "");
// strcpy(radioConfig.preferences.wifi_password, ""); // strcpy(radioConfig.preferences.wifi_password, "");
// strcpy(radioConfig.preferences.wifi_ssid, "meshtasticAdmin");
// strcpy(radioConfig.preferences.wifi_password, "12345678");
// radioConfig.preferences.wifi_ap_mode = true;
if (*wifiName && *wifiPsw) { if (*wifiName && *wifiPsw) {
return 1; return 1;
} else { } else {
@ -239,9 +245,16 @@ static void WiFiEvent(WiFiEvent_t event)
DEBUG_MSG("WiFi access point started\n"); DEBUG_MSG("WiFi access point started\n");
Serial.println(WiFi.softAPIP()); Serial.println(WiFi.softAPIP());
// Start web server if (!APStartupComplete) {
initWebServer(); // Start web server
initApiServer(); DEBUG_MSG("... Starting network services\n");
initWebServer();
initApiServer();
APStartupComplete = true;
} else {
DEBUG_MSG("... Not starting network services\n");
}
break; break;
case SYSTEM_EVENT_AP_STOP: case SYSTEM_EVENT_AP_STOP: