We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WiFi.softAPConfig returns fail for non-debug build. Appears to work with the Debug port: Serial, Debug level: WIFI.
WiFi.softAPConfig
Part of the problem appears to be not setting enable in dhcp_lease before calling dhcpSoftAP.set_dhcps_lease:
enable
dhcp_lease
dhcpSoftAP.set_dhcps_lease
Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp
Lines 226 to 236 in 5c29517
// Modified CaptivePortal example #include <ESP8266WiFi.h> #include <DNSServer.h> #include <ESP8266WebServer.h> #define DBGLOG_FAIL(a, fmt, ...) do { if (!(a)) { Serial.printf_P( PSTR(fmt " line: %d, function: %S\r\n"), ##__VA_ARGS__, __LINE__, __FUNCTION__ ); } } while(false); const byte DNS_PORT = 53; IPAddress apIP(172, 217, 28, 1); DNSServer dnsServer; ESP8266WebServer webServer(80); String responseHTML = "" "<!DOCTYPE html><html lang='en'><head>" "<meta name='viewport' content='width=device-width'>" "<title>CaptivePortal</title></head><body>" "<h1>Hello World!</h1><p>This is a captive portal example." " All requests will be redirected here.</p></body></html>"; void setup() { WiFi.persistent(false); WiFi.mode(WIFI_OFF); Serial.begin(115200); delay(15); Serial.println(); Serial.println(); Serial.println("\r\ncalling: WiFi.mode(WIFI_AP)"); DBGLOG_FAIL(WiFi.mode(WIFI_AP), "Failed: WiFi.mode(WIFI_AP)"); Serial.println("\r\ncalling: WiFi.softAP(..."); DBGLOG_FAIL(WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)), "*** Failed: WiFi.softAPConfig(..."); Serial.println("\r\ncalling: WiFi.softAPConfig(..."); DBGLOG_FAIL(WiFi.softAP("DNSServer CaptivePortal example"), "Failed: WiFi.softAP(..."); dnsServer.start(DNS_PORT, "*", apIP); Serial.println("\r\nDNSServer CaptivePortal example running"); webServer.onNotFound([]() { webServer.send(200, "text/html", responseHTML); }); webServer.begin(); } void loop() { dnsServer.processNextRequest(); webServer.handleClient(); }
calling: WiFi.mode(WIFI_AP) calling: WiFi.softAP(... *** Failed: WiFi.softAPConfig(... line: 31, function: setup calling: WiFi.softAPConfig(... DNSServer CaptivePortal example running
The text was updated successfully, but these errors were encountered:
d-a-v
Successfully merging a pull request may close this issue.
Basic Infos
Platform
Settings in IDE
Problem Description
WiFi.softAPConfig
returns fail for non-debug build.Appears to work with the Debug port: Serial, Debug level: WIFI.
Part of the problem appears to be not setting
enable
indhcp_lease
before callingdhcpSoftAP.set_dhcps_lease
:Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp
Lines 226 to 236 in 5c29517
MCVE Sketch
Debug Messages
The text was updated successfully, but these errors were encountered: