diff --git a/src/main.cpp b/src/main.cpp index 975df02..b6ab42f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,9 @@ #include #include #include +#ifdef CAPTIVE #include +#endif #ifdef ESP32 #include #include @@ -41,7 +43,9 @@ TM1637Display disp_FAC_1(CLK, DIO_FAC_1_7SEG); TM1637Display disp_FAC_2(CLK, DIO_FAC_2_7SEG); TM1637Display disp_FAC_3(CLK, DIO_FAC_3_7SEG); +#ifdef CAPTIVE DNSServer dnsServer; +#endif AsyncWebServer server(80); Ticker FactionTicker(FactionTicker_callback, 500, 0, MILLIS); @@ -261,8 +265,9 @@ void setup() stationConnectedHandler = WiFi.onSoftAPModeStationConnected(&onStationConnected); stationDisconnectedHandler = WiFi.onSoftAPModeStationDisconnected(&onStationDisconnected); +#ifdef CAPTIVE dnsServer.start(53, "*", WiFi.softAPIP()); - +#endif server.addHandler(new CaptiveRequestHandler()).setFilter(ON_AP_FILTER); //only when requested from AP server.begin(); @@ -277,7 +282,10 @@ void loop() SerialOutputTicker.update(); InputGetterTicker.update(); +#ifdef CAPTIVE dnsServer.processNextRequest(); +#endif + SevenSeg_Output(); while (Serial.available() > 0)