Update CaptivePortal.ino (#4080)

* Update CaptivePortal.ino

Illegal SSID used for SoftAP

* Fixed ordering problem.  Now actually works
This commit is contained in:
lbernstone 2020-09-30 06:26:15 -06:00 committed by GitHub
parent b7c5e502e7
commit f30edd040e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
#include <DNSServer.h> #include <DNSServer.h>
const byte DNS_PORT = 53; const byte DNS_PORT = 53;
IPAddress apIP(192, 168, 1, 1); IPAddress apIP(8,8,4,4); // The default android DNS
DNSServer dnsServer; DNSServer dnsServer;
WiFiServer server(80); WiFiServer server(80);
@ -12,11 +12,9 @@ String responseHTML = ""
"be redirected here.</p></body></html>"; "be redirected here.</p></body></html>";
void setup() { void setup() {
WiFi.disconnect(); //added to start with the wifi off, avoid crashing
WiFi.mode(WIFI_OFF); //added to start with the wifi off, avoid crashing
WiFi.mode(WIFI_AP); WiFi.mode(WIFI_AP);
WiFi.softAP("ESP32-DNSServer");
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)); WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
WiFi.softAP("DNSServer CaptivePortal example");
// if DNSServer is started with "*" for domain name, it will reply with // if DNSServer is started with "*" for domain name, it will reply with
// provided IP to all DNS request // provided IP to all DNS request