Skip to content

Commit

Permalink
Merge pull request #1 from hmueller01/minor_output_fixes
Browse files Browse the repository at this point in the history
Output and string fixes
  • Loading branch information
hmueller01 authored Mar 16, 2023
2 parents 085afdb + f80bbba commit e83c771
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
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

0 comments on commit e83c771

Please sign in to comment.