Upgrade wifi libs
This commit is contained in:
@ -16,47 +16,18 @@
|
||||
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager
|
||||
Licensed under MIT license
|
||||
|
||||
Version: 1.8.0
|
||||
Version: 1.11.0
|
||||
|
||||
Version Modified By Date Comments
|
||||
------- ----------- ---------- -----------
|
||||
1.0.0 K Hoang 07/10/2019 Initial coding
|
||||
1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32
|
||||
1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL.
|
||||
1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples
|
||||
1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature.
|
||||
1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc
|
||||
1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 )
|
||||
1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md
|
||||
1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+
|
||||
1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal.
|
||||
Add, enhance examples (fix MDNS for ESP32)
|
||||
1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict.
|
||||
1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings.
|
||||
1.1.0 K Hoang 28/08/2020 Add MultiWiFi feature to autoconnect to best WiFi at runtime
|
||||
1.1.1 K Hoang 30/08/2020 Add setCORSHeader function to allow flexible CORS. Fix typo and minor improvement.
|
||||
1.1.2 K Hoang 17/08/2020 Fix bug. Add example.
|
||||
1.2.0 K Hoang 09/10/2020 Restore cpp code besides Impl.h code to use if linker error. Fix bug.
|
||||
1.3.0 K Hoang 04/12/2020 Add LittleFS support to ESP32 using LITTLEFS Library
|
||||
1.4.1 K Hoang 22/12/2020 Fix staticIP not saved. Add functions. Add complex examples. Sync with ESPAsync_WiFiManager
|
||||
1.4.2 K Hoang 14/01/2021 Fix examples' bug not using saved WiFi Credentials after losing all WiFi connections.
|
||||
1.4.3 K Hoang 23/01/2021 Fix examples' bug not saving Static IP in certain cases.
|
||||
1.5.0 K Hoang 12/02/2021 Add support to new ESP32-S2
|
||||
1.5.1 K Hoang 26/03/2021 Fix compiler error if setting Compiler Warnings to All. Retest with esp32 core v1.0.6
|
||||
1.5.2 K Hoang 08/04/2021 Fix example misleading messages.
|
||||
1.5.3 K Hoang 13/04/2021 Add dnsServer error message.
|
||||
1.6.0 K Hoang 20/04/2021 Add support to new ESP32-C3 using SPIFFS or EEPROM
|
||||
1.6.1 K Hoang 25/04/2021 Fix MultiWiFi bug. Fix captive-portal bug if CP AP address is not default 192.168.4.1
|
||||
1.7.0 K Hoang 06/05/2021 Set _timezoneName. Add support to new ESP32-S2 (METRO_ESP32S2, FUNHOUSE_ESP32S2, etc.)
|
||||
1.7.1 K Hoang 08/05/2021 Fix Json bug. Fix timezoneName not displayed in Info page.
|
||||
1.7.2 K Hoang 08/05/2021 Fix warnings with ESP8266 core v3.0.0
|
||||
1.7.3 K Hoang 29/07/2021 Fix MultiWiFi connection issue with ESP32 core v2.0.0-rc1+
|
||||
1.7.4 K Hoang 13/08/2021 Add WiFi scanning of hidden SSIDs
|
||||
1.7.5 K Hoang 10/10/2021 Update `platform.ini` and `library.json`
|
||||
1.7.6 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library
|
||||
1.7.7 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5-
|
||||
1.7.8 K Hoang 30/11/2021 Fix bug to permit using HTTP port different from 80. Fix bug
|
||||
1.8.0 K Hoang 29/12/2021 Enable compatibility with old code to include only ESP_WiFiManager.h
|
||||
...
|
||||
1.8.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp
|
||||
1.9.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h
|
||||
1.10.0 K Hoang 10/02/2022 Add support to new ESP32-S3
|
||||
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.11.0 K Hoang 09/09/2022 Fix ESP32 chipID and add ESP_getChipOUI()
|
||||
*****************************************************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
@ -80,7 +51,7 @@ ESP_WMParameter::ESP_WMParameter(const char *custom)
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
ESP_WMParameter::ESP_WMParameter(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom, 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);
|
||||
}
|
||||
@ -94,7 +65,7 @@ ESP_WMParameter::ESP_WMParameter(const WMParam_Data& WMParam_data)
|
||||
//////
|
||||
//////////////////////////////////////////
|
||||
|
||||
void ESP_WMParameter::init(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom, 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._placeholder = placeholder;
|
||||
@ -252,7 +223,8 @@ ESP_WiFiManager::ESP_WiFiManager(const char *iHostname)
|
||||
#ifdef ESP8266
|
||||
String _hostname = "ESP8266-" + String(ESP.getChipId(), HEX);
|
||||
#else //ESP32
|
||||
String _hostname = "ESP32-" + String((uint32_t)ESP.getEfuseMac(), HEX);
|
||||
String _hostname = "ESP32-" + String(ESP_getChipId(), HEX);
|
||||
|
||||
#endif
|
||||
_hostname.toUpperCase();
|
||||
|
||||
@ -461,7 +433,8 @@ bool ESP_WiFiManager::autoConnect()
|
||||
#ifdef ESP8266
|
||||
String ssid = "ESP_" + String(ESP.getChipId());
|
||||
#else //ESP32
|
||||
String ssid = "ESP_" + String((uint32_t)ESP.getEfuseMac());
|
||||
String ssid = "ESP_" + String(ESP_getChipId());
|
||||
|
||||
#endif
|
||||
|
||||
return autoConnect(ssid.c_str(), NULL);
|
||||
@ -522,7 +495,7 @@ bool ESP_WiFiManager::startConfigPortal()
|
||||
#ifdef ESP8266
|
||||
String ssid = "ESP_" + String(ESP.getChipId());
|
||||
#else //ESP32
|
||||
String ssid = "ESP_" + String((uint32_t)ESP.getEfuseMac());
|
||||
String ssid = "ESP_" + String(ESP_getChipId());
|
||||
#endif
|
||||
ssid.toUpperCase();
|
||||
|
||||
@ -864,7 +837,7 @@ void ESP_WiFiManager::startWPS()
|
||||
|
||||
//Convenient for debugging but wasteful of program space.
|
||||
//Remove if short of space
|
||||
const char* ESP_WiFiManager::getStatus(int status)
|
||||
const char* ESP_WiFiManager::getStatus(const int& status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
@ -920,21 +893,21 @@ void ESP_WiFiManager::resetSettings()
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
void ESP_WiFiManager::setTimeout(unsigned long seconds)
|
||||
void ESP_WiFiManager::setTimeout(const unsigned long& seconds)
|
||||
{
|
||||
setConfigPortalTimeout(seconds);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
void ESP_WiFiManager::setConfigPortalTimeout(unsigned long seconds)
|
||||
void ESP_WiFiManager::setConfigPortalTimeout(const unsigned long& seconds)
|
||||
{
|
||||
_configPortalTimeout = seconds * 1000;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
void ESP_WiFiManager::setConnectTimeout(unsigned long seconds)
|
||||
void ESP_WiFiManager::setConnectTimeout(const unsigned long& seconds)
|
||||
{
|
||||
_connectTimeout = seconds * 1000;
|
||||
}
|
||||
@ -949,7 +922,7 @@ void ESP_WiFiManager::setDebugOutput(bool debug)
|
||||
//////////////////////////////////////////
|
||||
|
||||
// KH, new from v1.0.10 to enable dynamic/random channel
|
||||
int ESP_WiFiManager::setConfigPortalChannel(int channel)
|
||||
int ESP_WiFiManager::setConfigPortalChannel(const int& channel)
|
||||
{
|
||||
// If channel < MIN_WIFI_CHANNEL - 1 or channel > MAX_WIFI_CHANNEL => channel = 1
|
||||
// If channel == 0 => will use random channel from MIN_WIFI_CHANNEL to MAX_WIFI_CHANNEL
|
||||
@ -1037,7 +1010,7 @@ void ESP_WiFiManager::setSTAStaticIPConfig(const IPAddress& ip, const IPAddress&
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
void ESP_WiFiManager::setMinimumSignalQuality(int quality)
|
||||
void ESP_WiFiManager::setMinimumSignalQuality(const int& quality)
|
||||
{
|
||||
_minimumQuality = quality;
|
||||
}
|
||||
@ -1392,6 +1365,11 @@ void ESP_WiFiManager::handleWifiSave()
|
||||
_pass1 = server->arg("p1").c_str();
|
||||
|
||||
///////////////////////
|
||||
|
||||
#if USING_CORS_FEATURE
|
||||
// New from v1.10.2, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*"
|
||||
server->sendHeader(FPSTR(WM_HTTP_CORS), _CORS_Header);
|
||||
#endif
|
||||
|
||||
#if USE_ESP_WIFIMANAGER_NTP
|
||||
|
||||
@ -1584,10 +1562,23 @@ void ESP_WiFiManager::handleInfo()
|
||||
page += F("<table class=\"table\">");
|
||||
page += F("<thead><tr><th>Name</th><th>Value</th></tr></thead><tbody><tr><td>Chip ID</td><td>");
|
||||
|
||||
page += F("0x");
|
||||
#ifdef ESP8266
|
||||
page += String(ESP.getChipId(), HEX); //ESP.getChipId();
|
||||
#else //ESP32
|
||||
page += String((uint32_t)ESP.getEfuseMac(), HEX); //ESP.getChipId();
|
||||
|
||||
page += String(ESP_getChipId(), HEX); //ESP.getChipId();
|
||||
|
||||
page += F("</td></tr>");
|
||||
page += F("<tr><td>Chip OUI</td><td>");
|
||||
page += F("0x");
|
||||
page += String(getChipOUI(), HEX); //ESP.getChipId();
|
||||
|
||||
page += F("</td></tr>");
|
||||
page += F("<tr><td>Chip Model</td><td>");
|
||||
page += ESP.getChipModel();
|
||||
page += F(" Rev");
|
||||
page += ESP.getChipRevision();
|
||||
#endif
|
||||
|
||||
page += F("</td></tr>");
|
||||
@ -2019,7 +2010,7 @@ int ESP_WiFiManager::scanWifiNetworks(int **indicesptr)
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
int ESP_WiFiManager::getRSSIasQuality(int RSSI)
|
||||
int ESP_WiFiManager::getRSSIasQuality(const int& RSSI)
|
||||
{
|
||||
int quality = 0;
|
||||
|
||||
@ -2116,6 +2107,31 @@ String ESP_WiFiManager::getStoredWiFiPass()
|
||||
|
||||
return String(reinterpret_cast<char*>(conf.sta.password));
|
||||
}
|
||||
|
||||
uint32_t getChipID()
|
||||
{
|
||||
uint64_t chipId64 = 0;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
chipId64 |= ( ( (uint64_t) ESP.getEfuseMac() >> (40 - (i * 8)) ) & 0xff ) << (i * 8);
|
||||
}
|
||||
|
||||
return (uint32_t) (chipId64 & 0xFFFFFF);
|
||||
}
|
||||
|
||||
uint32_t getChipOUI()
|
||||
{
|
||||
uint64_t chipId64 = 0;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
chipId64 |= ( ( (uint64_t) ESP.getEfuseMac() >> (40 - (i * 8)) ) & 0xff ) << (i * 8);
|
||||
}
|
||||
|
||||
return (uint32_t) (chipId64 >> 24);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user