Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8019386347 | ||
|
336830e5be |
BIN
bin/firmware.bin
BIN
bin/firmware.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -281,14 +281,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label for="influxdb2-bucket" class="col-sm-2 col-form-label">InfluxDB v2 Bucket</label>
|
<label for="influxdb2-bucket" class="col-sm-2 col-form-label">InfluxDB v2 Bucket ID</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<input type="text" maxlength="50" class="form-control" name="influxdb2-bucket" id="influxdb2-bucket" data-bs-toggle="tooltip" title="Identifier for the data bucket to use">
|
<input type="text" maxlength="50" class="form-control" name="influxdb2-bucket" id="influxdb2-bucket" data-bs-toggle="tooltip" title="Identifier for the data bucket to use">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label for="influxdb2-auth" class="col-sm-2 col-form-label">InfluxDB v2 Auth</label>
|
<label for="influxdb2-auth" class="col-sm-2 col-form-label">InfluxDB v2 Auth Token</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<input type="text" maxlength="100" class="form-control" name="influxdb2-auth" id="influxdb2-auth" data-bs-toggle="tooltip" title="Authentication token for accessing data bucket">
|
<input type="text" maxlength="100" class="form-control" name="influxdb2-auth" id="influxdb2-auth" data-bs-toggle="tooltip" title="Authentication token for accessing data bucket">
|
||||||
</div>
|
</div>
|
||||||
|
File diff suppressed because one or more lines are too long
@ -171,6 +171,7 @@ class DoubleResetDetector
|
|||||||
|
|
||||||
EEPROM.begin(EEPROM_SIZE);
|
EEPROM.begin(EEPROM_SIZE);
|
||||||
#elif ( ESP_DRD_USE_LITTLEFS || ESP_DRD_USE_SPIFFS )
|
#elif ( ESP_DRD_USE_LITTLEFS || ESP_DRD_USE_SPIFFS )
|
||||||
|
|
||||||
// LittleFS / SPIFFS code
|
// LittleFS / SPIFFS code
|
||||||
if (!FileFS.begin())
|
if (!FileFS.begin())
|
||||||
{
|
{
|
||||||
@ -184,6 +185,7 @@ class DoubleResetDetector
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
//RTC only for ESP8266
|
//RTC only for ESP8266
|
||||||
@ -264,6 +266,7 @@ class DoubleResetDetector
|
|||||||
Serial.printf("EEPROM Flag read = 0x%X\n", DOUBLERESETDETECTOR_FLAG);
|
Serial.printf("EEPROM Flag read = 0x%X\n", DOUBLERESETDETECTOR_FLAG);
|
||||||
#endif
|
#endif
|
||||||
#elif ( ESP_DRD_USE_LITTLEFS || ESP_DRD_USE_SPIFFS )
|
#elif ( ESP_DRD_USE_LITTLEFS || ESP_DRD_USE_SPIFFS )
|
||||||
|
|
||||||
// LittleFS / SPIFFS code
|
// LittleFS / SPIFFS code
|
||||||
if (FileFS.exists(DRD_FILENAME))
|
if (FileFS.exists(DRD_FILENAME))
|
||||||
{
|
{
|
||||||
@ -292,6 +295,7 @@ class DoubleResetDetector
|
|||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
//RTC only for ESP8266
|
//RTC only for ESP8266
|
||||||
@ -340,6 +344,7 @@ class DoubleResetDetector
|
|||||||
Serial.println("Saving config file failed");
|
Serial.println("Saving config file failed");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
//RTC only for ESP8266
|
//RTC only for ESP8266
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
|
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
|
||||||
Licensed under MIT license
|
Licensed under MIT license
|
||||||
|
|
||||||
Version: 1.11.0
|
Version: 1.12.1
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -28,6 +28,8 @@
|
|||||||
1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
|
1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
|
||||||
1.10.2 K Hoang 13/03/2022 Send CORS header in handleWifiSave() function
|
1.10.2 K Hoang 13/03/2022 Send CORS header in handleWifiSave() function
|
||||||
1.11.0 K Hoang 09/09/2022 Fix ESP32 chipID and add ESP_getChipOUI()
|
1.11.0 K Hoang 09/09/2022 Fix ESP32 chipID and add ESP_getChipOUI()
|
||||||
|
1.12.0 K Hoang 07/10/2022 Optional display Credentials (SSIDs, PWDs) in Config Portal
|
||||||
|
1.12.1 K Hoang 25/10/2022 Using random channel for softAP without password. Add astyle using allman style
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -35,7 +37,6 @@
|
|||||||
#ifndef ESP_WiFiManager_Impl_h
|
#ifndef ESP_WiFiManager_Impl_h
|
||||||
#define ESP_WiFiManager_Impl_h
|
#define ESP_WiFiManager_Impl_h
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
ESP_WMParameter::ESP_WMParameter(const char *custom)
|
ESP_WMParameter::ESP_WMParameter(const char *custom)
|
||||||
@ -51,21 +52,24 @@ ESP_WMParameter::ESP_WMParameter(const char *custom)
|
|||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
ESP_WMParameter::ESP_WMParameter(const char *id, const char *placeholder, const char *defaultValue, const int& length, const char *custom, const int& labelPlacement)
|
ESP_WMParameter::ESP_WMParameter(const char *id, const char *placeholder, const char *defaultValue, const int& length,
|
||||||
|
const char *custom, const int& labelPlacement)
|
||||||
{
|
{
|
||||||
init(id, placeholder, defaultValue, length, custom, labelPlacement);
|
init(id, placeholder, defaultValue, length, custom, labelPlacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
// New in v1.4.0
|
|
||||||
ESP_WMParameter::ESP_WMParameter(const WMParam_Data& WMParam_data)
|
ESP_WMParameter::ESP_WMParameter(const WMParam_Data& WMParam_data)
|
||||||
{
|
{
|
||||||
init(WMParam_data._id, WMParam_data._placeholder, WMParam_data._value, WMParam_data._length, "", WMParam_data._labelPlacement);
|
init(WMParam_data._id, WMParam_data._placeholder, WMParam_data._value, WMParam_data._length, "",
|
||||||
|
WMParam_data._labelPlacement);
|
||||||
}
|
}
|
||||||
//////
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
void ESP_WMParameter::init(const char *id, const char *placeholder, const char *defaultValue, const int& length, const char *custom, const int& labelPlacement)
|
void ESP_WMParameter::init(const char *id, const char *placeholder, const char *defaultValue, const int& length,
|
||||||
|
const char *custom, const int& labelPlacement)
|
||||||
{
|
{
|
||||||
_WMParam_data._id = id;
|
_WMParam_data._id = id;
|
||||||
_WMParam_data._placeholder = placeholder;
|
_WMParam_data._placeholder = placeholder;
|
||||||
@ -98,7 +102,7 @@ ESP_WMParameter::~ESP_WMParameter()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
// New in v1.4.0
|
|
||||||
// Using Struct to get/set whole data at once
|
// Using Struct to get/set whole data at once
|
||||||
void ESP_WMParameter::setWMParam_Data(const WMParam_Data& WMParam_data)
|
void ESP_WMParameter::setWMParam_Data(const WMParam_Data& WMParam_data)
|
||||||
{
|
{
|
||||||
@ -115,7 +119,6 @@ void ESP_WMParameter::getWMParam_Data(WMParam_Data &WMParam_data)
|
|||||||
|
|
||||||
memcpy(&WMParam_data, &_WMParam_data, sizeof(WMParam_data));
|
memcpy(&WMParam_data, &_WMParam_data, sizeof(WMParam_data));
|
||||||
}
|
}
|
||||||
//////
|
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
@ -159,6 +162,7 @@ const char* ESP_WMParameter::getCustomHTML()
|
|||||||
return _customHTML;
|
return _customHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -170,6 +174,8 @@ ESP_WMParameter** ESP_WiFiManager::getParameters()
|
|||||||
return _params;
|
return _params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
[getParametersCount description]
|
[getParametersCount description]
|
||||||
@access public
|
@access public
|
||||||
@ -215,7 +221,6 @@ ESP_WiFiManager::ESP_WiFiManager(const char *iHostname)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//WiFi not yet started here, must call WiFi.mode(WIFI_STA) and modify function WiFiGenericClass::mode(wifi_mode_t m) !!!
|
//WiFi not yet started here, must call WiFi.mode(WIFI_STA) and modify function WiFiGenericClass::mode(wifi_mode_t m) !!!
|
||||||
|
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
|
|
||||||
if (iHostname[0] == 0)
|
if (iHostname[0] == 0)
|
||||||
@ -249,12 +254,14 @@ ESP_WiFiManager::ESP_WiFiManager(const char *iHostname)
|
|||||||
ESP_WiFiManager::~ESP_WiFiManager()
|
ESP_WiFiManager::~ESP_WiFiManager()
|
||||||
{
|
{
|
||||||
#if USE_DYNAMIC_PARAMS
|
#if USE_DYNAMIC_PARAMS
|
||||||
|
|
||||||
if (_params != NULL)
|
if (_params != NULL)
|
||||||
{
|
{
|
||||||
LOGINFO(F("freeing allocated params!"));
|
LOGINFO(F("freeing allocated params!"));
|
||||||
|
|
||||||
free(_params);
|
free(_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (networkIndices)
|
if (networkIndices)
|
||||||
@ -344,7 +351,8 @@ void ESP_WiFiManager::setupConfigPortal()
|
|||||||
// Check (https://github.com/khoih-prog/ESP_WiFiManager/issues/58)
|
// Check (https://github.com/khoih-prog/ESP_WiFiManager/issues/58)
|
||||||
if (_WiFi_AP_IPconfig._ap_static_ip)
|
if (_WiFi_AP_IPconfig._ap_static_ip)
|
||||||
{
|
{
|
||||||
LOGWARN3(F("Custom AP IP/GW/Subnet = "), _WiFi_AP_IPconfig._ap_static_ip, _WiFi_AP_IPconfig._ap_static_gw, _WiFi_AP_IPconfig._ap_static_sn);
|
LOGWARN3(F("Custom AP IP/GW/Subnet = "), _WiFi_AP_IPconfig._ap_static_ip, _WiFi_AP_IPconfig._ap_static_gw,
|
||||||
|
_WiFi_AP_IPconfig._ap_static_sn);
|
||||||
|
|
||||||
WiFi.softAPConfig(_WiFi_AP_IPconfig._ap_static_ip, _WiFi_AP_IPconfig._ap_static_gw, _WiFi_AP_IPconfig._ap_static_sn);
|
WiFi.softAPConfig(_WiFi_AP_IPconfig._ap_static_ip, _WiFi_AP_IPconfig._ap_static_gw, _WiFi_AP_IPconfig._ap_static_sn);
|
||||||
}
|
}
|
||||||
@ -380,11 +388,11 @@ void ESP_WiFiManager::setupConfigPortal()
|
|||||||
|
|
||||||
_apPassword = NULL;
|
_apPassword = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGWARN1(F("AP PWD ="), _apPassword);
|
LOGWARN1(F("AP PWD ="), _apPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// KH, To enable dynamic/random channel
|
||||||
// KH, new from v1.0.10 to enable dynamic/random channel
|
|
||||||
static int channel;
|
static int channel;
|
||||||
|
|
||||||
// Use random channel if _WiFiAPChannel == 0
|
// Use random channel if _WiFiAPChannel == 0
|
||||||
@ -393,19 +401,9 @@ void ESP_WiFiManager::setupConfigPortal()
|
|||||||
else
|
else
|
||||||
channel = _WiFiAPChannel;
|
channel = _WiFiAPChannel;
|
||||||
|
|
||||||
if (_apPassword != NULL)
|
|
||||||
{
|
|
||||||
LOGWARN1(F("AP Channel ="), channel);
|
LOGWARN1(F("AP Channel ="), channel);
|
||||||
|
|
||||||
//WiFi.softAP(_apName, _apPassword);//password option
|
|
||||||
WiFi.softAP(_apName, _apPassword, channel);
|
WiFi.softAP(_apName, _apPassword, channel);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Can't use channel here
|
|
||||||
WiFi.softAP(_apName);
|
|
||||||
}
|
|
||||||
//////
|
|
||||||
|
|
||||||
delay(500); // Without delay I've seen the IP address blank
|
delay(500); // Without delay I've seen the IP address blank
|
||||||
|
|
||||||
@ -420,6 +418,8 @@ void ESP_WiFiManager::setupConfigPortal()
|
|||||||
server->on("/r", std::bind(&ESP_WiFiManager::handleReset, this));
|
server->on("/r", std::bind(&ESP_WiFiManager::handleReset, this));
|
||||||
server->on("/state", std::bind(&ESP_WiFiManager::handleState, this));
|
server->on("/state", std::bind(&ESP_WiFiManager::handleState, this));
|
||||||
server->on("/scan", std::bind(&ESP_WiFiManager::handleScan, this));
|
server->on("/scan", std::bind(&ESP_WiFiManager::handleScan, this));
|
||||||
|
//Microsoft captive portal. Maybe not needed. Might be handled by notFound handler.
|
||||||
|
server->on("/fwlink", std::bind(&ESP_WiFiManager::handleRoot, this));
|
||||||
server->onNotFound(std::bind(&ESP_WiFiManager::handleNotFound, this));
|
server->onNotFound(std::bind(&ESP_WiFiManager::handleNotFound, this));
|
||||||
server->begin(); // Web server start
|
server->begin(); // Web server start
|
||||||
|
|
||||||
@ -440,6 +440,8 @@ bool ESP_WiFiManager::autoConnect()
|
|||||||
return autoConnect(ssid.c_str(), NULL);
|
return autoConnect(ssid.c_str(), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
/* This is not very useful as there has been an assumption that device has to be
|
/* This is not very useful as there has been an assumption that device has to be
|
||||||
told to connect but Wifi already does it's best to connect in background. Calling this
|
told to connect but Wifi already does it's best to connect in background. Calling this
|
||||||
method will block until WiFi connects. Sketch can avoid
|
method will block until WiFi connects. Sketch can avoid
|
||||||
@ -447,7 +449,6 @@ bool ESP_WiFiManager::autoConnect()
|
|||||||
See some discussion at https://github.com/tzapu/WiFiManager/issues/68
|
See some discussion at https://github.com/tzapu/WiFiManager/issues/68
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// New in v1.0.11
|
|
||||||
// To permit autoConnect() to use STA static IP or DHCP IP.
|
// To permit autoConnect() to use STA static IP or DHCP IP.
|
||||||
#ifndef AUTOCONNECT_NO_INVALIDATE
|
#ifndef AUTOCONNECT_NO_INVALIDATE
|
||||||
#define AUTOCONNECT_NO_INVALIDATE true
|
#define AUTOCONNECT_NO_INVALIDATE true
|
||||||
@ -471,7 +472,6 @@ bool ESP_WiFiManager::autoConnect(char const *apName, char const *apPassword)
|
|||||||
|
|
||||||
while (millis() - startedAt < 10000)
|
while (millis() - startedAt < 10000)
|
||||||
{
|
{
|
||||||
//delay(100);
|
|
||||||
delay(200);
|
delay(200);
|
||||||
|
|
||||||
if (WiFi.status() == WL_CONNECTED)
|
if (WiFi.status() == WL_CONNECTED)
|
||||||
@ -521,10 +521,12 @@ bool ESP_WiFiManager::startConfigPortal(char const *apName, char const *apPassw
|
|||||||
{
|
{
|
||||||
LOGINFO("SET AP");
|
LOGINFO("SET AP");
|
||||||
|
|
||||||
WiFi.mode(WIFI_AP); // Dual mode becomes flaky if not connected to a WiFi network.
|
// Dual mode becomes flaky if not connected to a WiFi network.
|
||||||
// When ESP8266 station is trying to find a target AP, it will scan on every channel,
|
// When ESP8266 station is trying to find a target AP, it will scan on every channel,
|
||||||
// that means ESP8266 station is changing its channel to scan. This makes the channel of ESP8266 softAP keep changing too..
|
// that means ESP8266 station is changing its channel to scan. This makes the channel of ESP8266 softAP keep changing too..
|
||||||
// So the connection may break. From http://bbs.espressif.com/viewtopic.php?t=671#p2531
|
// So the connection may break. From http://bbs.espressif.com/viewtopic.php?t=671#p2531
|
||||||
|
|
||||||
|
WiFi.mode(WIFI_AP);
|
||||||
}
|
}
|
||||||
|
|
||||||
_apName = apName;
|
_apName = apName;
|
||||||
@ -580,6 +582,7 @@ bool ESP_WiFiManager::startConfigPortal(char const *apName, char const *apPassw
|
|||||||
//todo: check if any custom parameters actually exist, and check if they really changed maybe
|
//todo: check if any custom parameters actually exist, and check if they really changed maybe
|
||||||
_savecallback();
|
_savecallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,6 +602,8 @@ bool ESP_WiFiManager::startConfigPortal(char const *apName, char const *apPassw
|
|||||||
|
|
||||||
if (stopConfigPortal)
|
if (stopConfigPortal)
|
||||||
{
|
{
|
||||||
|
//TimedOut = false;
|
||||||
|
|
||||||
LOGERROR("Stop ConfigPortal"); //KH
|
LOGERROR("Stop ConfigPortal"); //KH
|
||||||
|
|
||||||
stopConfigPortal = false;
|
stopConfigPortal = false;
|
||||||
@ -614,7 +619,7 @@ bool ESP_WiFiManager::startConfigPortal(char const *apName, char const *apPassw
|
|||||||
{
|
{
|
||||||
setHostname();
|
setHostname();
|
||||||
|
|
||||||
// New v1.0.8 to fix static IP when CP not entered or timed-out
|
// To fix static IP when CP not entered or timed-out
|
||||||
setWifiStaticIP();
|
setWifiStaticIP();
|
||||||
|
|
||||||
WiFi.begin();
|
WiFi.begin();
|
||||||
@ -636,6 +641,7 @@ bool ESP_WiFiManager::startConfigPortal(char const *apName, char const *apPassw
|
|||||||
void ESP_WiFiManager::setWifiStaticIP()
|
void ESP_WiFiManager::setWifiStaticIP()
|
||||||
{
|
{
|
||||||
#if USE_CONFIGURABLE_DNS
|
#if USE_CONFIGURABLE_DNS
|
||||||
|
|
||||||
if (_WiFi_STA_IPconfig._sta_static_ip)
|
if (_WiFi_STA_IPconfig._sta_static_ip)
|
||||||
{
|
{
|
||||||
LOGWARN(F("Custom STA IP/GW/Subnet"));
|
LOGWARN(F("Custom STA IP/GW/Subnet"));
|
||||||
@ -645,13 +651,15 @@ void ESP_WiFiManager::setWifiStaticIP()
|
|||||||
{
|
{
|
||||||
LOGWARN(F("DNS1 and DNS2 set"));
|
LOGWARN(F("DNS1 and DNS2 set"));
|
||||||
|
|
||||||
WiFi.config(_WiFi_STA_IPconfig._sta_static_ip, _WiFi_STA_IPconfig._sta_static_gw, _WiFi_STA_IPconfig._sta_static_sn, _WiFi_STA_IPconfig._sta_static_dns1, _WiFi_STA_IPconfig._sta_static_dns2);
|
WiFi.config(_WiFi_STA_IPconfig._sta_static_ip, _WiFi_STA_IPconfig._sta_static_gw, _WiFi_STA_IPconfig._sta_static_sn,
|
||||||
|
_WiFi_STA_IPconfig._sta_static_dns1, _WiFi_STA_IPconfig._sta_static_dns2);
|
||||||
}
|
}
|
||||||
else if (_WiFi_STA_IPconfig._sta_static_dns1)
|
else if (_WiFi_STA_IPconfig._sta_static_dns1)
|
||||||
{
|
{
|
||||||
LOGWARN(F("Only DNS1 set"));
|
LOGWARN(F("Only DNS1 set"));
|
||||||
|
|
||||||
WiFi.config(_WiFi_STA_IPconfig._sta_static_ip, _WiFi_STA_IPconfig._sta_static_gw, _WiFi_STA_IPconfig._sta_static_sn, _WiFi_STA_IPconfig._sta_static_dns1);
|
WiFi.config(_WiFi_STA_IPconfig._sta_static_ip, _WiFi_STA_IPconfig._sta_static_gw, _WiFi_STA_IPconfig._sta_static_sn,
|
||||||
|
_WiFi_STA_IPconfig._sta_static_dns1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -659,6 +667,7 @@ void ESP_WiFiManager::setWifiStaticIP()
|
|||||||
|
|
||||||
WiFi.config(_WiFi_STA_IPconfig._sta_static_ip, _WiFi_STA_IPconfig._sta_static_gw, _WiFi_STA_IPconfig._sta_static_sn);
|
WiFi.config(_WiFi_STA_IPconfig._sta_static_ip, _WiFi_STA_IPconfig._sta_static_gw, _WiFi_STA_IPconfig._sta_static_sn);
|
||||||
}
|
}
|
||||||
|
|
||||||
//***** End added section for DNS config option *****
|
//***** End added section for DNS config option *****
|
||||||
|
|
||||||
LOGINFO1(F("setWifiStaticIP IP ="), WiFi.localIP());
|
LOGINFO1(F("setWifiStaticIP IP ="), WiFi.localIP());
|
||||||
@ -667,7 +676,9 @@ void ESP_WiFiManager::setWifiStaticIP()
|
|||||||
{
|
{
|
||||||
LOGWARN(F("Can't use Custom STA IP/GW/Subnet"));
|
LOGWARN(F("Can't use Custom STA IP/GW/Subnet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// check if we've got static_ip settings, if we do, use those.
|
// check if we've got static_ip settings, if we do, use those.
|
||||||
if (_WiFi_STA_IPconfig._sta_static_ip)
|
if (_WiFi_STA_IPconfig._sta_static_ip)
|
||||||
{
|
{
|
||||||
@ -675,17 +686,17 @@ void ESP_WiFiManager::setWifiStaticIP()
|
|||||||
|
|
||||||
LOGWARN1(F("Custom STA IP/GW/Subnet : "), WiFi.localIP());
|
LOGWARN1(F("Custom STA IP/GW/Subnet : "), WiFi.localIP());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
// New from v1.1.0
|
|
||||||
int ESP_WiFiManager::reconnectWifi()
|
int ESP_WiFiManager::reconnectWifi()
|
||||||
{
|
{
|
||||||
int connectResult;
|
int connectResult;
|
||||||
|
|
||||||
// using user-provided _ssid, _pass in place of system-stored ssid and pass
|
// using user-provided _ssid, _pass instead of system-stored
|
||||||
if ( ( connectResult = connectWifi(_ssid, _pass) ) != WL_CONNECTED)
|
if ( ( connectResult = connectWifi(_ssid, _pass) ) != WL_CONNECTED)
|
||||||
{
|
{
|
||||||
LOGERROR1(F("Failed to connect to"), _ssid);
|
LOGERROR1(F("Failed to connect to"), _ssid);
|
||||||
@ -708,12 +719,11 @@ int ESP_WiFiManager::reconnectWifi()
|
|||||||
|
|
||||||
int ESP_WiFiManager::connectWifi(const String& ssid, const String& pass)
|
int ESP_WiFiManager::connectWifi(const String& ssid, const String& pass)
|
||||||
{
|
{
|
||||||
//KH, from v1.0.10.
|
|
||||||
// Add option if didn't input/update SSID/PW => Use the previous saved Credentials.
|
// Add option if didn't input/update SSID/PW => Use the previous saved Credentials.
|
||||||
// But update the Static/DHCP options if changed.
|
// But update the Static/DHCP options if changed.
|
||||||
if ( (ssid != "") || ( (ssid == "") && (WiFi_SSID() != "") ) )
|
if ( (ssid != "") || ( (ssid == "") && (WiFi_SSID() != "") ) )
|
||||||
{
|
{
|
||||||
//fix for auto connect racing issue. Move up from v1.1.0 to avoid resetSettings()
|
//fix for auto connect racing issue, to avoid resetSettings()
|
||||||
if (WiFi.status() == WL_CONNECTED)
|
if (WiFi.status() == WL_CONNECTED)
|
||||||
{
|
{
|
||||||
LOGWARN(F("Already connected. Bailing out."));
|
LOGWARN(F("Already connected. Bailing out."));
|
||||||
@ -731,7 +741,7 @@ int ESP_WiFiManager::connectWifi(const String& ssid, const String& pass)
|
|||||||
|
|
||||||
setHostname();
|
setHostname();
|
||||||
|
|
||||||
// KH, Fix ESP32 staticIP after exiting CP, from v1.0.9
|
// KH, Fix ESP32 staticIP after exiting CP
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
setWifiStaticIP();
|
setWifiStaticIP();
|
||||||
#endif
|
#endif
|
||||||
@ -757,6 +767,7 @@ int ESP_WiFiManager::connectWifi(const String& ssid, const String& pass)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int connRes = waitForConnectResult();
|
int connRes = waitForConnectResult();
|
||||||
|
|
||||||
LOGWARN1("Connection result: ", getStatus(connRes));
|
LOGWARN1("Connection result: ", getStatus(connRes));
|
||||||
|
|
||||||
//not connected, WPS enabled, no pass - first attempt
|
//not connected, WPS enabled, no pass - first attempt
|
||||||
@ -789,13 +800,14 @@ uint8_t ESP_WiFiManager::waitForConnectResult()
|
|||||||
LOGWARN1(F("Connected after waiting (s) :"), waited / 1000);
|
LOGWARN1(F("Connected after waiting (s) :"), waited / 1000);
|
||||||
LOGWARN1(F("Local ip ="), WiFi.localIP());
|
LOGWARN1(F("Local ip ="), WiFi.localIP());
|
||||||
|
|
||||||
// Fix bug from v1.1.0+, connRes is sometimes not correct.
|
// Fix bug, connRes is sometimes not correct.
|
||||||
//return connRes;
|
//return connRes;
|
||||||
return WiFi.status();
|
return WiFi.status();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGERROR(F("Waiting WiFi connection with time out"));
|
LOGERROR(F("Waiting WiFi connection with time out"));
|
||||||
|
|
||||||
unsigned long start = millis();
|
unsigned long start = millis();
|
||||||
bool keepConnecting = true;
|
bool keepConnecting = true;
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
@ -803,6 +815,7 @@ uint8_t ESP_WiFiManager::waitForConnectResult()
|
|||||||
while (keepConnecting)
|
while (keepConnecting)
|
||||||
{
|
{
|
||||||
status = WiFi.status();
|
status = WiFi.status();
|
||||||
|
|
||||||
if (millis() > start + _connectTimeout)
|
if (millis() > start + _connectTimeout)
|
||||||
{
|
{
|
||||||
keepConnecting = false;
|
keepConnecting = false;
|
||||||
@ -813,8 +826,10 @@ uint8_t ESP_WiFiManager::waitForConnectResult()
|
|||||||
{
|
{
|
||||||
keepConnecting = false;
|
keepConnecting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
delay(100);
|
delay(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -843,14 +858,19 @@ const char* ESP_WiFiManager::getStatus(const int& status)
|
|||||||
{
|
{
|
||||||
case WL_IDLE_STATUS:
|
case WL_IDLE_STATUS:
|
||||||
return "WL_IDLE_STATUS";
|
return "WL_IDLE_STATUS";
|
||||||
|
|
||||||
case WL_NO_SSID_AVAIL:
|
case WL_NO_SSID_AVAIL:
|
||||||
return "WL_NO_SSID_AVAIL";
|
return "WL_NO_SSID_AVAIL";
|
||||||
|
|
||||||
case WL_CONNECTED:
|
case WL_CONNECTED:
|
||||||
return "WL_CONNECTED";
|
return "WL_CONNECTED";
|
||||||
|
|
||||||
case WL_CONNECT_FAILED:
|
case WL_CONNECT_FAILED:
|
||||||
return "WL_CONNECT_FAILED";
|
return "WL_CONNECT_FAILED";
|
||||||
|
|
||||||
case WL_DISCONNECTED:
|
case WL_DISCONNECTED:
|
||||||
return "WL_DISCONNECTED";
|
return "WL_DISCONNECTED";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
}
|
||||||
@ -880,7 +900,7 @@ void ESP_WiFiManager::resetSettings()
|
|||||||
WiFi.disconnect(true);
|
WiFi.disconnect(true);
|
||||||
#else
|
#else
|
||||||
WiFi.disconnect(true, true);
|
WiFi.disconnect(true, true);
|
||||||
// New in v1.0.11
|
|
||||||
// Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32
|
// Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32
|
||||||
// See https://github.com/khoih-prog/ESP_WiFiManager/issues/25 and https://github.com/espressif/arduino-esp32/issues/400
|
// See https://github.com/khoih-prog/ESP_WiFiManager/issues/25 and https://github.com/espressif/arduino-esp32/issues/400
|
||||||
WiFi.begin("0", "0");
|
WiFi.begin("0", "0");
|
||||||
@ -888,6 +908,7 @@ void ESP_WiFiManager::resetSettings()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
delay(200);
|
delay(200);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -921,7 +942,7 @@ void ESP_WiFiManager::setDebugOutput(bool debug)
|
|||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
// KH, new from v1.0.10 to enable dynamic/random channel
|
// KH, To enable dynamic/random channel
|
||||||
int ESP_WiFiManager::setConfigPortalChannel(const int& channel)
|
int ESP_WiFiManager::setConfigPortalChannel(const int& channel)
|
||||||
{
|
{
|
||||||
// If channel < MIN_WIFI_CHANNEL - 1 or channel > MAX_WIFI_CHANNEL => channel = 1
|
// If channel < MIN_WIFI_CHANNEL - 1 or channel > MAX_WIFI_CHANNEL => channel = 1
|
||||||
@ -947,7 +968,6 @@ void ESP_WiFiManager::setAPStaticIPConfig(const IPAddress& ip, const IPAddress&
|
|||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
// New in v1.4.0
|
|
||||||
void ESP_WiFiManager::setAPStaticIPConfig(const WiFi_AP_IPConfig& WM_AP_IPconfig)
|
void ESP_WiFiManager::setAPStaticIPConfig(const WiFi_AP_IPConfig& WM_AP_IPconfig)
|
||||||
{
|
{
|
||||||
LOGINFO(F("setAPStaticIPConfig"));
|
LOGINFO(F("setAPStaticIPConfig"));
|
||||||
@ -963,7 +983,7 @@ void ESP_WiFiManager::getAPStaticIPConfig(WiFi_AP_IPConfig &WM_AP_IPconfig)
|
|||||||
|
|
||||||
memcpy((void*) &WM_AP_IPconfig, &_WiFi_AP_IPconfig, sizeof(WM_AP_IPconfig));
|
memcpy((void*) &WM_AP_IPconfig, &_WiFi_AP_IPconfig, sizeof(WM_AP_IPconfig));
|
||||||
}
|
}
|
||||||
//////
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
void ESP_WiFiManager::setSTAStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn)
|
void ESP_WiFiManager::setSTAStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn)
|
||||||
@ -975,7 +995,6 @@ void ESP_WiFiManager::setSTAStaticIPConfig(const IPAddress& ip, const IPAddress&
|
|||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
// New in v1.4.0
|
|
||||||
|
|
||||||
void ESP_WiFiManager::setSTAStaticIPConfig(const WiFi_STA_IPConfig& WM_STA_IPconfig)
|
void ESP_WiFiManager::setSTAStaticIPConfig(const WiFi_STA_IPConfig& WM_STA_IPconfig)
|
||||||
{
|
{
|
||||||
@ -992,7 +1011,7 @@ void ESP_WiFiManager::getSTAStaticIPConfig(WiFi_STA_IPConfig &WM_STA_IPconfig)
|
|||||||
|
|
||||||
memcpy((void*) &WM_STA_IPconfig, &_WiFi_STA_IPconfig, sizeof(WM_STA_IPconfig));
|
memcpy((void*) &WM_STA_IPconfig, &_WiFi_STA_IPconfig, sizeof(WM_STA_IPconfig));
|
||||||
}
|
}
|
||||||
//////
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
#if USE_CONFIGURABLE_DNS
|
#if USE_CONFIGURABLE_DNS
|
||||||
@ -1071,7 +1090,7 @@ void ESP_WiFiManager::handleRoot()
|
|||||||
server->sendHeader(FPSTR(WM_HTTP_CACHE_CONTROL), FPSTR(WM_HTTP_NO_STORE));
|
server->sendHeader(FPSTR(WM_HTTP_CACHE_CONTROL), FPSTR(WM_HTTP_NO_STORE));
|
||||||
|
|
||||||
#if USING_CORS_FEATURE
|
#if USING_CORS_FEATURE
|
||||||
// New from v1.1.1, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
// For configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
||||||
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1128,7 +1147,7 @@ void ESP_WiFiManager::handleWifi()
|
|||||||
server->sendHeader(FPSTR(WM_HTTP_CACHE_CONTROL), FPSTR(WM_HTTP_NO_STORE));
|
server->sendHeader(FPSTR(WM_HTTP_CACHE_CONTROL), FPSTR(WM_HTTP_NO_STORE));
|
||||||
|
|
||||||
#if USING_CORS_FEATURE
|
#if USING_CORS_FEATURE
|
||||||
// New from v1.1.1, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
// For configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
||||||
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1145,7 +1164,7 @@ void ESP_WiFiManager::handleWifi()
|
|||||||
page += FPSTR(WM_HTTP_HEAD_END);
|
page += FPSTR(WM_HTTP_HEAD_END);
|
||||||
page += F("<h2>Configuration</h2>");
|
page += F("<h2>Configuration</h2>");
|
||||||
|
|
||||||
// KH, New, v1.0.6+
|
// KH, New
|
||||||
numberOfNetworks = scanWifiNetworks(&networkIndices);
|
numberOfNetworks = scanWifiNetworks(&networkIndices);
|
||||||
|
|
||||||
//Print list of WiFi networks that were found in earlier scan
|
//Print list of WiFi networks that were found in earlier scan
|
||||||
@ -1155,9 +1174,7 @@ void ESP_WiFiManager::handleWifi()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// From v1.0.10
|
|
||||||
page += FPSTR(WM_FLDSET_START);
|
page += FPSTR(WM_FLDSET_START);
|
||||||
//////
|
|
||||||
|
|
||||||
//display networks in page
|
//display networks in page
|
||||||
for (int i = 0; i < numberOfNetworks; i++)
|
for (int i = 0; i < numberOfNetworks; i++)
|
||||||
@ -1178,6 +1195,7 @@ void ESP_WiFiManager::handleWifi()
|
|||||||
item.replace("{r}", rssiQ);
|
item.replace("{r}", rssiQ);
|
||||||
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
|
|
||||||
if (WiFi.encryptionType(networkIndices[i]) != ENC_TYPE_NONE)
|
if (WiFi.encryptionType(networkIndices[i]) != ENC_TYPE_NONE)
|
||||||
#else //ESP32
|
#else //ESP32
|
||||||
if (WiFi.encryptionType(networkIndices[i]) != WIFI_AUTH_OPEN)
|
if (WiFi.encryptionType(networkIndices[i]) != WIFI_AUTH_OPEN)
|
||||||
@ -1191,18 +1209,28 @@ void ESP_WiFiManager::handleWifi()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//LOGDEBUG(item);
|
//LOGDEBUG(item);
|
||||||
|
|
||||||
page += item;
|
page += item;
|
||||||
delay(0);
|
delay(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// From v1.0.10
|
|
||||||
page += FPSTR(WM_FLDSET_END);
|
page += FPSTR(WM_FLDSET_END);
|
||||||
//////
|
|
||||||
|
|
||||||
page += "<br/>";
|
page += "<br/>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
page += "<small>*Hint: To reuse the saved WiFi credentials, leave SSID and PWD fields empty</small>";
|
||||||
|
|
||||||
page += FPSTR(WM_HTTP_FORM_START);
|
page += FPSTR(WM_HTTP_FORM_START);
|
||||||
|
|
||||||
|
#if DISPLAY_STORED_CREDENTIALS_IN_CP
|
||||||
|
// Populate SSIDs and PWDs if valid
|
||||||
|
page.replace("[[ssid]]", _ssid );
|
||||||
|
page.replace("[[pwd]]", _pass );
|
||||||
|
page.replace("[[ssid1]]", _ssid1 );
|
||||||
|
page.replace("[[pwd1]]", _pass1 );
|
||||||
|
#endif
|
||||||
|
|
||||||
char parLength[2];
|
char parLength[2];
|
||||||
|
|
||||||
page += FPSTR(WM_FLDSET_START);
|
page += FPSTR(WM_FLDSET_START);
|
||||||
@ -1216,14 +1244,17 @@ void ESP_WiFiManager::handleWifi()
|
|||||||
}
|
}
|
||||||
|
|
||||||
String pitem;
|
String pitem;
|
||||||
|
|
||||||
switch (_params[i]->getLabelPlacement())
|
switch (_params[i]->getLabelPlacement())
|
||||||
{
|
{
|
||||||
case WFM_LABEL_BEFORE:
|
case WFM_LABEL_BEFORE:
|
||||||
pitem = FPSTR(WM_HTTP_FORM_LABEL_BEFORE);
|
pitem = FPSTR(WM_HTTP_FORM_LABEL_BEFORE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WFM_LABEL_AFTER:
|
case WFM_LABEL_AFTER:
|
||||||
pitem = FPSTR(WM_HTTP_FORM_LABEL_AFTER);
|
pitem = FPSTR(WM_HTTP_FORM_LABEL_AFTER);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// WFM_NO_LABEL
|
// WFM_NO_LABEL
|
||||||
pitem = FPSTR(WM_HTTP_FORM_PARAM);
|
pitem = FPSTR(WM_HTTP_FORM_PARAM);
|
||||||
@ -1248,12 +1279,10 @@ void ESP_WiFiManager::handleWifi()
|
|||||||
page += pitem;
|
page += pitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
// From v1.0.10
|
|
||||||
if (_paramsCount > 0)
|
if (_paramsCount > 0)
|
||||||
{
|
{
|
||||||
page += FPSTR(WM_FLDSET_END);
|
page += FPSTR(WM_FLDSET_END);
|
||||||
}
|
}
|
||||||
//////
|
|
||||||
|
|
||||||
if (_params[0] != NULL)
|
if (_params[0] != NULL)
|
||||||
{
|
{
|
||||||
@ -1262,20 +1291,19 @@ void ESP_WiFiManager::handleWifi()
|
|||||||
|
|
||||||
LOGDEBUG1(F("Static IP ="), _WiFi_STA_IPconfig._sta_static_ip.toString());
|
LOGDEBUG1(F("Static IP ="), _WiFi_STA_IPconfig._sta_static_ip.toString());
|
||||||
|
|
||||||
// KH, Comment out in v1.0.9 to permit changing from DHCP to static IP, or vice versa
|
// KH, Comment out to permit changing from DHCP to static IP, or vice versa
|
||||||
// and add staticIP label in CP
|
// and add staticIP label in CP
|
||||||
|
|
||||||
// From v1.0.10 to permit disable/enable StaticIP configuration in Config Portal from sketch. Valid only if DHCP is used.
|
// To permit disable/enable StaticIP configuration in Config Portal from sketch. Valid only if DHCP is used.
|
||||||
// You'll loose the feature of dynamically changing from DHCP to static IP, or vice versa
|
// You'll loose the feature of dynamically changing from DHCP to static IP, or vice versa
|
||||||
// You have to explicitly specify false to disable the feature.
|
// You have to explicitly specify false to disable the feature.
|
||||||
|
|
||||||
#if !USE_STATIC_IP_CONFIG_IN_CP
|
#if !USE_STATIC_IP_CONFIG_IN_CP
|
||||||
|
|
||||||
if (_WiFi_STA_IPconfig._sta_static_ip)
|
if (_WiFi_STA_IPconfig._sta_static_ip)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// From v1.0.10
|
|
||||||
page += FPSTR(WM_FLDSET_START);
|
page += FPSTR(WM_FLDSET_START);
|
||||||
//////
|
|
||||||
|
|
||||||
String item = FPSTR(WM_HTTP_FORM_LABEL);
|
String item = FPSTR(WM_HTTP_FORM_LABEL);
|
||||||
item += FPSTR(WM_HTTP_FORM_PARAM);
|
item += FPSTR(WM_HTTP_FORM_PARAM);
|
||||||
@ -1331,9 +1359,7 @@ void ESP_WiFiManager::handleWifi()
|
|||||||
|
|
||||||
page += item;
|
page += item;
|
||||||
|
|
||||||
// From v1.0.10
|
|
||||||
page += FPSTR(WM_FLDSET_END);
|
page += FPSTR(WM_FLDSET_END);
|
||||||
//////
|
|
||||||
|
|
||||||
page += "<br/>";
|
page += "<br/>";
|
||||||
}
|
}
|
||||||
@ -1360,14 +1386,13 @@ void ESP_WiFiManager::handleWifiSave()
|
|||||||
_ssid = server->arg("s").c_str();
|
_ssid = server->arg("s").c_str();
|
||||||
_pass = server->arg("p").c_str();
|
_pass = server->arg("p").c_str();
|
||||||
|
|
||||||
// New from v1.1.0
|
|
||||||
_ssid1 = server->arg("s1").c_str();
|
_ssid1 = server->arg("s1").c_str();
|
||||||
_pass1 = server->arg("p1").c_str();
|
_pass1 = server->arg("p1").c_str();
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
|
|
||||||
#if USING_CORS_FEATURE
|
#if USING_CORS_FEATURE
|
||||||
// New from v1.10.2, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
// For configuring CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
||||||
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1398,9 +1423,7 @@ void ESP_WiFiManager::handleWifiSave()
|
|||||||
String value = server->arg(_params[i]->getID()).c_str();
|
String value = server->arg(_params[i]->getID()).c_str();
|
||||||
|
|
||||||
//store it in array
|
//store it in array
|
||||||
// New in v1.4.0
|
|
||||||
value.toCharArray(_params[i]->_WMParam_data._value, _params[i]->_WMParam_data._length);
|
value.toCharArray(_params[i]->_WMParam_data._value, _params[i]->_WMParam_data._length);
|
||||||
//////
|
|
||||||
|
|
||||||
LOGDEBUG2(F("Parameter and value :"), _params[i]->getID(), value);
|
LOGDEBUG2(F("Parameter and value :"), _params[i]->getID(), value);
|
||||||
}
|
}
|
||||||
@ -1430,6 +1453,7 @@ void ESP_WiFiManager::handleWifiSave()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if USE_CONFIGURABLE_DNS
|
#if USE_CONFIGURABLE_DNS
|
||||||
|
|
||||||
//***** Added for DNS Options *****
|
//***** Added for DNS Options *****
|
||||||
if (server->arg("dns1") != "")
|
if (server->arg("dns1") != "")
|
||||||
{
|
{
|
||||||
@ -1446,6 +1470,7 @@ void ESP_WiFiManager::handleWifiSave()
|
|||||||
|
|
||||||
LOGDEBUG1(F("New Static DNS2 ="), _WiFi_STA_IPconfig._sta_static_dns2.toString());
|
LOGDEBUG1(F("New Static DNS2 ="), _WiFi_STA_IPconfig._sta_static_dns2.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
//***** End added for DNS Options *****
|
//***** End added for DNS Options *****
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1459,10 +1484,7 @@ void ESP_WiFiManager::handleWifiSave()
|
|||||||
page += FPSTR(WM_HTTP_SAVED);
|
page += FPSTR(WM_HTTP_SAVED);
|
||||||
page.replace("{v}", _apName);
|
page.replace("{v}", _apName);
|
||||||
page.replace("{x}", _ssid);
|
page.replace("{x}", _ssid);
|
||||||
|
|
||||||
// KH, update from v1.1.0
|
|
||||||
page.replace("{x1}", _ssid1);
|
page.replace("{x1}", _ssid1);
|
||||||
//////
|
|
||||||
|
|
||||||
page += FPSTR(WM_HTTP_END);
|
page += FPSTR(WM_HTTP_END);
|
||||||
|
|
||||||
@ -1486,7 +1508,7 @@ void ESP_WiFiManager::handleServerClose()
|
|||||||
server->sendHeader(FPSTR(WM_HTTP_CACHE_CONTROL), FPSTR(WM_HTTP_NO_STORE));
|
server->sendHeader(FPSTR(WM_HTTP_CACHE_CONTROL), FPSTR(WM_HTTP_NO_STORE));
|
||||||
|
|
||||||
#if USING_CORS_FEATURE
|
#if USING_CORS_FEATURE
|
||||||
// New from v1.1.1, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
// For configuring CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
||||||
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1536,7 +1558,7 @@ void ESP_WiFiManager::handleInfo()
|
|||||||
server->sendHeader(FPSTR(WM_HTTP_CACHE_CONTROL), FPSTR(WM_HTTP_NO_STORE));
|
server->sendHeader(FPSTR(WM_HTTP_CACHE_CONTROL), FPSTR(WM_HTTP_NO_STORE));
|
||||||
|
|
||||||
#if USING_CORS_FEATURE
|
#if USING_CORS_FEATURE
|
||||||
// New from v1.1.1, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
// For configuring CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
||||||
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1654,7 +1676,7 @@ void ESP_WiFiManager::handleState()
|
|||||||
server->sendHeader(FPSTR(WM_HTTP_CACHE_CONTROL), FPSTR(WM_HTTP_NO_STORE));
|
server->sendHeader(FPSTR(WM_HTTP_CACHE_CONTROL), FPSTR(WM_HTTP_NO_STORE));
|
||||||
|
|
||||||
#if USING_CORS_FEATURE
|
#if USING_CORS_FEATURE
|
||||||
// New from v1.1.1, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
// For configuring CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
||||||
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1705,7 +1727,7 @@ void ESP_WiFiManager::handleScan()
|
|||||||
server->sendHeader(FPSTR(WM_HTTP_CACHE_CONTROL), FPSTR(WM_HTTP_NO_STORE));
|
server->sendHeader(FPSTR(WM_HTTP_CACHE_CONTROL), FPSTR(WM_HTTP_NO_STORE));
|
||||||
|
|
||||||
#if USING_CORS_FEATURE
|
#if USING_CORS_FEATURE
|
||||||
// New from v1.1.1, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
// For configuring CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
||||||
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1719,7 +1741,9 @@ void ESP_WiFiManager::handleScan()
|
|||||||
//and should be freed when indices no longer required.
|
//and should be freed when indices no longer required.
|
||||||
|
|
||||||
n = scanWifiNetworks(&indices);
|
n = scanWifiNetworks(&indices);
|
||||||
|
|
||||||
LOGDEBUG(F("In handleScan, scanWifiNetworks done"));
|
LOGDEBUG(F("In handleScan, scanWifiNetworks done"));
|
||||||
|
|
||||||
String page = F("{\"Access_Points\":[");
|
String page = F("{\"Access_Points\":[");
|
||||||
|
|
||||||
//display networks in page
|
//display networks in page
|
||||||
@ -1744,6 +1768,7 @@ void ESP_WiFiManager::handleScan()
|
|||||||
item.replace("{r}", rssiQ);
|
item.replace("{r}", rssiQ);
|
||||||
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
|
|
||||||
if (WiFi.encryptionType(indices[i]) != ENC_TYPE_NONE)
|
if (WiFi.encryptionType(indices[i]) != ENC_TYPE_NONE)
|
||||||
#else //ESP32
|
#else //ESP32
|
||||||
if (WiFi.encryptionType(indices[i]) != WIFI_AUTH_OPEN)
|
if (WiFi.encryptionType(indices[i]) != WIFI_AUTH_OPEN)
|
||||||
@ -1755,7 +1780,9 @@ void ESP_WiFiManager::handleScan()
|
|||||||
{
|
{
|
||||||
item.replace("{i}", "false");
|
item.replace("{i}", "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
//LOGDEBUG(item);
|
//LOGDEBUG(item);
|
||||||
|
|
||||||
page += item;
|
page += item;
|
||||||
delay(0);
|
delay(0);
|
||||||
}
|
}
|
||||||
@ -1798,10 +1825,10 @@ void ESP_WiFiManager::handleReset()
|
|||||||
LOGDEBUG(F("Sent reset page"));
|
LOGDEBUG(F("Sent reset page"));
|
||||||
delay(5000);
|
delay(5000);
|
||||||
|
|
||||||
// New in v1.0.11
|
|
||||||
// Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32
|
// Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32
|
||||||
// See https://github.com/khoih-prog/ESP_WiFiManager/issues/25 and https://github.com/espressif/arduino-esp32/issues/400
|
// See https://github.com/khoih-prog/ESP_WiFiManager/issues/25 and https://github.com/espressif/arduino-esp32/issues/400
|
||||||
resetSettings();
|
resetSettings();
|
||||||
|
|
||||||
//WiFi.disconnect(true); // Wipe out WiFi credentials.
|
//WiFi.disconnect(true); // Wipe out WiFi credentials.
|
||||||
//////
|
//////
|
||||||
|
|
||||||
@ -1862,11 +1889,15 @@ bool ESP_WiFiManager::captivePortal()
|
|||||||
LOGINFO1(F("Request redirected to captive portal : "), server->client().localIP());
|
LOGINFO1(F("Request redirected to captive portal : "), server->client().localIP());
|
||||||
|
|
||||||
server->sendHeader(F("Location"), (String)F("http://") + toStringIp(server->client().localIP()), true);
|
server->sendHeader(F("Location"), (String)F("http://") + toStringIp(server->client().localIP()), true);
|
||||||
server->send(302, FPSTR(WM_HTTP_HEAD_CT2), ""); // Empty content inhibits Content-length header so we have to close the socket ourselves.
|
|
||||||
|
// Empty content inhibits Content-length header so we have to close the socket ourselves.
|
||||||
|
server->send(302, FPSTR(WM_HTTP_HEAD_CT2), "");
|
||||||
|
|
||||||
server->client().stop(); // Stop is needed because we sent no content length
|
server->client().stop(); // Stop is needed because we sent no content length
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1889,7 +1920,8 @@ void ESP_WiFiManager::setSaveConfigCallback(void(*func)())
|
|||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
//sets a custom element to add to head, like a new style tag
|
//sets a custom element to add to head, like a new style tag
|
||||||
void ESP_WiFiManager::setCustomHeadElement(const char* element) {
|
void ESP_WiFiManager::setCustomHeadElement(const char* element)
|
||||||
|
{
|
||||||
_customHeadElement = element;
|
_customHeadElement = element;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1919,6 +1951,7 @@ int ESP_WiFiManager::scanWifiNetworks(int **indicesptr)
|
|||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
{
|
{
|
||||||
LOGDEBUG(F("No network found"));
|
LOGDEBUG(F("No network found"));
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1931,6 +1964,7 @@ int ESP_WiFiManager::scanWifiNetworks(int **indicesptr)
|
|||||||
{
|
{
|
||||||
LOGDEBUG(F("ERROR: Out of memory"));
|
LOGDEBUG(F("ERROR: Out of memory"));
|
||||||
*indicesptr = NULL;
|
*indicesptr = NULL;
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1963,12 +1997,14 @@ int ESP_WiFiManager::scanWifiNetworks(int **indicesptr)
|
|||||||
if (_removeDuplicateAPs)
|
if (_removeDuplicateAPs)
|
||||||
{
|
{
|
||||||
String cssid;
|
String cssid;
|
||||||
|
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
if (indices[i] == -1)
|
if (indices[i] == -1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
cssid = WiFi.SSID(indices[i]);
|
cssid = WiFi.SSID(indices[i]);
|
||||||
|
|
||||||
for (int j = i + 1; j < n; j++)
|
for (int j = i + 1; j < n; j++)
|
||||||
{
|
{
|
||||||
if (cssid == WiFi.SSID(indices[j]))
|
if (cssid == WiFi.SSID(indices[j]))
|
||||||
@ -1995,6 +2031,7 @@ int ESP_WiFiManager::scanWifiNetworks(int **indicesptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if (DEBUG_WIFIMGR > 2)
|
#if (DEBUG_WIFIMGR > 2)
|
||||||
|
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
if (indices[i] == -1)
|
if (indices[i] == -1)
|
||||||
@ -2002,6 +2039,7 @@ int ESP_WiFiManager::scanWifiNetworks(int **indicesptr)
|
|||||||
else
|
else
|
||||||
Serial.println(WiFi.SSID(indices[i]));
|
Serial.println(WiFi.SSID(indices[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (n);
|
return (n);
|
||||||
@ -2044,6 +2082,7 @@ bool ESP_WiFiManager::isIp(const String& str)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2053,6 +2092,7 @@ bool ESP_WiFiManager::isIp(const String& str)
|
|||||||
String ESP_WiFiManager::toStringIp(const IPAddress& ip)
|
String ESP_WiFiManager::toStringIp(const IPAddress& ip)
|
||||||
{
|
{
|
||||||
String res = "";
|
String res = "";
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
res += String((ip >> (8 * i)) & 0xFF) + ".";
|
res += String((ip >> (8 * i)) & 0xFF) + ".";
|
||||||
@ -2086,7 +2126,9 @@ String ESP_WiFiManager::getStoredWiFiSSID()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
wifi_config_t conf;
|
wifi_config_t conf;
|
||||||
|
|
||||||
esp_wifi_get_config(WIFI_IF_STA, &conf);
|
esp_wifi_get_config(WIFI_IF_STA, &conf);
|
||||||
|
|
||||||
return String(reinterpret_cast<char*>(conf.sta.ssid));
|
return String(reinterpret_cast<char*>(conf.sta.ssid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2103,11 +2145,14 @@ String ESP_WiFiManager::getStoredWiFiPass()
|
|||||||
}
|
}
|
||||||
|
|
||||||
wifi_config_t conf;
|
wifi_config_t conf;
|
||||||
|
|
||||||
esp_wifi_get_config(WIFI_IF_STA, &conf);
|
esp_wifi_get_config(WIFI_IF_STA, &conf);
|
||||||
|
|
||||||
return String(reinterpret_cast<char*>(conf.sta.password));
|
return String(reinterpret_cast<char*>(conf.sta.password));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
uint32_t getChipID()
|
uint32_t getChipID()
|
||||||
{
|
{
|
||||||
uint64_t chipId64 = 0;
|
uint64_t chipId64 = 0;
|
||||||
@ -2120,6 +2165,8 @@ uint32_t getChipID()
|
|||||||
return (uint32_t) (chipId64 & 0xFFFFFF);
|
return (uint32_t) (chipId64 & 0xFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
uint32_t getChipOUI()
|
uint32_t getChipOUI()
|
||||||
{
|
{
|
||||||
uint64_t chipId64 = 0;
|
uint64_t chipId64 = 0;
|
||||||
@ -2132,7 +2179,10 @@ uint32_t getChipOUI()
|
|||||||
return (uint32_t) (chipId64 >> 24);
|
return (uint32_t) (chipId64 >> 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
//////////////////////////////////////////
|
||||||
|
|
||||||
|
#endif // #ifdef ESP32
|
||||||
|
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
#endif //ESP_WiFiManager_Impl_h
|
#endif //ESP_WiFiManager_Impl_h
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
|
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
|
||||||
Licensed under MIT license
|
Licensed under MIT license
|
||||||
|
|
||||||
Version: 1.11.0
|
Version: 1.12.1
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -28,6 +28,8 @@
|
|||||||
1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
|
1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
|
||||||
1.10.2 K Hoang 13/03/2022 Send CORS header in handleWifiSave() function
|
1.10.2 K Hoang 13/03/2022 Send CORS header in handleWifiSave() function
|
||||||
1.11.0 K Hoang 09/09/2022 Fix ESP32 chipID and add ESP_getChipOUI()
|
1.11.0 K Hoang 09/09/2022 Fix ESP32 chipID and add ESP_getChipOUI()
|
||||||
|
1.12.0 K Hoang 07/10/2022 Optional display Credentials (SSIDs, PWDs) in Config Portal
|
||||||
|
1.12.1 K Hoang 25/10/2022 Using random channel for softAP without password. Add astyle using allman style
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
|
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
|
||||||
Licensed under MIT license
|
Licensed under MIT license
|
||||||
|
|
||||||
Version: 1.11.0
|
Version: 1.12.1
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -28,6 +28,8 @@
|
|||||||
1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
|
1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
|
||||||
1.10.2 K Hoang 13/03/2022 Send CORS header in handleWifiSave() function
|
1.10.2 K Hoang 13/03/2022 Send CORS header in handleWifiSave() function
|
||||||
1.11.0 K Hoang 09/09/2022 Fix ESP32 chipID and add ESP_getChipOUI()
|
1.11.0 K Hoang 09/09/2022 Fix ESP32 chipID and add ESP_getChipOUI()
|
||||||
|
1.12.0 K Hoang 07/10/2022 Optional display Credentials (SSIDs, PWDs) in Config Portal
|
||||||
|
1.12.1 K Hoang 25/10/2022 Using random channel for softAP without password. Add astyle using allman style
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -35,6 +37,8 @@
|
|||||||
#ifndef ESP_WiFiManager_hpp
|
#ifndef ESP_WiFiManager_hpp
|
||||||
#define ESP_WiFiManager_hpp
|
#define ESP_WiFiManager_hpp
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if !( defined(ESP8266) || defined(ESP32) )
|
#if !( defined(ESP8266) || defined(ESP32) )
|
||||||
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
|
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
|
||||||
#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \
|
#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \
|
||||||
@ -52,9 +56,10 @@
|
|||||||
#else
|
#else
|
||||||
#warning Using ESP32_C3 using core v1.0.6-. To follow library instructions to install esp32-c3 core. Only SPIFFS and EEPROM OK.
|
#warning Using ESP32_C3 using core v1.0.6-. To follow library instructions to install esp32-c3 core. Only SPIFFS and EEPROM OK.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#warning You have to select Flash size 2MB and Minimal APP (1.3MB + 700KB) for some boards
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// #warning You have to select Flash size 2MB and Minimal APP (1.3MB + 700KB) for some boards
|
|
||||||
#define USING_ESP32_C3 true
|
#define USING_ESP32_C3 true
|
||||||
#elif ( defined(ARDUINO_ESP32S3_DEV) || defined(ARDUINO_ESP32_S3_BOX) || defined(ARDUINO_TINYS3) || \
|
#elif ( defined(ARDUINO_ESP32S3_DEV) || defined(ARDUINO_ESP32_S3_BOX) || defined(ARDUINO_TINYS3) || \
|
||||||
defined(ARDUINO_PROS3) || defined(ARDUINO_FEATHERS3) )
|
defined(ARDUINO_PROS3) || defined(ARDUINO_FEATHERS3) )
|
||||||
@ -64,16 +69,22 @@
|
|||||||
#define USING_ESP32_S3 true
|
#define USING_ESP32_S3 true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ESP_WIFIMANAGER_VERSION "ESP_WiFiManager v1.11.0"
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define ESP_WIFIMANAGER_VERSION "ESP_WiFiManager v1.12.1"
|
||||||
|
|
||||||
#define ESP_WIFIMANAGER_VERSION_MAJOR 1
|
#define ESP_WIFIMANAGER_VERSION_MAJOR 1
|
||||||
#define ESP_WIFIMANAGER_VERSION_MINOR 11
|
#define ESP_WIFIMANAGER_VERSION_MINOR 12
|
||||||
#define ESP_WIFIMANAGER_VERSION_PATCH 0
|
#define ESP_WIFIMANAGER_VERSION_PATCH 1
|
||||||
|
|
||||||
#define ESP_WIFIMANAGER_VERSION_INT 1011000
|
#define ESP_WIFIMANAGER_VERSION_INT 1012001
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "ESP_WiFiManager_Debug.h"
|
#include "ESP_WiFiManager_Debug.h"
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if ( defined(HTTP_PORT) && (HTTP_PORT < 65536) && (HTTP_PORT > 0) )
|
#if ( defined(HTTP_PORT) && (HTTP_PORT < 65536) && (HTTP_PORT > 0) )
|
||||||
#if (_WIFIMGR_LOGLEVEL_ > 3)
|
#if (_WIFIMGR_LOGLEVEL_ > 3)
|
||||||
#warning Using custom HTTP_PORT
|
#warning Using custom HTTP_PORT
|
||||||
@ -88,6 +99,8 @@
|
|||||||
#define HTTP_PORT_TO_USE 80
|
#define HTTP_PORT_TO_USE 80
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
//KH, for ESP32
|
//KH, for ESP32
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
@ -103,6 +116,8 @@
|
|||||||
#undef max
|
#undef max
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
//KH, for ESP32
|
//KH, for ESP32
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
extern "C"
|
extern "C"
|
||||||
@ -127,7 +142,8 @@
|
|||||||
#define ESP_getChipOUI() getChipOUI() // ((uint32_t)ESP.getEfuseMac())
|
#define ESP_getChipOUI() getChipOUI() // ((uint32_t)ESP.getEfuseMac())
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// New in v1.4.0
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
IPAddress _ap_static_ip;
|
IPAddress _ap_static_ip;
|
||||||
@ -136,6 +152,8 @@ typedef struct
|
|||||||
|
|
||||||
} WiFi_AP_IPConfig;
|
} WiFi_AP_IPConfig;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Thanks to @Amorphous for the feature and code
|
// Thanks to @Amorphous for the feature and code
|
||||||
// (https://community.blynk.cc/t/esp-wifimanager-for-esp32-and-esp8266/42257/13)
|
// (https://community.blynk.cc/t/esp-wifimanager-for-esp32-and-esp8266/42257/13)
|
||||||
// To enable to configure from sketch
|
// To enable to configure from sketch
|
||||||
@ -143,6 +161,8 @@ typedef struct
|
|||||||
#define USE_CONFIGURABLE_DNS false
|
#define USE_CONFIGURABLE_DNS false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
IPAddress _sta_static_ip;
|
IPAddress _sta_static_ip;
|
||||||
@ -151,12 +171,15 @@ typedef struct
|
|||||||
IPAddress _sta_static_dns1;
|
IPAddress _sta_static_dns1;
|
||||||
IPAddress _sta_static_dns2;
|
IPAddress _sta_static_dns2;
|
||||||
} WiFi_STA_IPConfig;
|
} WiFi_STA_IPConfig;
|
||||||
//////
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define WFM_LABEL_BEFORE 1
|
#define WFM_LABEL_BEFORE 1
|
||||||
#define WFM_LABEL_AFTER 2
|
#define WFM_LABEL_AFTER 2
|
||||||
#define WFM_NO_LABEL 0
|
#define WFM_NO_LABEL 0
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
/** Handle CORS in pages */
|
/** Handle CORS in pages */
|
||||||
// Default false for using only whenever necessary to avoid security issue when using CORS (Cross-Origin Resource Sharing)
|
// Default false for using only whenever necessary to avoid security issue when using CORS (Cross-Origin Resource Sharing)
|
||||||
#ifndef USING_CORS_FEATURE
|
#ifndef USING_CORS_FEATURE
|
||||||
@ -165,25 +188,32 @@ typedef struct
|
|||||||
#define USING_CORS_FEATURE false
|
#define USING_CORS_FEATURE false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
//KH
|
//KH
|
||||||
//Mofidy HTTP_HEAD to WM_HTTP_HEAD_START to avoid conflict in Arduino esp8266 core 2.6.0+
|
//Mofidy HTTP_HEAD to WM_HTTP_HEAD_START to avoid conflict in Arduino esp8266 core 2.6.0+
|
||||||
const char WM_HTTP_200[] PROGMEM = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n";
|
const char WM_HTTP_200[] PROGMEM = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n";
|
||||||
const char WM_HTTP_HEAD_START[] PROGMEM = "<!DOCTYPE html><html lang='en'><head><meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no'/><title>{v}</title>";
|
const char WM_HTTP_HEAD_START[] PROGMEM = "<!DOCTYPE html><html lang='en'><head><meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no'/><title>{v}</title>";
|
||||||
|
|
||||||
// KH, update from v1.0.10
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
const char WM_HTTP_STYLE[] PROGMEM = "<style>div{padding:2px;font-size:1em;}body,textarea,input,select{background: 0;border-radius: 0;font: 16px sans-serif;margin: 0}textarea,input,select{outline: 0;font-size: 14px;border: 1px solid #ccc;padding: 8px;width: 90%}.btn a{text-decoration: none}.container{margin: auto;width: 90%}@media(min-width:1200px){.container{margin: auto;width: 30%}}@media(min-width:768px) and (max-width:1200px){.container{margin: auto;width: 50%}}.btn,h2{font-size: 2em}h1{font-size: 3em}.btn{background: #0ae;border-radius: 4px;border: 0;color: #fff;cursor: pointer;display: inline-block;margin: 2px 0;padding: 10px 14px 11px;width: 100%}.btn:hover{background: #09d}.btn:active,.btn:focus{background: #08b}label>*{display: inline}form>*{display: block;margin-bottom: 10px}textarea:focus,input:focus,select:focus{border-color: #5ab}.msg{background: #def;border-left: 5px solid #59d;padding: 1.5em}.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}input[type='checkbox']{float: left;width: 20px}.table td{padding:.5em;text-align:left}.table tbody>:nth-child(2n-1){background:#ddd}fieldset{border-radius:0.5rem;margin:0px;}</style>";
|
const char WM_HTTP_STYLE[] PROGMEM = "<style>div{padding:2px;font-size:1em;}body,textarea,input,select{background: 0;border-radius: 0;font: 16px sans-serif;margin: 0}textarea,input,select{outline: 0;font-size: 14px;border: 1px solid #ccc;padding: 8px;width: 90%}.btn a{text-decoration: none}.container{margin: auto;width: 90%}@media(min-width:1200px){.container{margin: auto;width: 30%}}@media(min-width:768px) and (max-width:1200px){.container{margin: auto;width: 50%}}.btn,h2{font-size: 2em}h1{font-size: 3em}.btn{background: #0ae;border-radius: 4px;border: 0;color: #fff;cursor: pointer;display: inline-block;margin: 2px 0;padding: 10px 14px 11px;width: 100%}.btn:hover{background: #09d}.btn:active,.btn:focus{background: #08b}label>*{display: inline}form>*{display: block;margin-bottom: 10px}textarea:focus,input:focus,select:focus{border-color: #5ab}.msg{background: #def;border-left: 5px solid #59d;padding: 1.5em}.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}input[type='checkbox']{float: left;width: 20px}.table td{padding:.5em;text-align:left}.table tbody>:nth-child(2n-1){background:#ddd}fieldset{border-radius:0.5rem;margin:0px;}</style>";
|
||||||
//////
|
|
||||||
|
|
||||||
// KH, update from v1.1.0
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
const char WM_HTTP_SCRIPT[] PROGMEM = "<script>function c(l){document.getElementById('s').value=l.innerText||l.textContent;document.getElementById('p').focus();document.getElementById('s1').value=l.innerText||l.textContent;document.getElementById('p1').focus();document.getElementById('timezone').value=timezone.name();}</script>";
|
const char WM_HTTP_SCRIPT[] PROGMEM = "<script>function c(l){document.getElementById('s').value=l.innerText||l.textContent;document.getElementById('p').focus();document.getElementById('s1').value=l.innerText||l.textContent;document.getElementById('p1').focus();document.getElementById('timezone').value=timezone.name();}</script>";
|
||||||
//////
|
|
||||||
|
|
||||||
// From v1.0.9 to permit disable or configure NTP from sketch
|
////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// To permit disable or configure NTP from sketch
|
||||||
#ifndef USE_ESP_WIFIMANAGER_NTP
|
#ifndef USE_ESP_WIFIMANAGER_NTP
|
||||||
// From v1.0.6 to enable NTP config
|
// To enable NTP config
|
||||||
#define USE_ESP_WIFIMANAGER_NTP true
|
#define USE_ESP_WIFIMANAGER_NTP true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if USE_ESP_WIFIMANAGER_NTP
|
#if USE_ESP_WIFIMANAGER_NTP
|
||||||
|
|
||||||
#include "utils/TZ.h"
|
#include "utils/TZ.h"
|
||||||
@ -219,38 +249,62 @@ const char WM_HTTP_SCRIPT_NTP[] PROGMEM = "<script>(function(e){var t=function()
|
|||||||
const char WM_HTTP_SCRIPT_NTP[] PROGMEM = "";
|
const char WM_HTTP_SCRIPT_NTP[] PROGMEM = "";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// KH, update from v1.0.10
|
////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
const char WM_HTTP_HEAD_END[] PROGMEM = "</head><body><div class='container'><div style='text-align:left;display:inline-block;min-width:260px;'>";
|
const char WM_HTTP_HEAD_END[] PROGMEM = "</head><body><div class='container'><div style='text-align:left;display:inline-block;min-width:260px;'>";
|
||||||
|
|
||||||
const char WM_FLDSET_START[] PROGMEM = "<fieldset>";
|
const char WM_FLDSET_START[] PROGMEM = "<fieldset>";
|
||||||
const char WM_FLDSET_END[] PROGMEM = "</fieldset>";
|
const char WM_FLDSET_END[] PROGMEM = "</fieldset>";
|
||||||
//////
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
const char WM_HTTP_PORTAL_OPTIONS[] PROGMEM = "<form action='/wifi' method='get'><button class='btn'>Configuration</button></form><br/><form action='/i' method='get'><button class='btn'>Information</button></form><br/><form action='/close' method='get'><button class='btn'>Exit Portal</button></form><br/>";
|
const char WM_HTTP_PORTAL_OPTIONS[] PROGMEM = "<form action='/wifi' method='get'><button class='btn'>Configuration</button></form><br/><form action='/i' method='get'><button class='btn'>Information</button></form><br/><form action='/close' method='get'><button class='btn'>Exit Portal</button></form><br/>";
|
||||||
const char WM_HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)'>{v}</a> <span class='q {i}'>{r}%</span></div>";
|
const char WM_HTTP_ITEM[] PROGMEM = "<div><a href='#p' onclick='c(this)'>{v}</a> <span class='q {i}'>{r}%</span></div>";
|
||||||
const char JSON_ITEM[] PROGMEM = "{\"SSID\":\"{v}\", \"Encryption\":{i}, \"Quality\":\"{r}\"}";
|
const char JSON_ITEM[] PROGMEM = "{\"SSID\":\"{v}\", \"Encryption\":{i}, \"Quality\":\"{r}\"}";
|
||||||
|
|
||||||
// KH, update from v1.1.0
|
////////////////////////////////////////////////////
|
||||||
const char WM_HTTP_FORM_START[] PROGMEM = "<form method='get' action='wifisave'><fieldset><div><label>SSID</label><input id='s' name='s' length=32 placeholder='SSID'><div></div></div><div><label>Password</label><input id='p' name='p' length=64 placeholder='password'><div></div></div><div><label>SSID1</label><input id='s1' name='s1' length=32 placeholder='SSID1'><div></div></div><div><label>Password</label><input id='p1' name='p1' length=64 placeholder='password1'><div></div></div></fieldset>";
|
|
||||||
//////
|
// KH, update from v1.12.0
|
||||||
|
// To permit display stored Credentials on CP
|
||||||
|
#ifndef DISPLAY_STORED_CREDENTIALS_IN_CP
|
||||||
|
#define DISPLAY_STORED_CREDENTIALS_IN_CP true
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ( (_WIFIMGR_LOGLEVEL_ > 3) && DISPLAY_STORED_CREDENTIALS_IN_CP )
|
||||||
|
#warning Enable DISPLAY_STORED_CREDENTIALS_IN_CP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DISPLAY_STORED_CREDENTIALS_IN_CP
|
||||||
|
const char WM_HTTP_FORM_START[] PROGMEM = "<form method='get' action='wifisave'><fieldset><div><label>SSID</label><input value='[[ssid]]' id='s' name='s' length=32 placeholder='SSID'><div></div></div><div><label>Password</label><input value='[[pwd]]' id='p' name='p' length=64 placeholder='password'><div></div></div><div><label>SSID1</label><input value='[[ssid1]]' id='s1' name='s1' length=32 placeholder='SSID1'><div></div></div><div><label>Password</label><input value='[[pwd1]]' id='p1' name='p1' length=64 placeholder='password1'><div></div></div></fieldset>";
|
||||||
|
#else
|
||||||
|
const char WM_HTTP_FORM_START[] PROGMEM = "<form method='get' action='wifisave'><fieldset><div><label>SSID</label><input id='s' name='s' length=32 placeholder='SSID'><div></div></div><div><label>Password</label><input id='p' name='p' length=64 placeholder='password'><div></div></div><div><label>SSID1</label><input id='s1' name='s1' length=32 placeholder='SSID1'><div></div></div><div><label>Password</label><input id='p1' name='p1' length=64 placeholder='password1'><div></div></div></fieldset>";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
// KH, add from v1.0.10
|
|
||||||
const char WM_HTTP_FORM_LABEL_BEFORE[] PROGMEM = "<div><label for='{i}'>{p}</label><input id='{i}' name='{n}' length={l} placeholder='{p}' value='{v}' {c}><div></div></div>";
|
const char WM_HTTP_FORM_LABEL_BEFORE[] PROGMEM = "<div><label for='{i}'>{p}</label><input id='{i}' name='{n}' length={l} placeholder='{p}' value='{v}' {c}><div></div></div>";
|
||||||
const char WM_HTTP_FORM_LABEL_AFTER[] PROGMEM = "<div><input id='{i}' name='{n}' length={l} placeholder='{p}' value='{v}' {c}><label for='{i}'>{p}</label><div></div></div>";
|
const char WM_HTTP_FORM_LABEL_AFTER[] PROGMEM = "<div><input id='{i}' name='{n}' length={l} placeholder='{p}' value='{v}' {c}><label for='{i}'>{p}</label><div></div></div>";
|
||||||
//////
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
const char WM_HTTP_FORM_LABEL[] PROGMEM = "<label for='{i}'>{p}</label>";
|
const char WM_HTTP_FORM_LABEL[] PROGMEM = "<label for='{i}'>{p}</label>";
|
||||||
const char WM_HTTP_FORM_PARAM[] PROGMEM = "<input id='{i}' name='{n}' length={l} placeholder='{p}' value='{v}' {c}>";
|
const char WM_HTTP_FORM_PARAM[] PROGMEM = "<input id='{i}' name='{n}' length={l} placeholder='{p}' value='{v}' {c}>";
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
const char WM_HTTP_FORM_END[] PROGMEM = "<button class='btn' type='submit'>Save</button></form>";
|
const char WM_HTTP_FORM_END[] PROGMEM = "<button class='btn' type='submit'>Save</button></form>";
|
||||||
|
|
||||||
// KH, update from v1.1.0
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
const char WM_HTTP_SAVED[] PROGMEM = "<div class='msg'><b>Credentials Saved</b><br>Try connecting ESP to the {x}/{x1} network. Wait around 10 seconds then check <a href='/'>if it's OK.</a> <p/>The {v} AP will run on the same WiFi channel of the {x}/{x1} AP. You may have to manually reconnect to the {v} AP.</div>";
|
const char WM_HTTP_SAVED[] PROGMEM = "<div class='msg'><b>Credentials Saved</b><br>Try connecting ESP to the {x}/{x1} network. Wait around 10 seconds then check <a href='/'>if it's OK.</a> <p/>The {v} AP will run on the same WiFi channel of the {x}/{x1} AP. You may have to manually reconnect to the {v} AP.</div>";
|
||||||
//////
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
const char WM_HTTP_END[] PROGMEM = "</div></body></html>";
|
const char WM_HTTP_END[] PROGMEM = "</div></body></html>";
|
||||||
|
|
||||||
//KH, from v1.1.0
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
const char WM_HTTP_HEAD_CL[] PROGMEM = "Content-Length";
|
const char WM_HTTP_HEAD_CL[] PROGMEM = "Content-Length";
|
||||||
const char WM_HTTP_HEAD_CT[] PROGMEM = "text/html";
|
const char WM_HTTP_HEAD_CT[] PROGMEM = "text/html";
|
||||||
const char WM_HTTP_HEAD_CT2[] PROGMEM = "text/plain";
|
const char WM_HTTP_HEAD_CT2[] PROGMEM = "text/plain";
|
||||||
@ -264,6 +318,8 @@ const char WM_HTTP_EXPIRES[] PROGMEM = "Expires";
|
|||||||
const char WM_HTTP_CORS[] PROGMEM = "Access-Control-Allow-Origin";
|
const char WM_HTTP_CORS[] PROGMEM = "Access-Control-Allow-Origin";
|
||||||
const char WM_HTTP_CORS_ALLOW_ALL[] PROGMEM = "*";
|
const char WM_HTTP_CORS_ALLOW_ALL[] PROGMEM = "*";
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if USE_AVAILABLE_PAGES
|
#if USE_AVAILABLE_PAGES
|
||||||
const char WM_HTTP_AVAILABLE_PAGES[] PROGMEM = "<h3>Available Pages</h3><table class='table'><thead><tr><th>Page</th><th>Function</th></tr></thead><tbody><tr><td><a href='/'>/</a></td><td>Menu page.</td></tr><tr><td><a href='/wifi'>/wifi</a></td><td>Show WiFi scan results and enter WiFi configuration.</td></tr><tr><td><a href='/wifisave'>/wifisave</a></td><td>Save WiFi configuration information and configure device. Needs variables supplied.</td></tr><tr><td><a href='/close'>/close</a></td><td>Close the configuration server and configuration WiFi network.</td></tr><tr><td><a href='/i'>/i</a></td><td>This page.</td></tr><tr><td><a href='/r'>/r</a></td><td>Delete WiFi configuration and reboot. ESP device will not reconnect to a network until new WiFi configuration data is entered.</td></tr><tr><td><a href='/state'>/state</a></td><td>Current device state in JSON format. Interface for programmatic WiFi configuration.</td></tr><tr><td><a href='/scan'>/scan</a></td><td>Run a WiFi scan and return results in JSON format. Interface for programmatic WiFi configuration.</td></tr></table>";
|
const char WM_HTTP_AVAILABLE_PAGES[] PROGMEM = "<h3>Available Pages</h3><table class='table'><thead><tr><th>Page</th><th>Function</th></tr></thead><tbody><tr><td><a href='/'>/</a></td><td>Menu page.</td></tr><tr><td><a href='/wifi'>/wifi</a></td><td>Show WiFi scan results and enter WiFi configuration.</td></tr><tr><td><a href='/wifisave'>/wifisave</a></td><td>Save WiFi configuration information and configure device. Needs variables supplied.</td></tr><tr><td><a href='/close'>/close</a></td><td>Close the configuration server and configuration WiFi network.</td></tr><tr><td><a href='/i'>/i</a></td><td>This page.</td></tr><tr><td><a href='/r'>/r</a></td><td>Delete WiFi configuration and reboot. ESP device will not reconnect to a network until new WiFi configuration data is entered.</td></tr><tr><td><a href='/state'>/state</a></td><td>Current device state in JSON format. Interface for programmatic WiFi configuration.</td></tr><tr><td><a href='/scan'>/scan</a></td><td>Run a WiFi scan and return results in JSON format. Interface for programmatic WiFi configuration.</td></tr></table>";
|
||||||
#else
|
#else
|
||||||
@ -273,8 +329,8 @@ const char WM_HTTP_AVAILABLE_PAGES[] PROGMEM = "";
|
|||||||
//KH
|
//KH
|
||||||
#define WIFI_MANAGER_MAX_PARAMS 20
|
#define WIFI_MANAGER_MAX_PARAMS 20
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
// New in v1.4.0
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
const char *_id;
|
const char *_id;
|
||||||
@ -284,7 +340,9 @@ typedef struct
|
|||||||
int _labelPlacement;
|
int _labelPlacement;
|
||||||
|
|
||||||
} WMParam_Data;
|
} WMParam_Data;
|
||||||
//////
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
class ESP_WMParameter
|
class ESP_WMParameter
|
||||||
{
|
{
|
||||||
@ -293,16 +351,12 @@ class ESP_WMParameter
|
|||||||
ESP_WMParameter(const char *id, const char *placeholder, const char *defaultValue, const int& length,
|
ESP_WMParameter(const char *id, const char *placeholder, const char *defaultValue, const int& length,
|
||||||
const char *custom = "", const int& labelPlacement = WFM_LABEL_BEFORE);
|
const char *custom = "", const int& labelPlacement = WFM_LABEL_BEFORE);
|
||||||
|
|
||||||
// New in v1.4.0
|
|
||||||
ESP_WMParameter(const WMParam_Data& WMParam_data);
|
ESP_WMParameter(const WMParam_Data& WMParam_data);
|
||||||
//////
|
|
||||||
|
|
||||||
~ESP_WMParameter();
|
~ESP_WMParameter();
|
||||||
|
|
||||||
// New in v1.4.0
|
|
||||||
void setWMParam_Data(const WMParam_Data& WMParam_data);
|
void setWMParam_Data(const WMParam_Data& WMParam_data);
|
||||||
void getWMParam_Data(WMParam_Data& WMParam_data);
|
void getWMParam_Data(WMParam_Data& WMParam_data);
|
||||||
//////
|
|
||||||
|
|
||||||
const char *getID();
|
const char *getID();
|
||||||
const char *getValue();
|
const char *getValue();
|
||||||
@ -323,6 +377,8 @@ class ESP_WMParameter
|
|||||||
friend class ESP_WiFiManager;
|
friend class ESP_WiFiManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define USE_DYNAMIC_PARAMS true
|
#define USE_DYNAMIC_PARAMS true
|
||||||
#define DEFAULT_PORTAL_TIMEOUT 60000L
|
#define DEFAULT_PORTAL_TIMEOUT 60000L
|
||||||
|
|
||||||
@ -332,6 +388,9 @@ class ESP_WMParameter
|
|||||||
#define USE_STATIC_IP_CONFIG_IN_CP true
|
#define USE_STATIC_IP_CONFIG_IN_CP true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
class ESP_WiFiManager
|
class ESP_WiFiManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -340,10 +399,9 @@ class ESP_WiFiManager
|
|||||||
|
|
||||||
~ESP_WiFiManager();
|
~ESP_WiFiManager();
|
||||||
|
|
||||||
// Update feature from v1.0.11. Can use with STA staticIP now
|
// Can use with STA staticIP now
|
||||||
bool autoConnect();
|
bool autoConnect();
|
||||||
bool autoConnect(char const *apName, char const *apPassword = NULL);
|
bool autoConnect(char const *apName, char const *apPassword = NULL);
|
||||||
//////
|
|
||||||
|
|
||||||
//if you want to start the config portal
|
//if you want to start the config portal
|
||||||
bool startConfigPortal();
|
bool startConfigPortal();
|
||||||
@ -351,6 +409,7 @@ class ESP_WiFiManager
|
|||||||
|
|
||||||
// get the AP name of the config portal, so it can be used in the callback
|
// get the AP name of the config portal, so it can be used in the callback
|
||||||
String getConfigPortalSSID();
|
String getConfigPortalSSID();
|
||||||
|
|
||||||
// get the AP password of the config portal, so it can be used in the callback
|
// get the AP password of the config portal, so it can be used in the callback
|
||||||
String getConfigPortalPW();
|
String getConfigPortalPW();
|
||||||
|
|
||||||
@ -365,30 +424,25 @@ class ESP_WiFiManager
|
|||||||
//sets timeout for which to attempt connecting, usefull if you get a lot of failed connects
|
//sets timeout for which to attempt connecting, usefull if you get a lot of failed connects
|
||||||
void setConnectTimeout(const unsigned long& seconds);
|
void setConnectTimeout(const unsigned long& seconds);
|
||||||
|
|
||||||
|
|
||||||
void setDebugOutput(bool debug);
|
void setDebugOutput(bool debug);
|
||||||
//defaults to not showing anything under 8% signal quality if called
|
//defaults to not showing anything under 8% signal quality if called
|
||||||
void setMinimumSignalQuality(const int& quality = 8);
|
void setMinimumSignalQuality(const int& quality = 8);
|
||||||
|
|
||||||
// KH, new from v1.0.10 to enable dynamic/random channel
|
// KH, To enable dynamic/random channel
|
||||||
int setConfigPortalChannel(const int& channel = 1);
|
int setConfigPortalChannel(const int& channel = 1);
|
||||||
//////
|
//////
|
||||||
|
|
||||||
//sets a custom ip /gateway /subnet configuration
|
//sets a custom ip /gateway /subnet configuration
|
||||||
void setAPStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn);
|
void setAPStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn);
|
||||||
|
|
||||||
// New in v1.4.0
|
|
||||||
void setAPStaticIPConfig(const WiFi_AP_IPConfig& WM_AP_IPconfig);
|
void setAPStaticIPConfig(const WiFi_AP_IPConfig& WM_AP_IPconfig);
|
||||||
void getAPStaticIPConfig(WiFi_AP_IPConfig& WM_AP_IPconfig);
|
void getAPStaticIPConfig(WiFi_AP_IPConfig& WM_AP_IPconfig);
|
||||||
//////
|
|
||||||
|
|
||||||
//sets config for a static IP
|
//sets config for a static IP
|
||||||
void setSTAStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn);
|
void setSTAStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn);
|
||||||
|
|
||||||
// New in v1.4.0
|
|
||||||
void setSTAStaticIPConfig(const WiFi_STA_IPConfig& WM_STA_IPconfig);
|
void setSTAStaticIPConfig(const WiFi_STA_IPConfig& WM_STA_IPconfig);
|
||||||
void getSTAStaticIPConfig(WiFi_STA_IPConfig& WM_STA_IPconfig);
|
void getSTAStaticIPConfig(WiFi_STA_IPConfig& WM_STA_IPconfig);
|
||||||
//////
|
|
||||||
|
|
||||||
#if USE_CONFIGURABLE_DNS
|
#if USE_CONFIGURABLE_DNS
|
||||||
void setSTAStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn,
|
void setSTAStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn,
|
||||||
@ -397,6 +451,7 @@ class ESP_WiFiManager
|
|||||||
|
|
||||||
//called when AP mode and config portal is started
|
//called when AP mode and config portal is started
|
||||||
void setAPCallback(void(*func)(ESP_WiFiManager*));
|
void setAPCallback(void(*func)(ESP_WiFiManager*));
|
||||||
|
|
||||||
//called when settings have been changed and connection was successful
|
//called when settings have been changed and connection was successful
|
||||||
void setSaveConfigCallback(void(*func)());
|
void setSaveConfigCallback(void(*func)());
|
||||||
|
|
||||||
@ -410,37 +465,61 @@ class ESP_WiFiManager
|
|||||||
|
|
||||||
//if this is set, it will exit after config, even if connection is unsucessful.
|
//if this is set, it will exit after config, even if connection is unsucessful.
|
||||||
void setBreakAfterConfig(bool shouldBreak);
|
void setBreakAfterConfig(bool shouldBreak);
|
||||||
|
|
||||||
//if this is set, try WPS setup when starting (this will delay config portal for up to 2 mins)
|
//if this is set, try WPS setup when starting (this will delay config portal for up to 2 mins)
|
||||||
//TODO
|
//TODO
|
||||||
//if this is set, customise style
|
//if this is set, customise style
|
||||||
void setCustomHeadElement(const char* element);
|
void setCustomHeadElement(const char* element);
|
||||||
|
|
||||||
//if this is true, remove duplicated Access Points - defaut true
|
//if this is true, remove duplicated Access Points - defaut true
|
||||||
void setRemoveDuplicateAPs(bool removeDuplicates);
|
void setRemoveDuplicateAPs(bool removeDuplicates);
|
||||||
|
|
||||||
//Scan for WiFiNetworks in range and sort by signal strength
|
//Scan for WiFiNetworks in range and sort by signal strength
|
||||||
//space for indices array allocated on the heap and should be freed when no longer required
|
//space for indices array allocated on the heap and should be freed when no longer required
|
||||||
int scanWifiNetworks(int **indicesptr);
|
int scanWifiNetworks(int **indicesptr);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// KH add to display SSIDs and PWDs in CP
|
||||||
|
void setCredentials(const char* ssid, const char* pwd, const char* ssid1, const char* pwd1)
|
||||||
|
{
|
||||||
|
_ssid = String(ssid);
|
||||||
|
_pass = String(pwd);
|
||||||
|
_ssid1 = String(ssid1);
|
||||||
|
_pass1 = String(pwd1);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setCredentials(String & ssid, String & pwd, String & ssid1, String & pwd1)
|
||||||
|
{
|
||||||
|
_ssid = ssid;
|
||||||
|
_pass = pwd;
|
||||||
|
_ssid1 = ssid1;
|
||||||
|
_pass1 = pwd1;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
// return SSID of router in STA mode got from config portal. NULL if no user's input //KH
|
// return SSID of router in STA mode got from config portal. NULL if no user's input //KH
|
||||||
String getSSID()
|
inline String getSSID()
|
||||||
{
|
{
|
||||||
return _ssid;
|
return _ssid;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return password of router in STA mode got from config portal. NULL if no user's input //KH
|
// return password of router in STA mode got from config portal. NULL if no user's input //KH
|
||||||
String getPW()
|
inline String getPW()
|
||||||
{
|
{
|
||||||
return _pass;
|
return _pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
// New from v1.1.0
|
// New from v1.1.0
|
||||||
// return SSID of router in STA mode got from config portal. NULL if no user's input //KH
|
// return SSID of router in STA mode got from config portal. NULL if no user's input //KH
|
||||||
String getSSID1()
|
inline String getSSID1()
|
||||||
{
|
{
|
||||||
return _ssid1;
|
return _ssid1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return password of router in STA mode got from config portal. NULL if no user's input //KH
|
// return password of router in STA mode got from config portal. NULL if no user's input //KH
|
||||||
String getPW1()
|
inline String getPW1()
|
||||||
{
|
{
|
||||||
return _pass1;
|
return _pass1;
|
||||||
}
|
}
|
||||||
@ -466,9 +545,10 @@ class ESP_WiFiManager
|
|||||||
else
|
else
|
||||||
return String("");
|
return String("");
|
||||||
}
|
}
|
||||||
//////
|
|
||||||
|
|
||||||
// New from v1.1.1, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// New For configuring CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
||||||
#if USING_CORS_FEATURE
|
#if USING_CORS_FEATURE
|
||||||
void setCORSHeader(const char* CORSHeaders)
|
void setCORSHeader(const char* CORSHeaders)
|
||||||
{
|
{
|
||||||
@ -477,12 +557,14 @@ class ESP_WiFiManager
|
|||||||
LOGWARN1(F("Set CORS Header to : "), _CORS_Header);
|
LOGWARN1(F("Set CORS Header to : "), _CORS_Header);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* getCORSHeader()
|
inline const char* getCORSHeader()
|
||||||
{
|
{
|
||||||
return _CORS_Header;
|
return _CORS_Header;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
//returns the list of Parameters
|
//returns the list of Parameters
|
||||||
ESP_WMParameter** getParameters();
|
ESP_WMParameter** getParameters();
|
||||||
// returns the Parameters Count
|
// returns the Parameters Count
|
||||||
@ -495,7 +577,7 @@ class ESP_WiFiManager
|
|||||||
String getStoredWiFiPass();
|
String getStoredWiFiPass();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String WiFi_SSID()
|
inline String WiFi_SSID()
|
||||||
{
|
{
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
return WiFi.SSID();
|
return WiFi.SSID();
|
||||||
@ -504,7 +586,7 @@ class ESP_WiFiManager
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
String WiFi_Pass()
|
inline String WiFi_Pass()
|
||||||
{
|
{
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
return WiFi.psk();
|
return WiFi.psk();
|
||||||
@ -538,18 +620,19 @@ class ESP_WiFiManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if USE_ESP_WIFIMANAGER_NTP
|
#if USE_ESP_WIFIMANAGER_NTP
|
||||||
|
|
||||||
String getTimezoneName()
|
inline String getTimezoneName()
|
||||||
{
|
{
|
||||||
return _timezoneName;
|
return _timezoneName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTimezoneName(const String& inTimezoneName)
|
inline void setTimezoneName(const String& inTimezoneName)
|
||||||
{
|
{
|
||||||
_timezoneName = inTimezoneName;
|
_timezoneName = inTimezoneName;
|
||||||
}
|
}
|
||||||
//////
|
|
||||||
|
|
||||||
//See: https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
|
//See: https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
|
||||||
// EST5EDT,M3.2.0,M11.1.0 (for America/New_York)
|
// EST5EDT,M3.2.0,M11.1.0 (for America/New_York)
|
||||||
@ -584,10 +667,10 @@ class ESP_WiFiManager
|
|||||||
{
|
{
|
||||||
return getTZ(timezoneName.c_str());
|
return getTZ(timezoneName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<DNSServer> dnsServer;
|
std::unique_ptr<DNSServer> dnsServer;
|
||||||
|
|
||||||
@ -613,16 +696,18 @@ class ESP_WiFiManager
|
|||||||
String _ssid = "";
|
String _ssid = "";
|
||||||
String _pass = "";
|
String _pass = "";
|
||||||
|
|
||||||
// New from v1.1.0
|
|
||||||
String _ssid1 = "";
|
String _ssid1 = "";
|
||||||
String _pass1 = "";
|
String _pass1 = "";
|
||||||
//////
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if USE_ESP_WIFIMANAGER_NTP
|
#if USE_ESP_WIFIMANAGER_NTP
|
||||||
// Timezone info
|
// Timezone info
|
||||||
String _timezoneName = "";
|
String _timezoneName = "";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
unsigned long _configPortalTimeout = 0;
|
unsigned long _configPortalTimeout = 0;
|
||||||
|
|
||||||
unsigned long _connectTimeout = 0;
|
unsigned long _connectTimeout = 0;
|
||||||
@ -631,20 +716,19 @@ class ESP_WiFiManager
|
|||||||
int numberOfNetworks;
|
int numberOfNetworks;
|
||||||
int *networkIndices;
|
int *networkIndices;
|
||||||
|
|
||||||
// KH, new from v1.0.10 to enable dynamic/random channel
|
// KH, To enable dynamic/random channel
|
||||||
// default to channel 1
|
// default to channel 1
|
||||||
#define MIN_WIFI_CHANNEL 1
|
#define MIN_WIFI_CHANNEL 1
|
||||||
#define MAX_WIFI_CHANNEL 11 // Channel 12,13 is flaky, because of bad number 13 ;-)
|
#define MAX_WIFI_CHANNEL 11 // Channel 12,13 is flaky, because of bad number 13 ;-)
|
||||||
|
|
||||||
int _WiFiAPChannel = 1;
|
int _WiFiAPChannel = 1;
|
||||||
//////
|
|
||||||
|
|
||||||
// New in v1.4.0
|
|
||||||
WiFi_AP_IPConfig _WiFi_AP_IPconfig;
|
WiFi_AP_IPConfig _WiFi_AP_IPconfig;
|
||||||
|
|
||||||
WiFi_STA_IPConfig _WiFi_STA_IPconfig = { IPAddress(0, 0, 0, 0), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
|
WiFi_STA_IPConfig _WiFi_STA_IPconfig = { IPAddress(0, 0, 0, 0), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
|
||||||
IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8) };
|
IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8) };
|
||||||
//////
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
int _paramsCount = 0;
|
int _paramsCount = 0;
|
||||||
int _minimumQuality = -1;
|
int _minimumQuality = -1;
|
||||||
@ -656,22 +740,14 @@ class ESP_WiFiManager
|
|||||||
|
|
||||||
int status = WL_IDLE_STATUS;
|
int status = WL_IDLE_STATUS;
|
||||||
|
|
||||||
// New from v1.1.0, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
// For configuring CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
||||||
#if USING_CORS_FEATURE
|
#if USING_CORS_FEATURE
|
||||||
const char* _CORS_Header = WM_HTTP_CORS_ALLOW_ALL; //"*";
|
const char* _CORS_Header = WM_HTTP_CORS_ALLOW_ALL; //"*";
|
||||||
#endif
|
#endif
|
||||||
//////
|
|
||||||
|
|
||||||
// New v1.0.8
|
|
||||||
void setWifiStaticIP();
|
void setWifiStaticIP();
|
||||||
|
|
||||||
// New v1.1.0
|
|
||||||
int reconnectWifi();
|
int reconnectWifi();
|
||||||
//////
|
|
||||||
|
|
||||||
// New v1.0.11
|
|
||||||
int connectWifi(const String& ssid = "", const String& pass = "");
|
int connectWifi(const String& ssid = "", const String& pass = "");
|
||||||
//////
|
|
||||||
|
|
||||||
uint8_t waitForConnectResult();
|
uint8_t waitForConnectResult();
|
||||||
|
|
||||||
@ -704,6 +780,8 @@ class ESP_WiFiManager
|
|||||||
void(*_apcallback) (ESP_WiFiManager*) = NULL;
|
void(*_apcallback) (ESP_WiFiManager*) = NULL;
|
||||||
void(*_savecallback)() = NULL;
|
void(*_savecallback)() = NULL;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if USE_DYNAMIC_PARAMS
|
#if USE_DYNAMIC_PARAMS
|
||||||
int _max_params;
|
int _max_params;
|
||||||
ESP_WMParameter** _params;
|
ESP_WMParameter** _params;
|
||||||
@ -711,6 +789,8 @@ class ESP_WiFiManager
|
|||||||
ESP_WMParameter* _params[WIFI_MANAGER_MAX_PARAMS];
|
ESP_WMParameter* _params[WIFI_MANAGER_MAX_PARAMS];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
template <typename Generic>
|
template <typename Generic>
|
||||||
void DEBUG_WM(Generic text);
|
void DEBUG_WM(Generic text);
|
||||||
|
|
||||||
@ -723,9 +803,12 @@ class ESP_WiFiManager
|
|||||||
auto optionalIPFromString(...) -> bool
|
auto optionalIPFromString(...) -> bool
|
||||||
{
|
{
|
||||||
LOGINFO("NO fromString METHOD ON IPAddress, you need ESP8266 core 2.1.0 or newer for Custom IP configuration to work.");
|
LOGINFO("NO fromString METHOD ON IPAddress, you need ESP8266 core 2.1.0 or newer for Custom IP configuration to work.");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////
|
||||||
|
|
||||||
#endif // ESP_WiFiManager_h
|
#endif // ESP_WiFiManager_h
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
|
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
|
||||||
Licensed under MIT license
|
Licensed under MIT license
|
||||||
|
|
||||||
Version: 1.11.0
|
Version: 1.12.1
|
||||||
|
|
||||||
Version Modified By Date Comments
|
Version Modified By Date Comments
|
||||||
------- ----------- ---------- -----------
|
------- ----------- ---------- -----------
|
||||||
@ -28,6 +28,8 @@
|
|||||||
1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
|
1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+
|
||||||
1.10.2 K Hoang 13/03/2022 Send CORS header in handleWifiSave() function
|
1.10.2 K Hoang 13/03/2022 Send CORS header in handleWifiSave() function
|
||||||
1.11.0 K Hoang 09/09/2022 Fix ESP32 chipID and add ESP_getChipOUI()
|
1.11.0 K Hoang 09/09/2022 Fix ESP32 chipID and add ESP_getChipOUI()
|
||||||
|
1.12.0 K Hoang 07/10/2022 Optional display Credentials (SSIDs, PWDs) in Config Portal
|
||||||
|
1.12.1 K Hoang 25/10/2022 Using random channel for softAP without password. Add astyle using allman style
|
||||||
*****************************************************************************************************************************/
|
*****************************************************************************************************************************/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -35,12 +37,16 @@
|
|||||||
#ifndef ESP_WiFiManager_Debug_H
|
#ifndef ESP_WiFiManager_Debug_H
|
||||||
#define ESP_WiFiManager_Debug_H
|
#define ESP_WiFiManager_Debug_H
|
||||||
|
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef WIFIMGR_DEBUG_PORT
|
#ifdef WIFIMGR_DEBUG_PORT
|
||||||
#define WM_DBG_PORT WIFIMGR_DEBUG_PORT
|
#define WM_DBG_PORT WIFIMGR_DEBUG_PORT
|
||||||
#else
|
#else
|
||||||
#define WM_DBG_PORT Serial
|
#define WM_DBG_PORT Serial
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
// Change _WIFIMGR_LOGLEVEL_ to set tracing and logging verbosity
|
// Change _WIFIMGR_LOGLEVEL_ to set tracing and logging verbosity
|
||||||
// 0: DISABLED: no logging
|
// 0: DISABLED: no logging
|
||||||
// 1: ERROR: errors
|
// 1: ERROR: errors
|
||||||
@ -52,6 +58,8 @@
|
|||||||
#define _WIFIMGR_LOGLEVEL_ 0
|
#define _WIFIMGR_LOGLEVEL_ 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
const char WM_MARK[] = "[WM] ";
|
const char WM_MARK[] = "[WM] ";
|
||||||
const char WM_SP[] = " ";
|
const char WM_SP[] = " ";
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ include_dir = lib
|
|||||||
[common_env_data]
|
[common_env_data]
|
||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
platform = espressif8266 @ 4.0.1
|
platform = espressif8266 @ 4.1.0
|
||||||
platform32 = espressif32 @ 5.2.0
|
platform32 = espressif32 @ 6.0.0
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = d1_mini
|
board = d1_mini
|
||||||
build_unflags =
|
build_unflags =
|
||||||
@ -49,13 +49,13 @@ lib_deps =
|
|||||||
# https://github.com/mp-se/Arduino-Temperature-Control-Library
|
# https://github.com/mp-se/Arduino-Temperature-Control-Library
|
||||||
# https://github.com/khoih-prog/ESP_WiFiManager
|
# https://github.com/khoih-prog/ESP_WiFiManager
|
||||||
# https://github.com/khoih-prog/ESP_DoubleResetDetector
|
# https://github.com/khoih-prog/ESP_DoubleResetDetector
|
||||||
https://github.com/mp-se/tinyexpr # https://github.com/codeplea/tinyexpr
|
https://github.com/mp-se/tinyexpr#v1.0.0
|
||||||
https://github.com/mp-se/Arduino-Log#1.1.1 # https://github.com/thijse/Arduino-Log
|
https://github.com/mp-se/Arduino-Log#1.1.1
|
||||||
https://github.com/mp-se/ArduinoJson#v6.18.5 # https://github.com/bblanchon/ArduinoJson
|
https://github.com/mp-se/ArduinoJson#v6.20.0
|
||||||
https://github.com/mp-se/arduinoCurveFitting#v1.0.6 # https://github.com/Rotario/arduinoCurveFitting
|
https://github.com/mp-se/arduinoCurveFitting#v1.0.6
|
||||||
https://github.com/mp-se/arduino-mqtt#v2.5.0 # https://github.com/256dpi/arduino-mqtt
|
https://github.com/mp-se/arduino-mqtt#v2.5.1
|
||||||
lib_deps32 =
|
lib_deps32 =
|
||||||
https://github.com/mp-se/NimBLE-Arduino#1.3.8 # https://github.com/h2zero/NimBLE-Arduino
|
https://github.com/mp-se/NimBLE-Arduino#1.4.1
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
script/copy_firmware.py
|
script/copy_firmware.py
|
||||||
script/create_versionjson.py
|
script/create_versionjson.py
|
||||||
@ -118,7 +118,7 @@ build_flags =
|
|||||||
${common_env_data.build_flags}
|
${common_env_data.build_flags}
|
||||||
-D LOG_LEVEL=4
|
-D LOG_LEVEL=4
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/mp-se/incbin # https://github.com/graphitemaster/incbin
|
https://github.com/mp-se/incbin#v1.0.0
|
||||||
https://github.com/bxparks/AUnit#v1.6.1
|
https://github.com/bxparks/AUnit#v1.6.1
|
||||||
${common_env_data.lib_deps}
|
${common_env_data.lib_deps}
|
||||||
board = ${common_env_data.board}
|
board = ${common_env_data.board}
|
||||||
|
@ -3,6 +3,25 @@
|
|||||||
Releases
|
Releases
|
||||||
########
|
########
|
||||||
|
|
||||||
|
v1.3.0
|
||||||
|
======
|
||||||
|
|
||||||
|
Issues adressed
|
||||||
|
++++++++++++++++
|
||||||
|
* BUG: Clarified that its the bucket ID and auth TOKEN for influxdb (config page)
|
||||||
|
|
||||||
|
Other
|
||||||
|
+++++
|
||||||
|
* Updated platformio esp8266 to v4.1.0
|
||||||
|
* Updated platformio esp32 to v6.0.0
|
||||||
|
* Updated h2zero/NimBLE-Arduino to b 1.4.1
|
||||||
|
* Updated 256dpi/arduino-mqtt to v2.5.1
|
||||||
|
* Created tag v1.0.0 for codeplea/tinyexpr to get control over releases
|
||||||
|
* Created tag v1.0.0 for graphitemaster/incbin to get control over releases
|
||||||
|
* Updated bblanchon/ArduinoJson to v6.20.0
|
||||||
|
* Updated khoih-prog/ESP_WiFiManager to v1.12.1
|
||||||
|
* Updated khoih-prog/ESP_DoubleResetDetector to v1.3.2
|
||||||
|
|
||||||
v1.2.1
|
v1.2.1
|
||||||
======
|
======
|
||||||
|
|
||||||
@ -12,7 +31,7 @@ Issues adressed
|
|||||||
|
|
||||||
Other
|
Other
|
||||||
+++++
|
+++++
|
||||||
* Update tinyexpr library to latest baseline. For forumula evaluation.
|
* Update tinyexpr library to latest baseline (Used for forumula evaluation).
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
+++++++++++++
|
+++++++++++++
|
||||||
|
Loading…
Reference in New Issue
Block a user