You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
2.8 KiB
100 lines
2.8 KiB
/**************************************************************************************************************************** |
|
Credentials.h |
|
For ESP8266 / ESP32 boards |
|
|
|
ESP_WiFiManager_Lite (https://github.com/khoih-prog/ESP_WiFiManager_Lite) is a library |
|
for the ESP32/ESP8266 boards to enable store Credentials in EEPROM/SPIFFS/LittleFS for easy |
|
configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding. |
|
|
|
Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager_Lite |
|
Licensed under MIT license |
|
*****************************************************************************************************************************/ |
|
|
|
#ifndef Credentials_h |
|
#define Credentials_h |
|
|
|
#include "defines.h" |
|
|
|
/// Start Default Config Data ////////////////// |
|
|
|
/* |
|
#define SSID_MAX_LEN 32 |
|
//From v1.0.3, WPA2 passwords can be up to 63 characters long. |
|
#define PASS_MAX_LEN 64 |
|
|
|
typedef struct |
|
{ |
|
char wifi_ssid[SSID_MAX_LEN]; |
|
char wifi_pw [PASS_MAX_LEN]; |
|
} WiFi_Credentials; |
|
|
|
#define NUM_WIFI_CREDENTIALS 2 |
|
|
|
// Configurable items besides fixed Header, just add board_name |
|
#define NUM_CONFIGURABLE_ITEMS ( ( 2 * NUM_WIFI_CREDENTIALS ) + 1 ) |
|
//////////////// |
|
|
|
typedef struct Configuration |
|
{ |
|
char header [16]; |
|
WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS]; |
|
char board_name [24]; |
|
int checkSum; |
|
} ESP_WM_LITE_Configuration; |
|
*/ |
|
|
|
#define TO_LOAD_DEFAULT_CONFIG_DATA false |
|
|
|
#if TO_LOAD_DEFAULT_CONFIG_DATA |
|
|
|
// This feature is primarily used in development to force a known set of values as Config Data |
|
// It will NOT force the Config Portal to activate. Use DRD or erase Config Data with ESP_WiFiManager.clearConfigData() |
|
|
|
// Used mostly for development and debugging. FORCES default values to be loaded each run. |
|
// Config Portal data input will be ignored and overridden by DEFAULT_CONFIG_DATA |
|
//bool LOAD_DEFAULT_CONFIG_DATA = true; |
|
|
|
// Used mostly once debugged. Assumes good data already saved in device. |
|
// Config Portal data input will be override DEFAULT_CONFIG_DATA |
|
bool LOAD_DEFAULT_CONFIG_DATA = false; |
|
|
|
|
|
ESP_WM_LITE_Configuration defaultConfig = |
|
{ |
|
//char header[16], dummy, not used |
|
#if ESP8266 |
|
"ESP8266", |
|
#else |
|
"ESP32", |
|
#endif |
|
|
|
// WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS]; |
|
// WiFi_Credentials.wifi_ssid and WiFi_Credentials.wifi_pw |
|
"SSID1", "password1", |
|
"SSID2", "password2", |
|
//char board_name [24]; |
|
|
|
#if ESP8266 |
|
"ESP8266-Control", |
|
#else |
|
"ESP32-Control", |
|
#endif |
|
|
|
// terminate the list |
|
//int checkSum, dummy, not used |
|
0 |
|
/////////// End Default Config Data ///////////// |
|
}; |
|
|
|
#else |
|
|
|
bool LOAD_DEFAULT_CONFIG_DATA = false; |
|
|
|
ESP_WM_LITE_Configuration defaultConfig; |
|
|
|
#endif // TO_LOAD_DEFAULT_CONFIG_DATA |
|
|
|
/////////// End Default Config Data ///////////// |
|
|
|
|
|
#endif //Credentials_h
|
|
|