Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
v1.15.0 to optionally display Credentials
Browse files Browse the repository at this point in the history
### Releases v1.15.0

1. Optionally display Credentials (SSIDs, PWDs) in Config Portal. Check [Populate portal wifi with saved credentials #91](khoih-prog/ESP_WiFiManager#91) and [Prepopulating the configuration with SSID and Password from stored file #115](#115)
2. Display `Credentials` Hint on Config Portal
3. Periodic code clean-up
  • Loading branch information
khoih-prog authored Oct 8, 2022
1 parent d343abb commit 703b82e
Show file tree
Hide file tree
Showing 30 changed files with 514 additions and 187 deletions.
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p

### How to submit a bug report

Please ensure to specify the following:
Please ensure to specify the following, or your post will be ignored and deleted:

* Arduino IDE version (e.g. 1.8.19) or Platform.io version
* `ESP8266` or `ESP32` Core Version (e.g. ESP8266 core v3.0.2 or ESP32 v2.0.4)
* `ESP8266` or `ESP32` Core Version (e.g. ESP8266 core v3.0.2 or ESP32 v2.0.5)
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
* Anything that might be relevant in your opinion, such as:
Expand All @@ -39,10 +39,10 @@ Please ensure to specify the following:
Arduino IDE version: 1.8.19
ESP8266 Core Version 3.0.2
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Linux xy-Inspiron-3593 5.15.0-48-generic #54~20.04.1-Ubuntu SMP Thu Sep 1 16:17:26 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Context:
I encountered an endless loop while trying to connect to Local WiFi.
I encountered a crash when using this library
Steps to reproduce:
1. ...
Expand Down
Binary file modified Images/Configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
## Table of Contents

* [Changelog](#changelog)
* [Releases v1.15.0](#releases-v1150)
* [Releases v1.14.1](#releases-v1141)
* [Releases v1.14.0](#releases-v1140)
* [Releases v1.13.0](#releases-v1130)
Expand Down Expand Up @@ -53,6 +54,12 @@

## Changelog

### Releases v1.15.0

1. Optionally display Credentials (SSIDs, PWDs) in Config Portal. Check [Populate portal wifi with saved credentials #91](https://github.com/khoih-prog/ESP_WiFiManager/discussions/91) and [Prepopulating the configuration with SSID and Password from stored file #115](https://github.com/khoih-prog/ESPAsync_WiFiManager/discussions/115)
2. Display `Credentials` Hint on Config Portal
3. Periodic code clean-up

### Releases v1.14.1

1. Remove dependency on ESP_AsyncWebServer, ESPAsyncTCP and AsyncTCP in `library.properties`. Check ["no protocol" error #113](https://github.com/khoih-prog/ESPAsync_WiFiManager/issues/113)"
Expand Down
14 changes: 12 additions & 2 deletions examples/Async_AutoConnect/Async_AutoConnect.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
#endif

#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.14.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1014000
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.15.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1015000

// Use from 0 to 4. Higher number, more debugging messages and memory usage.
#define _ESPASYNC_WIFIMGR_LOGLEVEL_ 3

// To not display stored SSIDs and PWDs on Config Portal, select false. Default is true
// Even the stored Credentials are not display, just leave them all blank to reconnect and reuse the stored Credentials
//#define DISPLAY_STORED_CREDENTIALS_IN_CP false

//Ported to ESP32
#ifdef ESP32
#include <esp_wifi.h>
Expand Down Expand Up @@ -780,6 +784,12 @@ void setup()
Serial.print(F(", PWD = "));
Serial.println(AP_PASS);

#if DISPLAY_STORED_CREDENTIALS_IN_CP
// New. Update Credentials, got from loadConfigData(), to display on CP
ESPAsync_wifiManager.setCredentials(WM_config.WiFi_Creds[0].wifi_ssid, WM_config.WiFi_Creds[0].wifi_pw,
WM_config.WiFi_Creds[1].wifi_ssid, WM_config.WiFi_Creds[1].wifi_pw);
#endif

// Starts an access point
//if (!ESPAsync_wifiManager.startConfigPortal((const char *) ssid.c_str(), password))
if ( !ESPAsync_wifiManager.startConfigPortal(AP_SSID.c_str(), AP_PASS.c_str()) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
#endif

#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.14.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1014000
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.15.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1015000

// Use from 0 to 4. Higher number, more debugging messages and memory usage.
#define _ESPASYNC_WIFIMGR_LOGLEVEL_ 3

// To not display stored SSIDs and PWDs on Config Portal, select false. Default is true
// Even the stored Credentials are not display, just leave them all blank to reconnect and reuse the stored Credentials
//#define DISPLAY_STORED_CREDENTIALS_IN_CP false

#include <FS.h>

//Ported to ESP32
Expand Down Expand Up @@ -1015,6 +1019,12 @@ void setup()
Serial.print(F(", PWD = "));
Serial.println(AP_PASS);

#if DISPLAY_STORED_CREDENTIALS_IN_CP
// New. Update Credentials, got from loadConfigData(), to display on CP
ESPAsync_wifiManager.setCredentials(WM_config.WiFi_Creds[0].wifi_ssid, WM_config.WiFi_Creds[0].wifi_pw,
WM_config.WiFi_Creds[1].wifi_ssid, WM_config.WiFi_Creds[1].wifi_pw);
#endif

// Starts an access point
//if (!ESPAsync_wifiManager.startConfigPortal((const char *) ssid.c_str(), password))
if ( !ESPAsync_wifiManager.startConfigPortal(AP_SSID.c_str(), AP_PASS.c_str()) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
#endif

#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.14.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1014000
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.15.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1015000

// Use from 0 to 4. Higher number, more debugging messages and memory usage.
#define _ESPASYNC_WIFIMGR_LOGLEVEL_ 3

// To not display stored SSIDs and PWDs on Config Portal, select false. Default is true
// Even the stored Credentials are not display, just leave them all blank to reconnect and reuse the stored Credentials
//#define DISPLAY_STORED_CREDENTIALS_IN_CP false

#include <FS.h> //this needs to be first, or it all crashes and burns...

//For ESP32, To use ESP32 Dev Module, QIO, Flash 4MB/80MHz, Upload 921600
Expand Down Expand Up @@ -933,6 +937,12 @@ void setup()
Serial.print(F(", PWD = "));
Serial.println(AP_PASS);

#if DISPLAY_STORED_CREDENTIALS_IN_CP
// New. Update Credentials, got from loadConfigData(), to display on CP
ESPAsync_wifiManager.setCredentials(WM_config.WiFi_Creds[0].wifi_ssid, WM_config.WiFi_Creds[0].wifi_pw,
WM_config.WiFi_Creds[1].wifi_ssid, WM_config.WiFi_Creds[1].wifi_pw);
#endif

// Starts an access point
//if (!ESPAsync_wifiManager.startConfigPortal((const char *) ssid.c_str(), password))
if ( !ESPAsync_wifiManager.startConfigPortal(AP_SSID.c_str(), AP_PASS.c_str()) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
#endif

#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.14.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1014000
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.15.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1015000

// Use from 0 to 4. Higher number, more debugging messages and memory usage.
#define _ESPASYNC_WIFIMGR_LOGLEVEL_ 3

// To not display stored SSIDs and PWDs on Config Portal, select false. Default is true
// Even the stored Credentials are not display, just leave them all blank to reconnect and reuse the stored Credentials
//#define DISPLAY_STORED_CREDENTIALS_IN_CP false

//Ported to ESP32
#ifdef ESP32
#include <esp_wifi.h>
Expand Down Expand Up @@ -796,6 +800,12 @@ void setup()
Serial.print(F(", PWD = "));
Serial.println(AP_PASS);

#if DISPLAY_STORED_CREDENTIALS_IN_CP
// New. Update Credentials, got from loadConfigData(), to display on CP
ESPAsync_wifiManager.setCredentials(WM_config.WiFi_Creds[0].wifi_ssid, WM_config.WiFi_Creds[0].wifi_pw,
WM_config.WiFi_Creds[1].wifi_ssid, WM_config.WiFi_Creds[1].wifi_pw);
#endif

// Starts an access point
//if (!ESPAsync_wifiManager.startConfigPortal((const char *) ssid.c_str(), password))
if ( !ESPAsync_wifiManager.startConfigPortal(AP_SSID.c_str(), AP_PASS.c_str()) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
#endif

#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.14.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1014000
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.15.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1015000

// Use from 0 to 4. Higher number, more debugging messages and memory usage.
#define _ESPASYNC_WIFIMGR_LOGLEVEL_ 3

// To not display stored SSIDs and PWDs on Config Portal, select false. Default is true
// Even the stored Credentials are not display, just leave them all blank to reconnect and reuse the stored Credentials
//#define DISPLAY_STORED_CREDENTIALS_IN_CP false

//Ported to ESP32
#ifdef ESP32
#include <esp_wifi.h>
Expand Down Expand Up @@ -825,6 +829,12 @@ void setup()
Serial.print(AP_SSID);
Serial.print(F(", PWD = "));
Serial.println(AP_PASS);

#if DISPLAY_STORED_CREDENTIALS_IN_CP
// New. Update Credentials, got from loadConfigData(), to display on CP
ESPAsync_wifiManager.setCredentials(WM_config.WiFi_Creds[0].wifi_ssid, WM_config.WiFi_Creds[0].wifi_pw,
WM_config.WiFi_Creds[1].wifi_ssid, WM_config.WiFi_Creds[1].wifi_pw);
#endif

// Starts an access point
//if (!ESPAsync_wifiManager.startConfigPortal((const char *) ssid.c_str(), password))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
#endif

#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.14.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1014000
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.15.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1015000

// Use from 0 to 4. Higher number, more debugging messages and memory usage.
#define _ESPASYNC_WIFIMGR_LOGLEVEL_ 3

// To not display stored SSIDs and PWDs on Config Portal, select false. Default is true
// Even the stored Credentials are not display, just leave them all blank to reconnect and reuse the stored Credentials
//#define DISPLAY_STORED_CREDENTIALS_IN_CP false

#include <FS.h>

// Now support ArduinoJson 6.0.0+ ( tested with v6.15.2 to v6.16.1 )
Expand Down Expand Up @@ -966,6 +970,12 @@ void wifi_manager()
Serial.print(F(", PWD = "));
Serial.println(password);

#if DISPLAY_STORED_CREDENTIALS_IN_CP
// New. Update Credentials, got from loadConfigData(), to display on CP
ESPAsync_wifiManager.setCredentials(WM_config.WiFi_Creds[0].wifi_ssid, WM_config.WiFi_Creds[0].wifi_pw,
WM_config.WiFi_Creds[1].wifi_ssid, WM_config.WiFi_Creds[1].wifi_pw);
#endif

if (!ESPAsync_wifiManager.startConfigPortal((const char *) ssid.c_str(), password.c_str()))
{
Serial.println(F("Not connected to WiFi but continuing anyway."));
Expand Down Expand Up @@ -1336,6 +1346,8 @@ void setup()

if (initialConfig)
{
loadConfigData();

wifi_manager();
}
else
Expand All @@ -1347,21 +1359,21 @@ void setup()
if (loadConfigData())
{
#if USE_ESP_WIFIMANAGER_NTP
if ( strlen(WM_config.TZ_Name) > 0 )
{
LOGERROR3(F("Current TZ_Name ="), WM_config.TZ_Name, F(", TZ = "), WM_config.TZ);
if ( strlen(WM_config.TZ_Name) > 0 )
{
LOGERROR3(F("Current TZ_Name ="), WM_config.TZ_Name, F(", TZ = "), WM_config.TZ);

#if ESP8266
configTime(WM_config.TZ, "pool.ntp.org");
configTime(WM_config.TZ, "pool.ntp.org");
#else
//configTzTime(WM_config.TZ, "pool.ntp.org" );
configTzTime(WM_config.TZ, "time.nist.gov", "0.pool.ntp.org", "1.pool.ntp.org");
//configTzTime(WM_config.TZ, "pool.ntp.org" );
configTzTime(WM_config.TZ, "time.nist.gov", "0.pool.ntp.org", "1.pool.ntp.org");
#endif
}
else
{
Serial.println(F("Current Timezone is not set. Enter Config Portal to set."));
}
}
else
{
Serial.println(F("Current Timezone is not set. Enter Config Portal to set."));
}
#endif

for (uint8_t i = 0; i < NUM_WIFI_CREDENTIALS; i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
#endif

#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.14.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1014000
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.15.0"
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1015000

// Use from 0 to 4. Higher number, more debugging messages and memory usage.
#define _ESPASYNC_WIFIMGR_LOGLEVEL_ 2
#define _ESPASYNC_WIFIMGR_LOGLEVEL_ 3

// To not display stored SSIDs and PWDs on Config Portal, select false. Default is true
// Even the stored Credentials are not display, just leave them all blank to reconnect and reuse the stored Credentials
//#define DISPLAY_STORED_CREDENTIALS_IN_CP false

// Optional ms delay in ConfigPortal loop, if necessary. Using 0 if not necessary
#define TIME_BETWEEN_CONFIG_PORTAL_LOOP 0L
Expand Down Expand Up @@ -1022,6 +1026,12 @@ void wifi_manager()
Serial.print(F(", PWD = "));
Serial.println(password);

#if DISPLAY_STORED_CREDENTIALS_IN_CP
// New. Update Credentials, got from loadConfigData(), to display on CP
ESPAsync_wifiManager.setCredentials(WM_config.WiFi_Creds[0].wifi_ssid, WM_config.WiFi_Creds[0].wifi_pw,
WM_config.WiFi_Creds[1].wifi_ssid, WM_config.WiFi_Creds[1].wifi_pw);
#endif

if (!ESPAsync_wifiManager.startConfigPortal((const char *) ssid.c_str(), password.c_str()))
{
Serial.println(F("Not connected to WiFi but continuing anyway."));
Expand Down Expand Up @@ -1382,8 +1392,11 @@ void setup()

if (initialConfig)
{
loadConfigData();

wifi_manager();
}
else
{
// Pretend CP is necessary as we have no AP Credentials
initialConfig = true;
Expand All @@ -1392,21 +1405,21 @@ void setup()
if (loadConfigData())
{
#if USE_ESP_WIFIMANAGER_NTP
if ( strlen(WM_config.TZ_Name) > 0 )
{
LOGERROR3(F("Current TZ_Name ="), WM_config.TZ_Name, F(", TZ = "), WM_config.TZ);
if ( strlen(WM_config.TZ_Name) > 0 )
{
LOGERROR3(F("Current TZ_Name ="), WM_config.TZ_Name, F(", TZ = "), WM_config.TZ);

#if ESP8266
configTime(WM_config.TZ, "pool.ntp.org");
configTime(WM_config.TZ, "pool.ntp.org");
#else
//configTzTime(WM_config.TZ, "pool.ntp.org" );
configTzTime(WM_config.TZ, "time.nist.gov", "0.pool.ntp.org", "1.pool.ntp.org");
//configTzTime(WM_config.TZ, "pool.ntp.org" );
configTzTime(WM_config.TZ, "time.nist.gov", "0.pool.ntp.org", "1.pool.ntp.org");
#endif
}
else
{
Serial.println(F("Current Timezone is not set. Enter Config Portal to set."));
}
}
else
{
Serial.println(F("Current Timezone is not set. Enter Config Portal to set."));
}
#endif

for (uint8_t i = 0; i < NUM_WIFI_CREDENTIALS; i++)
Expand Down
Loading

0 comments on commit 703b82e

Please sign in to comment.