mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-20 01:41:28 +10:00
clean up defines, remove esp31b
This commit is contained in:
+8
-8
@@ -211,7 +211,7 @@ void WiFiManager::setupConfigPortal() {
|
||||
dnsServer.reset(new DNSServer());
|
||||
#ifdef ESP8266
|
||||
server.reset(new ESP8266WebServer(80));
|
||||
#elif defined(ESP31B) || defined(ESP32)
|
||||
#elif defined(ESP32)
|
||||
server.reset(new WebServer(80));
|
||||
#endif
|
||||
|
||||
@@ -1375,7 +1375,7 @@ String WiFiManager::encryptionTypeStr(uint8_t authmode) {
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
#elif defined(ESP31B) || defined(ESP32)
|
||||
#elif defined(ESP32)
|
||||
switch(authmode) {
|
||||
case WIFI_AUTH_OPEN:
|
||||
return "None";
|
||||
@@ -1408,7 +1408,7 @@ bool WiFiManager::WiFi_Mode(WiFiMode_t m,bool persistent) {
|
||||
ETS_UART_INTR_ENABLE();
|
||||
|
||||
return ret;
|
||||
#elif defined(ESP31B) || defined(ESP32)
|
||||
#elif defined(ESP32)
|
||||
return WiFi.mode(m); // @todo persistent not implemented?
|
||||
#endif
|
||||
}
|
||||
@@ -1427,7 +1427,7 @@ bool WiFiManager::WiFi_Disconnect() {
|
||||
ETS_UART_INTR_ENABLE();
|
||||
return ret;
|
||||
}
|
||||
#elif defined(ESP31B) || defined(ESP32)
|
||||
#elif defined(ESP32)
|
||||
DEBUG_WM(F("wifi station disconnect"));
|
||||
// @todo why does disconnect call these, might be needed
|
||||
// WiFi.getMode(); // @todo wifiLowLevelInit(), probably not needed, for save config only
|
||||
@@ -1453,7 +1453,7 @@ bool WiFiManager::WiFi_enableSTA(bool enable,bool persistent) {
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
#elif defined(ESP31B) || defined(ESP32)
|
||||
#elif defined(ESP32)
|
||||
return WiFi.mode(WIFI_STA); // @todo persistent not implemented?
|
||||
#endif
|
||||
}
|
||||
@@ -1487,7 +1487,7 @@ void WiFiManager::reboot(){
|
||||
uint8_t WiFiManager::WiFi_softap_num_stations(){
|
||||
#ifdef ESP8266
|
||||
return wifi_softap_get_station_num();
|
||||
#elif defined(ESP31B) || defined(ESP32)
|
||||
#elif defined(ESP32)
|
||||
return WiFi.softAPgetStationNum();
|
||||
#endif
|
||||
}
|
||||
@@ -1495,7 +1495,7 @@ uint8_t WiFiManager::WiFi_softap_num_stations(){
|
||||
bool WiFiManager::WiFi_hasAutoConnect(){
|
||||
#ifdef ESP8266
|
||||
return WiFi.SSID() != "";
|
||||
#elif defined(ESP31B) || defined(ESP32)
|
||||
#elif defined(ESP32)
|
||||
wifi_config_t conf;
|
||||
esp_wifi_get_config(WIFI_IF_STA, &conf);
|
||||
const char* ssid = reinterpret_cast<const char*>(conf.sta.ssid);
|
||||
@@ -1516,7 +1516,7 @@ void WiFiManager::WiFiEvent(WiFiEvent_t event){
|
||||
void WiFiManager::WiFi_autoReconnect(){
|
||||
#ifdef ESP8266
|
||||
WiFi.setAutoReconnect(_wifiAutoReconnect);
|
||||
#elif defined(ESP31B) || defined(ESP32)
|
||||
#elif defined(ESP31B)
|
||||
if(_wifiAutoReconnect){
|
||||
DEBUG_WM("ESP32 autoreconnect handler enabled");
|
||||
WiFi.onEvent(WiFiEvent);
|
||||
|
||||
+26
-25
@@ -13,34 +13,34 @@
|
||||
#ifndef WiFiManager_h
|
||||
#define WiFiManager_h
|
||||
|
||||
#define WEBSERVERSHIM // use webserver shim lib
|
||||
|
||||
#ifdef ESP8266
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#elif defined(ESP31B) || defined(ESP32)
|
||||
#include <WiFi.h>
|
||||
#include <WebServer.h>
|
||||
#include <esp_wifi.h>
|
||||
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
|
||||
#define WIFI_getChipId() ESP.getChipId()
|
||||
#define WIFI_AUTH_OPEN ENC_TYPE_NONE
|
||||
|
||||
#elif defined(ESP32)
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <WebServer.h>
|
||||
#include <esp_wifi.h>
|
||||
|
||||
#define WIFI_getChipId() (uint32_t)ESP.getEfuseMac()
|
||||
#define WIFI_AUTH_OPEN WIFI_AUTH_OPEN
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
#include <DNSServer.h>
|
||||
#include <memory>
|
||||
|
||||
#ifdef ESP8266
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ESP8266
|
||||
#define WIFI_getChipId() ESP.getChipId()
|
||||
#define WIFI_AUTH_OPEN ENC_TYPE_NONE
|
||||
#elif defined(ESP31B) || defined(ESP32)
|
||||
#define WIFI_getChipId() (uint32_t)ESP.getEfuseMac()
|
||||
#define WIFI_AUTH_OPEN WIFI_AUTH_OPEN
|
||||
#else
|
||||
#endif
|
||||
|
||||
const char HTTP_HEAD[] PROGMEM = "<!DOCTYPE html><html lang='en'><head><meta name='format-detection' content='telephone=no'><meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no'/><title>{v}</title>";
|
||||
// const char HTTP_STYLE[] PROGMEM = "<style>.c{text-align: center;} div,input{padding:5px;font-size:1em;} input{width:95%;} body{text-align: center;font-family:verdana;} button{border:0;border-radius:0.3rem;background-color:#1fa3ec;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%;} .q{float: right;width: 64px;text-align: right;} .l{background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAALVBMVEX///8EBwfBwsLw8PAzNjaCg4NTVVUjJiZDRUUUFxdiZGSho6OSk5Pg4eFydHTCjaf3AAAAZElEQVQ4je2NSw7AIAhEBamKn97/uMXEGBvozkWb9C2Zx4xzWykBhFAeYp9gkLyZE0zIMno9n4g19hmdY39scwqVkOXaxph0ZCXQcqxSpgQpONa59wkRDOL93eAXvimwlbPbwwVAegLS1HGfZAAAAABJRU5ErkJggg==') no-repeat left center;background-size: 1em;}</style>";
|
||||
const char HTTP_STYLE[] PROGMEM = "<style>"
|
||||
@@ -177,10 +177,11 @@ class WiFiManager
|
||||
|
||||
private:
|
||||
std::unique_ptr<DNSServer> dnsServer;
|
||||
#ifdef ESP8266
|
||||
std::unique_ptr<ESP8266WebServer> server;
|
||||
#elif defined(ESP31B) || defined(ESP32)
|
||||
std::unique_ptr<WebServer> server;
|
||||
|
||||
#if defined(ESP32) && defined(WEBSERVERSHIM)
|
||||
std::unique_ptr<WebServer> server;
|
||||
#else
|
||||
std::unique_ptr<ESP8266WebServer> server;
|
||||
#endif
|
||||
|
||||
//const int WM_DONE = 0;
|
||||
|
||||
Reference in New Issue
Block a user