Remove captive portal DNS — serve site normally at 192.168.4.1

Made-with: Cursor
This commit is contained in:
drjones
2026-04-03 09:45:57 -07:00
parent 4e581954bb
commit 4d5429f990

View File

@@ -10,7 +10,6 @@
#include <RadioLib.h> #include <RadioLib.h>
#include <WiFi.h> #include <WiFi.h>
#include <WebServer.h> #include <WebServer.h>
#include <DNSServer.h>
#include <ESPmDNS.h> #include <ESPmDNS.h>
#include <ArduinoOTA.h> #include <ArduinoOTA.h>
#include "driver/gpio.h" #include "driver/gpio.h"
@@ -36,7 +35,6 @@ CC1101 radio1(&mod1);
CC1101 radio2(&mod2); CC1101 radio2(&mod2);
static WebServer server(WEB_PORT); static WebServer server(WEB_PORT);
static DNSServer dnsServer;
static Preferences preferences; static Preferences preferences;
// CC1101 valid discrete power levels in dBm (RadioLib only accepts these exact values) // CC1101 valid discrete power levels in dBm (RadioLib only accepts these exact values)
@@ -2544,8 +2542,7 @@ static void handleCaptureWave() {
} }
static void handleNotFound() { static void handleNotFound() {
server.sendHeader("Location", "http://192.168.4.1/"); server.send(404, "text/plain", "404: Not found");
server.send(302, "text/plain", "Redirect");
} }
static void handleSelfTest() { static void handleSelfTest() {
@@ -2718,9 +2715,6 @@ void setup() {
server.onNotFound(handleNotFound); server.onNotFound(handleNotFound);
server.begin(); server.begin();
dnsServer.start(53, "*", WiFi.softAPIP());
logLine("[DNS] Captive portal DNS on *:53 → " + WiFi.softAPIP().toString());
// OTA firmware updates over WiFi (connect to 'killer' AP, upload via PlatformIO OTA) // OTA firmware updates over WiFi (connect to 'killer' AP, upload via PlatformIO OTA)
ArduinoOTA.setHostname("killer"); ArduinoOTA.setHostname("killer");
ArduinoOTA.setPassword("killerpw"); ArduinoOTA.setPassword("killerpw");
@@ -2746,7 +2740,6 @@ void setup() {
} }
void loop() { void loop() {
dnsServer.processNextRequest();
espNowTick(); espNowTick();
ArduinoOTA.handle(); ArduinoOTA.handle();
server.handleClient(); server.handleClient();