diff --git a/src/WiFiConfig.cpp b/src/WiFiConfig.cpp index 953d592..9b8797f 100644 --- a/src/WiFiConfig.cpp +++ b/src/WiFiConfig.cpp @@ -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)