stupid c++ macros
This commit is contained in:
tablatronix
2020-05-19 10:58:10 -05:00
parent 634fac4be0
commit d71a14194b
3 changed files with 19 additions and 15 deletions
+13 -11
View File
@@ -302,9 +302,9 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) {
if((String)_hostname != ""){
#ifdef ESP8266
DEBUG_WM(DEBUG_DEV,"hostname: STA",WiFi.hostname());
DEBUG_WM(DEBUG_DEV,"hostname: STA: ",WiFi.hostname());
#elif defined(ESP32)
DEBUG_WM(DEBUG_DEV,"hostname: STA",WiFi.getHostname());
DEBUG_WM(DEBUG_DEV,"hostname: STA: ",WiFi.getHostname());
#endif
}
@@ -326,16 +326,17 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) {
}
bool WiFiManager::setupHostname(bool restart){
DEBUG_WM(DEBUG_VERBOSE,"Setting hostname:",_hostname);
if((String)_hostname == "") {
DEBUG_WM(DEBUG_VERBOSE,"No Hostname to set");
DEBUG_WM(DEBUG_DEV,"No Hostname to set");
return false;
}
} else DEBUG_WM(DEBUG_DEV,"setupHostname: ",_hostname);
bool res = true;
#ifdef ESP8266
DEBUG_WM(DEBUG_VERBOSE,"Setting WiFi hostname");
res = WiFi.hostname(_hostname);
#ifdef ESP8266MDNS_H
DEBUG_WM(DEBUG_VERBOSE,"Setting MDNS hostname");
// #ifdef ESP8266MDNS_H
#ifdef WM_MDNS
DEBUG_WM(DEBUG_VERBOSE,"Setting MDNS hostname, tcp 80");
if(MDNS.begin(_hostname)){
MDNS.addService("http", "tcp", 80);
}
@@ -344,8 +345,9 @@ bool WiFiManager::setupHostname(bool restart){
// @note hostname must be set after STA_START
delay(200); // do not remove, give time for STA_START
res = WiFi.setHostname(_hostname);
#ifdef ESP32MDNS_H
DEBUG_WM(DEBUG_VERBOSE,"Setting MDNS hostname");
// #ifdef ESP32MDNS_H
#ifdef WM_MDNS
DEBUG_WM(DEBUG_VERBOSE,"Setting MDNS hostname, tcp 80");
if(MDNS.begin(_hostname)){
MDNS.addService("http", "tcp", 80);
}
@@ -431,7 +433,7 @@ bool WiFiManager::startAP(){
DEBUG_WM(DEBUG_VERBOSE,"setting softAP Hostname:",_hostname);
bool res = WiFi.softAPsetHostname(_hostname);
if(!res)DEBUG_WM(DEBUG_ERROR,F("[ERROR] hostname: AP set failed!"));
DEBUG_WM(DEBUG_DEV,F("hostname: AP"),WiFi.softAPgetHostname());
DEBUG_WM(DEBUG_DEV,F("hostname: AP: "),WiFi.softAPgetHostname());
}
#endif
@@ -1343,7 +1345,7 @@ void WiFiManager::handleWiFiStatus(){
handleRequest();
String page;
// String page = "{\"result\":true,\"count\":1}";
#ifdef JSTEST
#ifdef WM_JSTEST
page = FPSTR(HTTP_JS);
#endif
server->sendHeader(FPSTR(HTTP_HEAD_CL), String(page.length()));
+5 -3
View File
@@ -22,11 +22,14 @@
#include <vector>
// #define WM_MDNS // also set MDNS with sethostname
// #define WM_MDNS // includes MDNS, also set MDNS with sethostname
// #define WM_FIXERASECONFIG // use erase flash fix
// #define WM_ERASE_NVS // esp32 erase(true) will erase NVS
// #define WM_RTC // esp32 info page will include reset reasons
// #define WM_JSTEST // build flag for enabling js xhr tests
// #define WIFI_MANAGER_OVERRIDE_STRINGS // build flag for using own strings include
#ifdef ARDUINO_ESP8266_RELEASE_2_3_0
#warning "ARDUINO_ESP8266_RELEASE_2_3_0, some WM features disabled"
#define WM_NOASYNC // esp8266 no async scan wifi
@@ -67,7 +70,7 @@
#include <WebServer.h>
#else
#include <ESP8266WebServer.h>
// Forthcoming official ?
// Forthcoming official ? probably never happening
// https://github.com/esp8266/ESPWebServer
#endif
#endif
@@ -85,7 +88,6 @@
#include <rom/rtc.h>
#endif
#else
#endif
+1 -1
View File
@@ -124,7 +124,7 @@ const char HTTP_HELP[] PROGMEM =
"</table>"
"<p/>More information about WiFiManager at <a href='https://github.com/tzapu/WiFiManager'>https://github.com/tzapu/WiFiManager</a>.";
#ifdef JSTEST
#ifdef WM_JSTEST
const char HTTP_JS[] PROGMEM =
"<script>function postAjax(url, data, success) {"
" var params = typeof data == 'string' ? data : Object.keys(data).map("