Oprava padu ESP32 pri pokusu o iskani adresy pres DHCP (odkaz na popis chyby do githubu je v kodu)

This commit is contained in:
Pavel Brychta 2020-04-07 07:30:51 +02:00
parent 8a95f6d69b
commit 349bc68180

View File

@ -700,6 +700,7 @@ wificonfigresult_t WiFiConfig::_setupAP(wificonfig_cb cb)
WiFi.disconnect(); // pro jistotu se odpojime
// WiFi.mode(WIFI_AP);
#if defined(ARDUINO_ARCH_ESP8266)
WiFi.softAPConfig(apIP, apIP, netMsk);
if (ssid.endsWith(F("?"))) {
char lmac[16];
@ -710,7 +711,17 @@ wificonfigresult_t WiFiConfig::_setupAP(wificonfig_cb cb)
WiFi.softAP(ssid.c_str(), NULL, SETUP_CHANNEL);
WiFi.mode(WIFI_AP);
delay(500); // dulezite - jinak se nevraci spravna IP adresa !!! (udajne od verze 2.3.0 uz neni nutne)
#else
// osetreni padu ESP32 - https://github.com/espressif/arduino-esp32/issues/2025
if (ssid.endsWith(F("?"))) {
char lmac[16];
sprintf_P(lmac, PSTR("%06X"), ESP_getChipId());
ssid.replace(F("?"), String(lmac));
}
WiFi.softAP(ssid.c_str(), NULL, SETUP_CHANNEL);
WiFi.softAPConfig(apIP, apIP, netMsk);
#endif
dnsServer->setErrorReplyCode(DNSReplyCode::NoError);
dnsServer->start(DNS_PORT, "*", WiFi.softAPIP()); // spustime tzv. Captive portal - vsechny DNS dotazy jsou smerovany na nasi ip adresu
if (cb)