Oprava padu ESP32 pri pokusu o iskani adresy pres DHCP (odkaz na popis chyby do githubu je v kodu)
This commit is contained in:
parent
8a95f6d69b
commit
349bc68180
@ -700,6 +700,7 @@ wificonfigresult_t WiFiConfig::_setupAP(wificonfig_cb cb)
|
|||||||
WiFi.disconnect(); // pro jistotu se odpojime
|
WiFi.disconnect(); // pro jistotu se odpojime
|
||||||
// WiFi.mode(WIFI_AP);
|
// WiFi.mode(WIFI_AP);
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
WiFi.softAPConfig(apIP, apIP, netMsk);
|
WiFi.softAPConfig(apIP, apIP, netMsk);
|
||||||
if (ssid.endsWith(F("?"))) {
|
if (ssid.endsWith(F("?"))) {
|
||||||
char lmac[16];
|
char lmac[16];
|
||||||
@ -710,7 +711,17 @@ wificonfigresult_t WiFiConfig::_setupAP(wificonfig_cb cb)
|
|||||||
WiFi.softAP(ssid.c_str(), NULL, SETUP_CHANNEL);
|
WiFi.softAP(ssid.c_str(), NULL, SETUP_CHANNEL);
|
||||||
WiFi.mode(WIFI_AP);
|
WiFi.mode(WIFI_AP);
|
||||||
delay(500); // dulezite - jinak se nevraci spravna IP adresa !!! (udajne od verze 2.3.0 uz neni nutne)
|
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->setErrorReplyCode(DNSReplyCode::NoError);
|
||||||
dnsServer->start(DNS_PORT, "*", WiFi.softAPIP()); // spustime tzv. Captive portal - vsechny DNS dotazy jsou smerovany na nasi ip adresu
|
dnsServer->start(DNS_PORT, "*", WiFi.softAPIP()); // spustime tzv. Captive portal - vsechny DNS dotazy jsou smerovany na nasi ip adresu
|
||||||
if (cb)
|
if (cb)
|
||||||
|
Loading…
Reference in New Issue
Block a user