From 81dc34cc91ae8c42180dc69e80afb431f13a1dd3 Mon Sep 17 00:00:00 2001 From: Rajko Zschiegner Date: Wed, 10 Apr 2024 00:16:58 +0200 Subject: [PATCH 1/6] Update airrohr-firmware.ino --- airrohr-firmware/airrohr-firmware.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airrohr-firmware/airrohr-firmware.ino b/airrohr-firmware/airrohr-firmware.ino index 7150d4ad..1ee64d99 100644 --- a/airrohr-firmware/airrohr-firmware.ino +++ b/airrohr-firmware/airrohr-firmware.ino @@ -58,7 +58,7 @@ #include // increment on change -#define SOFTWARE_VERSION_STR "NRZ-2024-136-B1" +#define SOFTWARE_VERSION_STR "NRZ-2024-135" String SOFTWARE_VERSION(SOFTWARE_VERSION_STR); /***************************************************************** From 6abbe1858449645cbcd6bcab2ad052f432c3acbd Mon Sep 17 00:00:00 2001 From: "Moritz Demman (aka maik)" Date: Fri, 18 Oct 2024 10:58:33 +0200 Subject: [PATCH 2/6] Dump WiFi connection statu to derial debug stream --- airrohr-firmware/airrohr-firmware.ino | 40 +++++++++++++++++++++++++++ airrohr-firmware/utils.cpp | 4 +++ airrohr-firmware/utils.h | 1 + 3 files changed, 45 insertions(+) diff --git a/airrohr-firmware/airrohr-firmware.ino b/airrohr-firmware/airrohr-firmware.ino index 1ee64d99..6a9bad47 100644 --- a/airrohr-firmware/airrohr-firmware.ino +++ b/airrohr-firmware/airrohr-firmware.ino @@ -664,6 +664,12 @@ IPAddress addr_static_dns; const char data_first_part[] PROGMEM = "{\"software_version\": \"" SOFTWARE_VERSION_STR "\", \"sensordatavalues\":["; const char JSON_SENSOR_DATA_VALUES[] PROGMEM = "sensordatavalues"; +/***************************************************************** + * local forward declarations * + *****************************************************************/ +// send detailed WiFi failure staus to debug +static void debug_outln_WiFi(wl_status_t wl_status); + /***************************************************************** * display values * *****************************************************************/ @@ -3010,6 +3016,40 @@ static void connectWifi() } } + +static void debug_outln_WiFi(wl_status_t wl_status) +{ + switch( wl_status ) + { + case WL_IDLE_STATUS: + debug_outln_info(FPSTR("WiFi IDLE")); + break; + case WL_NO_SSID_AVAIL: + debug_outln_info(FPSTR("WRONG|UNAVAIL SSID")); + break; + case WL_SCAN_COMPLETED: + debug_outln_info(FPSTR("SCAN COMPLETED")); + break; + case WL_CONNECTED: + debug_outln_info(FPSTR("CONNECTED")); + break; + case WL_CONNECT_FAILED: + debug_outln_info(FPSTR("CONNECT FAILED")); + break; + case WL_CONNECTION_LOST: + debug_outln_info(FPSTR("CONNECTION LOST")); + break; + case WL_DISCONNECTED: + debug_outln_info(FPSTR("DISCONNECTED")); + break; + case WL_NO_SHIELD: // for compatibility with WiFi Shield library + default: + debug_outln_info(FPSTR("unknown|missing wifi")); + break; + } //swend +} + + static WiFiClient *getNewLoggerWiFiClient(const LoggerEntry logger) { diff --git a/airrohr-firmware/utils.cpp b/airrohr-firmware/utils.cpp index 6171e417..11cee388 100644 --- a/airrohr-firmware/utils.cpp +++ b/airrohr-firmware/utils.cpp @@ -372,6 +372,10 @@ void debug_outln_info(const __FlashStringHelper* text, float value) { debug_outln_info(text, String(value)); } +void debug_outln_info(const __FlashStringHelper* text, int value) { + debug_outln_info(text, String(value)); +} + void debug_outln_verbose(const __FlashStringHelper* text, const String& option) { debug_level_check(DEBUG_MED_INFO); Debug.print(text); diff --git a/airrohr-firmware/utils.h b/airrohr-firmware/utils.h index 3bc8c5ff..56391b1b 100644 --- a/airrohr-firmware/utils.h +++ b/airrohr-firmware/utils.h @@ -161,6 +161,7 @@ extern void debug_outln_info(const __FlashStringHelper* text); extern void debug_outln_verbose(const __FlashStringHelper* text); extern void debug_outln_info(const __FlashStringHelper* text, const String& option); extern void debug_outln_info(const __FlashStringHelper* text, float value); +extern void debug_outln_info(const __FlashStringHelper* text, int value); extern void debug_outln_verbose(const __FlashStringHelper* text, const String& option); extern void debug_outln_info_bool(const __FlashStringHelper* text, const bool option); From d8f54f5b9c565e593c3a6a51ddae01bda9195cc6 Mon Sep 17 00:00:00 2001 From: "Moritz Demman (aka maik)" Date: Fri, 18 Oct 2024 11:12:45 +0200 Subject: [PATCH 3/6] report WiFi status to optional LCD as well as to debug stream --- airrohr-firmware/airrohr-firmware.ino | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/airrohr-firmware/airrohr-firmware.ino b/airrohr-firmware/airrohr-firmware.ino index 6a9bad47..ec4b7648 100644 --- a/airrohr-firmware/airrohr-firmware.ino +++ b/airrohr-firmware/airrohr-firmware.ino @@ -3019,34 +3019,38 @@ static void connectWifi() static void debug_outln_WiFi(wl_status_t wl_status) { - switch( wl_status ) + const __FlashStringHelper* statusmsg; + + switch(wl_status) { case WL_IDLE_STATUS: - debug_outln_info(FPSTR("WiFi IDLE")); + statusmsg = FPSTR("WiFi IDLE"); break; case WL_NO_SSID_AVAIL: - debug_outln_info(FPSTR("WRONG|UNAVAIL SSID")); + statusmsg = FPSTR("WRONG|UNAVAIL SSID"); break; case WL_SCAN_COMPLETED: - debug_outln_info(FPSTR("SCAN COMPLETED")); + statusmsg = FPSTR("SCAN COMPLETED"); break; case WL_CONNECTED: - debug_outln_info(FPSTR("CONNECTED")); + statusmsg = FPSTR("CONNECTED"); break; case WL_CONNECT_FAILED: - debug_outln_info(FPSTR("CONNECT FAILED")); + statusmsg = FPSTR("CONNECT FAILED"); break; case WL_CONNECTION_LOST: - debug_outln_info(FPSTR("CONNECTION LOST")); + statusmsg = FPSTR("CONNECTION LOST"); break; case WL_DISCONNECTED: - debug_outln_info(FPSTR("DISCONNECTED")); + statusmsg = FPSTR("DISCONNECTED"); break; case WL_NO_SHIELD: // for compatibility with WiFi Shield library default: - debug_outln_info(FPSTR("unknown|missing wifi")); + statusmsg = FPSTR("unknown|missing wifi"); break; } //swend + display_debug(FPSTR("WiFi status:"), String(statusmsg)); + debug_outln_info(statusmsg,static_cast(wl_status)); } From f63a20bfc9a1e24eb0da0b24385519b63fb1ca77 Mon Sep 17 00:00:00 2001 From: "Moritz Demman (aka maik)" Date: Fri, 18 Oct 2024 11:12:45 +0200 Subject: [PATCH 4/6] report WiFi status to optional LCD as well as to debug stream --- airrohr-firmware/airrohr-firmware.ino | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/airrohr-firmware/airrohr-firmware.ino b/airrohr-firmware/airrohr-firmware.ino index 6a9bad47..ec4b7648 100644 --- a/airrohr-firmware/airrohr-firmware.ino +++ b/airrohr-firmware/airrohr-firmware.ino @@ -3019,34 +3019,38 @@ static void connectWifi() static void debug_outln_WiFi(wl_status_t wl_status) { - switch( wl_status ) + const __FlashStringHelper* statusmsg; + + switch(wl_status) { case WL_IDLE_STATUS: - debug_outln_info(FPSTR("WiFi IDLE")); + statusmsg = FPSTR("WiFi IDLE"); break; case WL_NO_SSID_AVAIL: - debug_outln_info(FPSTR("WRONG|UNAVAIL SSID")); + statusmsg = FPSTR("WRONG|UNAVAIL SSID"); break; case WL_SCAN_COMPLETED: - debug_outln_info(FPSTR("SCAN COMPLETED")); + statusmsg = FPSTR("SCAN COMPLETED"); break; case WL_CONNECTED: - debug_outln_info(FPSTR("CONNECTED")); + statusmsg = FPSTR("CONNECTED"); break; case WL_CONNECT_FAILED: - debug_outln_info(FPSTR("CONNECT FAILED")); + statusmsg = FPSTR("CONNECT FAILED"); break; case WL_CONNECTION_LOST: - debug_outln_info(FPSTR("CONNECTION LOST")); + statusmsg = FPSTR("CONNECTION LOST"); break; case WL_DISCONNECTED: - debug_outln_info(FPSTR("DISCONNECTED")); + statusmsg = FPSTR("DISCONNECTED"); break; case WL_NO_SHIELD: // for compatibility with WiFi Shield library default: - debug_outln_info(FPSTR("unknown|missing wifi")); + statusmsg = FPSTR("unknown|missing wifi"); break; } //swend + display_debug(FPSTR("WiFi status:"), String(statusmsg)); + debug_outln_info(statusmsg,static_cast(wl_status)); } From 1763761524344725dd5f1754bd50727821c4b4d6 Mon Sep 17 00:00:00 2001 From: "Moritz Demman (aka maik)" Date: Fri, 18 Oct 2024 11:59:07 +0200 Subject: [PATCH 5/6] use the new WiFi state/error dump function in waitForWifiToConnect --- airrohr-firmware/airrohr-firmware.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/airrohr-firmware/airrohr-firmware.ino b/airrohr-firmware/airrohr-firmware.ino index ec4b7648..01094aad 100644 --- a/airrohr-firmware/airrohr-firmware.ino +++ b/airrohr-firmware/airrohr-firmware.ino @@ -2911,10 +2911,11 @@ static void wifiConfig() static void waitForWifiToConnect(int maxRetries) { int retryCount = 0; - while ((WiFi.status() != WL_CONNECTED) && (retryCount < maxRetries)) + wl_status_t wl_status; + while (((wl_status = WiFi.status()) != WL_CONNECTED) && (retryCount < maxRetries)) { delay(500); - debug_out(".", DEBUG_MIN_INFO); + debug_outln_WiFi(wl_status); ++retryCount; } } From 7bec20c7d0477979c07c15d993460b02dda9c493 Mon Sep 17 00:00:00 2001 From: "Moritz Demman (aka maik)" Date: Fri, 18 Oct 2024 12:43:55 +0200 Subject: [PATCH 6/6] let display_debug echo all text to debug_outln_info (instead of fixed "output debug text to displays...") --- airrohr-firmware/airrohr-firmware.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airrohr-firmware/airrohr-firmware.ino b/airrohr-firmware/airrohr-firmware.ino index 01094aad..cb845fd0 100644 --- a/airrohr-firmware/airrohr-firmware.ino +++ b/airrohr-firmware/airrohr-firmware.ino @@ -675,7 +675,8 @@ static void debug_outln_WiFi(wl_status_t wl_status); *****************************************************************/ static void display_debug(const String &text1, const String &text2) { - debug_outln_info(F("output debug text to displays...")); + debug_outln_info(text1); + debug_outln_info(text2); if (oled_ssd1306) { oled_ssd1306->clear(); @@ -3051,7 +3052,6 @@ static void debug_outln_WiFi(wl_status_t wl_status) break; } //swend display_debug(FPSTR("WiFi status:"), String(statusmsg)); - debug_outln_info(statusmsg,static_cast(wl_status)); }