Captive-Function now as #define
This commit is contained in:
parent
dcfec5e759
commit
697afa3abc
10
src/main.cpp
10
src/main.cpp
@ -1,7 +1,9 @@
|
||||
#include <Arduino.h>
|
||||
#include <TM1637Display.h>
|
||||
#include <Ticker.h>
|
||||
#ifdef CAPTIVE
|
||||
#include <DNSServer.h>
|
||||
#endif
|
||||
#ifdef ESP32
|
||||
#include <WiFi.h>
|
||||
#include <AsyncTCP.h>
|
||||
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user