forked from Akcelerometry_drgania_WMT/PI_mikrokontroler
Dodanie Captive Portal z logarytmami
This commit is contained in:
@@ -9,13 +9,12 @@
|
||||
#include <WiFi.h>
|
||||
#include <WebServer.h>
|
||||
#include <ESPmDNS.h>
|
||||
#include <DNSServer.h>
|
||||
#elif defined(ESP8266)
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266mDNS.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#include <DNSServer.h>
|
||||
#endif
|
||||
|
||||
#include <DNSServer.h> // Dodano dla Captive Portal
|
||||
//#include <Pinout.h>
|
||||
//#include <IPAddress.h>
|
||||
//#include <WiFiUdp.h>
|
||||
@@ -28,11 +27,6 @@
|
||||
#include <functional>
|
||||
// OTA
|
||||
|
||||
#include "Display.h" // Dodano dla obsługi komunikatów na LCD
|
||||
|
||||
extern Config config; // Deklaracja zewnętrznej struktury config
|
||||
extern ConfigManager configManager; // Deklaracja zewnętrznego managera (to naprawi błąd)
|
||||
|
||||
class WiFiManager {
|
||||
public:
|
||||
WiFiManager();
|
||||
@@ -50,11 +44,11 @@ class WiFiManager {
|
||||
int rssiToPercent(int rssi); // rssi na procenty
|
||||
int8_t getRSSI();
|
||||
|
||||
/**
|
||||
* NOWA METODA: Portal konfiguracyjny (Captive Portal)
|
||||
* Uruchamiany automatycznie przy braku połączenia.
|
||||
*/
|
||||
void startConfigPortal(Display &display);
|
||||
void handleClient();
|
||||
void startCaptivePortal();
|
||||
void handleRoot();
|
||||
void handleSave();
|
||||
void handleNotFound();
|
||||
|
||||
/**
|
||||
* Aktualizacja systemu przez internet z adresu config.updateUrl.
|
||||
@@ -75,18 +69,10 @@ class WiFiManager {
|
||||
|
||||
private:
|
||||
bool isAccessPoint = false;
|
||||
|
||||
// Obiekty serwerów dla Portalu (ESP32/ESP8266)
|
||||
#ifdef ESP32
|
||||
bool captivePortalActive = false;
|
||||
WebServer server{80};
|
||||
#elif defined(ESP8266)
|
||||
ESP8266WebServer server{80};
|
||||
#endif
|
||||
DNSServer dnsServer;
|
||||
void handleRoot();
|
||||
void handleSave();
|
||||
int expectedCaptchaAnswer = 0;
|
||||
};
|
||||
|
||||
extern WiFiManager wifi;
|
||||
|
||||
#endif // WIFIMANAGER_H
|
||||
#endif // WIFIMANAGER_H
|
||||
|
||||
Reference in New Issue
Block a user