Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output and string fixes #1

Merged
merged 6 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@
*.app

.vscode/
.DS_Store
25 changes: 14 additions & 11 deletions src/ESP_WiFiManager_Lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -1470,11 +1470,16 @@ class ESP_WiFiManager_Lite

void displayConfigData(const ESP_WM_LITE_Configuration& configData)
{
ESP_WML_LOGERROR5(F("Hdr="), configData.header, F(",SSID="), configData.WiFi_Creds[0].wifi_ssid,
F(",PW="), configData.WiFi_Creds[0].wifi_pw);
ESP_WML_LOGERROR3(F("SSID1="), configData.WiFi_Creds[1].wifi_ssid, F(",PW1="), configData.WiFi_Creds[1].wifi_pw);
ESP_WML_LOGERROR1(F("Hdr="), configData.header);
ESP_WML_LOGERROR3(F("SSID0="), configData.WiFi_Creds[0].wifi_ssid, F(",PW0="), configData.WiFi_Creds[0].wifi_pw);
ESP_WML_LOGERROR3(F("SSID1="), configData.WiFi_Creds[1].wifi_ssid, F(",PW1="), configData.WiFi_Creds[1].wifi_pw);

#if USING_BOARD_NAME

ESP_WML_LOGERROR1(F("BName="), configData.board_name);

#endif

#if USE_DYNAMIC_PARAMETERS

for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++)
Expand Down Expand Up @@ -2174,10 +2179,6 @@ class ESP_WiFiManager_Lite
// If SSID, PW ="blank" or NULL, stay in config mode forever until having config Data.
return false;
}
else
{
displayConfigData(ESP_WM_LITE_config);
}

return true;
}
Expand Down Expand Up @@ -2663,6 +2664,7 @@ class ESP_WiFiManager_Lite
void createHTML(String& root_html_template)
{
String pitem;
pitem.reserve(600);

root_html_template = FPSTR(ESP_WM_LITE_HTML_HEAD_START);

Expand Down Expand Up @@ -2706,7 +2708,7 @@ class ESP_WiFiManager_Lite
if (ListOfSSIDs == "") // No SSID found or none was good enough
ListOfSSIDs = String(FPSTR(ESP_WM_LITE_OPTION_START)) + String(FPSTR(ESP_WM_LITE_NO_NETWORKS_FOUND)) + String(FPSTR(ESP_WM_LITE_OPTION_END));

pitem = String(FPSTR(ESP_WM_LITE_HTML_HEAD_END));
pitem = FPSTR(ESP_WM_LITE_HTML_HEAD_END);

#if MANUAL_SSID_INPUT_ALLOWED
pitem.replace("[[input_id]]", "<input id='id' list='SSIDs'>" + String(FPSTR(ESP_WM_LITE_DATALIST_START)) + "'SSIDs'>" +
Expand All @@ -2724,7 +2726,7 @@ class ESP_WiFiManager_Lite

#else

pitem = String(FPSTR(ESP_WM_LITE_HTML_HEAD_END));
pitem = FPSTR(ESP_WM_LITE_HTML_HEAD_END);
pitem.replace("[[input_id]]", FPSTR(ESP_WM_LITE_HTML_INPUT_ID));
pitem.replace("[[input_id1]]", FPSTR(ESP_WM_LITE_HTML_INPUT_ID1));
root_html_template += pitem + FPSTR(ESP_WM_LITE_FLDSET_START);
Expand All @@ -2735,7 +2737,7 @@ class ESP_WiFiManager_Lite

for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++)
{
pitem = String(FPSTR(ESP_WM_LITE_HTML_PARAM));
pitem = FPSTR(ESP_WM_LITE_HTML_PARAM);

pitem.replace("{b}", myMenuItems[i].displayName);
pitem.replace("{v}", myMenuItems[i].id);
Expand All @@ -2752,7 +2754,7 @@ class ESP_WiFiManager_Lite

for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++)
{
pitem = String(FPSTR(ESP_WM_LITE_HTML_SCRIPT_ITEM));
pitem = FPSTR(ESP_WM_LITE_HTML_SCRIPT_ITEM);

pitem.replace("{d}", myMenuItems[i].id);

Expand Down Expand Up @@ -2804,6 +2806,7 @@ class ESP_WiFiManager_Lite
//////

String result;
result.reserve(3072);
createHTML(result);

//ESP_WML_LOGDEBUG1(F("h:Repl:"), result);
Expand Down
8 changes: 4 additions & 4 deletions src/ESP_WiFiManager_Lite_Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
#endif

// Change _ESP_WM_LITE_LOGLEVEL_ to set tracing and logging verbosity
// 0: DISABLED: no logging
// 0: DISABLED: no logging (default)
// 1: ERROR: errors
// 2: WARN: errors and warnings
// 3: INFO: errors, warnings and informational (default)
// 3: INFO: errors, warnings and informational
// 4: DEBUG: errors, warnings, informational and debug

#ifndef _ESP_WM_LITE_LOGLEVEL_
Expand Down Expand Up @@ -77,8 +77,8 @@ const char ESP_WML_MARK[] = "[WML] ";
#define ESP_WML_LOGINFO0(x) if(_ESP_WM_LITE_LOGLEVEL_>2) { ESP_WML_PRINT(x); }
#define ESP_WML_LOGINFO(x) if(_ESP_WM_LITE_LOGLEVEL_>2) { ESP_WML_PRINT_MARK; ESP_WML_PRINTLN(x); }
#define ESP_WML_LOGINFO1(x,y) if(_ESP_WM_LITE_LOGLEVEL_>2) { ESP_WML_PRINT_MARK; ESP_WML_PRINT(x); ESP_WML_PRINTLN(y); }
#define ESP_WML_LOGINFO2(x,y,z) if(_ESP_WM_LITE_LOGLEVEL_>3) { ESP_WML_PRINT_MARK; ESP_WML_PRINT(x); ESP_WML_PRINT(y); ESP_WML_PRINTLN(z); }
#define ESP_WML_LOGINFO3(x,y,z,w) if(_ESP_WM_LITE_LOGLEVEL_>3) { ESP_WML_PRINT_MARK; ESP_WML_PRINT(x); ESP_WML_PRINT(y); ESP_WML_PRINT(z); ESP_WML_PRINTLN(w); }
#define ESP_WML_LOGINFO2(x,y,z) if(_ESP_WM_LITE_LOGLEVEL_>2) { ESP_WML_PRINT_MARK; ESP_WML_PRINT(x); ESP_WML_PRINT(y); ESP_WML_PRINTLN(z); }
#define ESP_WML_LOGINFO3(x,y,z,w) if(_ESP_WM_LITE_LOGLEVEL_>2) { ESP_WML_PRINT_MARK; ESP_WML_PRINT(x); ESP_WML_PRINT(y); ESP_WML_PRINT(z); ESP_WML_PRINTLN(w); }
#define ESP_WML_LOGINFO5(x,y,z,w,xx,yy) if(_ESP_WM_LITE_LOGLEVEL_>2) { ESP_WML_PRINT_MARK; ESP_WML_PRINT(x); ESP_WML_PRINT(y); ESP_WML_PRINT(z); ESP_WML_PRINT(w); ESP_WML_PRINT(xx); ESP_WML_PRINTLN(yy); }

///////////////////////////////////////////
Expand Down