From 8d34744b2956672b56ee5c85af9952f634faa7be Mon Sep 17 00:00:00 2001 From: tablatronix <807787+tablatronix@users.noreply.github.com> Date: Sun, 8 May 2022 09:24:28 -0500 Subject: [PATCH] fixes #1414 added a prefix to macros --- WiFiManager.cpp | 28 ++++++++++++++-------------- WiFiManager.h | 30 +++++++++++++++--------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 31be71e..a1d41dd 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -601,22 +601,22 @@ void WiFiManager::setupHTTPServer(){ /* Setup httpd callbacks, web pages: root, wifi config pages, SO captive portal detectors and not found. */ // G macro workaround for Uri() bug https://github.com/esp8266/Arduino/issues/7102 - server->on(G(R_root), std::bind(&WiFiManager::handleRoot, this)); - server->on(G(R_wifi), std::bind(&WiFiManager::handleWifi, this, true)); - server->on(G(R_wifinoscan), std::bind(&WiFiManager::handleWifi, this, false)); - server->on(G(R_wifisave), std::bind(&WiFiManager::handleWifiSave, this)); - server->on(G(R_info), std::bind(&WiFiManager::handleInfo, this)); - server->on(G(R_param), std::bind(&WiFiManager::handleParam, this)); - server->on(G(R_paramsave), std::bind(&WiFiManager::handleParamSave, this)); - server->on(G(R_restart), std::bind(&WiFiManager::handleReset, this)); - server->on(G(R_exit), std::bind(&WiFiManager::handleExit, this)); - server->on(G(R_close), std::bind(&WiFiManager::handleClose, this)); - server->on(G(R_erase), std::bind(&WiFiManager::handleErase, this, false)); - server->on(G(R_status), std::bind(&WiFiManager::handleWiFiStatus, this)); + server->on(WM_G(R_root), std::bind(&WiFiManager::handleRoot, this)); + server->on(WM_G(R_wifi), std::bind(&WiFiManager::handleWifi, this, true)); + server->on(WM_G(R_wifinoscan), std::bind(&WiFiManager::handleWifi, this, false)); + server->on(WM_G(R_wifisave), std::bind(&WiFiManager::handleWifiSave, this)); + server->on(WM_G(R_info), std::bind(&WiFiManager::handleInfo, this)); + server->on(WM_G(R_param), std::bind(&WiFiManager::handleParam, this)); + server->on(WM_G(R_paramsave), std::bind(&WiFiManager::handleParamSave, this)); + server->on(WM_G(R_restart), std::bind(&WiFiManager::handleReset, this)); + server->on(WM_G(R_exit), std::bind(&WiFiManager::handleExit, this)); + server->on(WM_G(R_close), std::bind(&WiFiManager::handleClose, this)); + server->on(WM_G(R_erase), std::bind(&WiFiManager::handleErase, this, false)); + server->on(WM_G(R_status), std::bind(&WiFiManager::handleWiFiStatus, this)); server->onNotFound (std::bind(&WiFiManager::handleNotFound, this)); - server->on(G(R_update), std::bind(&WiFiManager::handleUpdate, this)); - server->on(G(R_updatedone), HTTP_POST, std::bind(&WiFiManager::handleUpdateDone, this), std::bind(&WiFiManager::handleUpdating, this)); + server->on(WM_G(R_update), std::bind(&WiFiManager::handleUpdate, this)); + server->on(WM_G(R_updatedone), HTTP_POST, std::bind(&WiFiManager::handleUpdateDone, this), std::bind(&WiFiManager::handleUpdating, this)); server->begin(); // Web server start #ifdef WM_DEBUG_LEVEL diff --git a/WiFiManager.h b/WiFiManager.h index 0c03607..60e4c0c 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -46,31 +46,31 @@ #define WM_WEBSERVERSHIM // use webserver shim lib -#define G(string_literal) (String(FPSTR(string_literal)).c_str()) +#define WM_G(string_literal) (String(FPSTR(string_literal)).c_str()) -#define STRING2(x) #x -#define STRING(x) STRING2(x) +#define WM_STRING2(x) #x +#define WM_STRING(x) STRING2(x) // #include #ifdef ESP_IDF_VERSION - // #pragma message "ESP_IDF_VERSION_MAJOR = " STRING(ESP_IDF_VERSION_MAJOR) - // #pragma message "ESP_IDF_VERSION_MINOR = " STRING(ESP_IDF_VERSION_MINOR) - // #pragma message "ESP_IDF_VERSION_PATCH = " STRING(ESP_IDF_VERSION_PATCH) - #define VER_IDF_STR STRING(ESP_IDF_VERSION_MAJOR) "." STRING(ESP_IDF_VERSION_MINOR) "." STRING(ESP_IDF_VERSION_PATCH) + // #pragma message "ESP_IDF_VERSION_MAJOR = " WM_STRING(ESP_IDF_VERSION_MAJOR) + // #pragma message "ESP_IDF_VERSION_MINOR = " WM_STRING(ESP_IDF_VERSION_MINOR) + // #pragma message "ESP_IDF_VERSION_PATCH = " WM_STRING(ESP_IDF_VERSION_PATCH) + #define VER_IDF_STR WM_STRING(ESP_IDF_VERSION_MAJOR) "." WM_STRING(ESP_IDF_VERSION_MINOR) "." WM_STRING(ESP_IDF_VERSION_PATCH) #endif // #include "esp_arduino_version.h" #ifdef ESP_ARDUINO_VERSION - // #pragma message "ESP_ARDUINO_VERSION_MAJOR = " STRING(ESP_ARDUINO_VERSION_MAJOR) - // #pragma message "ESP_ARDUINO_VERSION_MINOR = " STRING(ESP_ARDUINO_VERSION_MINOR) - // #pragma message "ESP_ARDUINO_VERSION_PATCH = " STRING(ESP_ARDUINO_VERSION_PATCH) - #define VER_ARDUINO_STR STRING(ESP_ARDUINO_VERSION_MAJOR) "." STRING(ESP_ARDUINO_VERSION_MINOR) "." STRING(ESP_ARDUINO_VERSION_PATCH) + // #pragma message "ESP_ARDUINO_VERSION_MAJOR = " WM_STRING(ESP_ARDUINO_VERSION_MAJOR) + // #pragma message "ESP_ARDUINO_VERSION_MINOR = " WM_STRING(ESP_ARDUINO_VERSION_MINOR) + // #pragma message "ESP_ARDUINO_VERSION_PATCH = " WM_STRING(ESP_ARDUINO_VERSION_PATCH) + #define VER_ARDUINO_STR WM_STRING(ESP_ARDUINO_VERSION_MAJOR) "." WM_STRING(ESP_ARDUINO_VERSION_MINOR) "." WM_STRING(ESP_ARDUINO_VERSION_PATCH) #else // #include - // #pragma message "ESP_ARDUINO_VERSION_GIT = " STRING(ARDUINO_ESP32_GIT_VER)// 0x46d5afb1 - // #pragma message "ESP_ARDUINO_VERSION_DESC = " STRING(ARDUINO_ESP32_GIT_DESC) // 1.0.6 + // #pragma message "ESP_ARDUINO_VERSION_GIT = " WM_STRING(ARDUINO_ESP32_GIT_VER)// 0x46d5afb1 + // #pragma message "ESP_ARDUINO_VERSION_DESC = " WM_STRING(ARDUINO_ESP32_GIT_DESC) // 1.0.6 #define VER_ARDUINO_STR "Unknown" - // #pragma message "ESP_ARDUINO_VERSION_REL = " STRING(ARDUINO_ESP32_RELEASE) //"1_0_6" + // #pragma message "ESP_ARDUINO_VERSION_REL = " WM_STRING(ARDUINO_ESP32_RELEASE) //"1_0_6" #endif #ifdef ESP8266 @@ -484,7 +484,7 @@ class WiFiManager uint16_t _httpPort = 80; // port for webserver // uint8_t _retryCount = 0; // counter for retries, probably not needed if synchronous uint8_t _connectRetries = 1; // number of sta connect retries, force reconnect, wait loop (connectimeout) does not always work and first disconnect bails - bool _aggresiveReconn = false; // use an agrressive reconnect strategy, WILL delay conxs + bool _aggresiveReconn = true; // use an agrressive reconnect strategy, WILL delay conxs // on some conn failure modes will add delays and many retries to work around esp and ap bugs, ie, anti de-auth protections bool _allowExit = true; // allow exit non blocking