esp8266 2.3.0 compatability restored #576

asyncscannetworks not available in esp8266 2.3.0, adjusted server on to take cstr for backwards compatability
This commit is contained in:
Shawn A
2018-09-07 14:53:08 -05:00
parent 04552e40d8
commit 97e7d30c66
2 changed files with 22 additions and 12 deletions
+16 -12
View File
@@ -445,18 +445,18 @@ void WiFiManager::setupConfigPortal() {
dnsServer->start(DNS_PORT, F("*"), WiFi.softAPIP());
/* Setup httpd callbacks, web pages: root, wifi config pages, SO captive portal detectors and not found. */
server->on((String)FPSTR(R_root), std::bind(&WiFiManager::handleRoot, this));
server->on((String)FPSTR(R_wifi), std::bind(&WiFiManager::handleWifi, this, true));
server->on((String)FPSTR(R_wifinoscan), std::bind(&WiFiManager::handleWifi, this, false));
server->on((String)FPSTR(R_wifisave), std::bind(&WiFiManager::handleWifiSave, this));
server->on((String)FPSTR(R_info), std::bind(&WiFiManager::handleInfo, this));
server->on((String)FPSTR(R_param), std::bind(&WiFiManager::handleParam, this));
server->on((String)FPSTR(R_paramsave), std::bind(&WiFiManager::handleParamSave, this));
server->on((String)FPSTR(R_restart), std::bind(&WiFiManager::handleReset, this));
server->on((String)FPSTR(R_exit), std::bind(&WiFiManager::handleExit, this));
server->on((String)FPSTR(R_close), std::bind(&WiFiManager::handleClose, this));
server->on((String)FPSTR(R_erase), std::bind(&WiFiManager::handleErase, this, false));
server->on((String)FPSTR(R_status), std::bind(&WiFiManager::handleWiFiStatus, this));
server->on(String(FPSTR(R_wifi)).c_str(), std::bind(&WiFiManager::handleWifi, this, true));
server->on(String(FPSTR(R_root)).c_str(), std::bind(&WiFiManager::handleRoot, this));
server->on(String(FPSTR(R_wifinoscan)).c_str(), std::bind(&WiFiManager::handleWifi, this, false));
server->on(String(FPSTR(R_wifisave)).c_str(), std::bind(&WiFiManager::handleWifiSave, this));
server->on(String(FPSTR(R_info)).c_str(), std::bind(&WiFiManager::handleInfo, this));
server->on(String(FPSTR(R_param)).c_str(), std::bind(&WiFiManager::handleParam, this));
server->on(String(FPSTR(R_paramsave)).c_str(), std::bind(&WiFiManager::handleParamSave, this));
server->on(String(FPSTR(R_restart)).c_str(), std::bind(&WiFiManager::handleReset, this));
server->on(String(FPSTR(R_exit)).c_str(), std::bind(&WiFiManager::handleExit, this));
server->on(String(FPSTR(R_close)).c_str(), std::bind(&WiFiManager::handleClose, this));
server->on(String(FPSTR(R_erase)).c_str(), std::bind(&WiFiManager::handleErase, this, false));
server->on(String(FPSTR(R_status)).c_str(), std::bind(&WiFiManager::handleWiFiStatus, this));
server->onNotFound (std::bind(&WiFiManager::handleNotFound, this));
server->begin(); // Web server start
@@ -1010,9 +1010,13 @@ bool WiFiManager::WiFi_scanNetworks(bool force,bool async){
if(async){
DEBUG_WM(DEBUG_VERBOSE,F("WiFi Scan ASYNC started"));
#ifdef ESP8266
#ifndef WM_NOASYNC // no async available < 2.4.0
using namespace std::placeholders; // for `_1`
WiFi.scanNetworksAsync(std::bind(&WiFiManager::WiFi_scanComplete,this,_1));
#else
res = WiFi.scanNetworks();
#endif
#else
res = WiFi.scanNetworks(true);
#endif
return false;
+6
View File
@@ -13,6 +13,7 @@
#ifndef WiFiManager_h
#define WiFiManager_h
#include <core_version.h>
#include <vector>
// #define WM_MDNS // also set MDNS with sethostname
@@ -20,6 +21,11 @@
// #define WM_ERASE_NVS // esp32 erase(true) will erase NVS
// #define WM_RTC // esp32 info page will include reset reasons
#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
#endif
// #include "soc/efuse_reg.h" // include to add efuse chip rev to info, getChipRevision() is almost always the same though, so not sure why it matters.
// #define esp32autoreconnect // implement esp32 autoreconnect event listener kludge