From 72c16e1cd0d91616e4bd446c214f24687f6cc424 Mon Sep 17 00:00:00 2001 From: richonguzman Date: Sun, 25 Feb 2024 12:00:44 -0300 Subject: [PATCH] minor cosmetic code fix --- src/battery_utils.cpp | 1 + src/configuration.cpp | 1 - src/digi_utils.cpp | 1 + src/gps_utils.cpp | 1 + src/lora_utils.cpp | 6 ++++-- src/ota_utils.cpp | 4 +++- src/pins_config.h | 3 ++- src/power_utils.h | 2 +- src/query_utils.cpp | 1 + src/station_utils.cpp | 1 + src/syslog_utils.cpp | 1 + src/utils.cpp | 4 ++-- src/web_utils.cpp | 6 ++++-- src/wifi_utils.cpp | 3 ++- 14 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/battery_utils.cpp b/src/battery_utils.cpp index 0eea96f..c8f9490 100644 --- a/src/battery_utils.cpp +++ b/src/battery_utils.cpp @@ -13,6 +13,7 @@ float R2 = 27.000; //in Kilo-Ohms float readingCorrection = 0.125; float multiplyCorrection = 0.035; + namespace BATTERY_Utils { float checkBattery() { diff --git a/src/configuration.cpp b/src/configuration.cpp index 0d95409..ccc32c1 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -4,7 +4,6 @@ #include "display.h" - void Configuration::writeFile() { Serial.println("Saving config.."); diff --git a/src/digi_utils.cpp b/src/digi_utils.cpp index 7b9b8b8..b51cc2e 100644 --- a/src/digi_utils.cpp +++ b/src/digi_utils.cpp @@ -22,6 +22,7 @@ extern String fifthLine; extern String sixthLine; extern String seventhLine; + namespace DIGI_Utils { String generateDigiRepeatedPacket(String packet, String callsign) { diff --git a/src/gps_utils.cpp b/src/gps_utils.cpp index 1c7916b..9120881 100644 --- a/src/gps_utils.cpp +++ b/src/gps_utils.cpp @@ -9,6 +9,7 @@ extern WiFiClient espClient; extern int stationMode; String distance; + namespace GPS_Utils { String double2string(double n, int ndec) { diff --git a/src/lora_utils.cpp b/src/lora_utils.cpp index 0f91491..70bb91a 100644 --- a/src/lora_utils.cpp +++ b/src/lora_utils.cpp @@ -24,6 +24,7 @@ bool enableInterrupt = true; int rssi, freqError; float snr; + namespace LoRa_Utils { void setFlag(void) { @@ -181,16 +182,17 @@ namespace LoRa_Utils { } } #endif - // // // // // // + if ((loraPacket.indexOf("\0")!=-1) || (loraPacket.indexOf("\r")!=-1) || (loraPacket.indexOf("\n")!=-1)) { loraPacket = packetSanitization(loraPacket); } - // // // // // // + #ifndef TextSerialOutputForApp if (loraPacket!="") { Serial.println("(RSSI:" +String(rssi) + " / SNR:" + String(snr) + " / FreqErr:" + String(freqError) + ")"); } #endif + if (Config.syslog.active && (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status()==WL_CONNECTED)) && loraPacket!="") { SYSLOG_Utils::log("Rx", loraPacket, rssi, snr, freqError); } diff --git a/src/ota_utils.cpp b/src/ota_utils.cpp index ffd176e..dfa00c0 100644 --- a/src/ota_utils.cpp +++ b/src/ota_utils.cpp @@ -2,14 +2,15 @@ #include #include #include "configuration.h" -#include "display.h" #include "ota_utils.h" +#include "display.h" extern Configuration Config; extern uint32_t lastScreenOn; unsigned long ota_progress_millis = 0; + namespace OTA_Utils { void setup(AsyncWebServer *server) { @@ -53,4 +54,5 @@ namespace OTA_Utils { show_display("", "", " OTA update fail!", "", "", "", "", 4000); } } + } \ No newline at end of file diff --git a/src/pins_config.h b/src/pins_config.h index 681066d..96d92cf 100644 --- a/src/pins_config.h +++ b/src/pins_config.h @@ -114,4 +114,5 @@ NSS 18 DIO0 26 REST 14 GND - */ -#endif + +#endif \ No newline at end of file diff --git a/src/power_utils.h b/src/power_utils.h index b84ee6b..f7b5427 100644 --- a/src/power_utils.h +++ b/src/power_utils.h @@ -16,4 +16,4 @@ namespace POWER_Utils { } -#endif +#endif \ No newline at end of file diff --git a/src/query_utils.cpp b/src/query_utils.cpp index a20f518..cc42fe0 100644 --- a/src/query_utils.cpp +++ b/src/query_utils.cpp @@ -8,6 +8,7 @@ extern std::vector lastHeardStation_temp; extern String versionDate; extern int stationMode; + namespace QUERY_Utils { String process(String query, String station, String queryOrigin) { diff --git a/src/station_utils.cpp b/src/station_utils.cpp index c45f754..bcd3ec0 100644 --- a/src/station_utils.cpp +++ b/src/station_utils.cpp @@ -10,6 +10,7 @@ extern std::vector packetBuffer; extern std::vector packetBuffer_temp; extern String fourthLine; + namespace STATION_Utils { void deleteNotHeard() { diff --git a/src/syslog_utils.cpp b/src/syslog_utils.cpp index 4c38713..5e74768 100644 --- a/src/syslog_utils.cpp +++ b/src/syslog_utils.cpp @@ -9,6 +9,7 @@ extern int stationMode; WiFiUDP udpClient; + namespace SYSLOG_Utils { void log(String type, String packet, int rssi, float snr, int freqError) { diff --git a/src/utils.cpp b/src/utils.cpp index 233e544..33b51ac 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -64,7 +64,7 @@ namespace Utils { String getLocalIP() { if (!WiFiConnected) { - return "IP : 192.168.4.1"; + return "IP : 192.168.4.1"; } else { return "IP : " + String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(WiFi.localIP()[3]); } @@ -76,7 +76,7 @@ namespace Utils { digitalWrite(internalLedPin,HIGH); #endif Serial.println("\nStarting Station: " + Config.callsign + " Version: " + versionDate); - show_display(" LoRa APRS", "", " ( iGATE & Digi )", "", "", "Richonguzman / CA2RXU", " " + versionDate, 4000); + show_display(" LoRa APRS", "", " ( iGATE & DIGI )", "", "", "Richonguzman / CA2RXU", " " + versionDate, 4000); #if defined(TTGO_T_LORA32_V2_1) || defined(HELTEC_V2) || defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa) digitalWrite(internalLedPin,LOW); #endif diff --git a/src/web_utils.cpp b/src/web_utils.cpp index e9f0647..6f90220 100644 --- a/src/web_utils.cpp +++ b/src/web_utils.cpp @@ -1,6 +1,6 @@ +#include "configuration.h" #include "ota_utils.h" #include "web_utils.h" -#include "configuration.h" extern Configuration Config; @@ -24,6 +24,7 @@ extern const char web_bootstrap_js[] asm("_binary_data_embed_bootstrap_js_gz_sta extern const char web_bootstrap_js_end[] asm("_binary_data_embed_bootstrap_js_gz_end"); extern const size_t web_bootstrap_js_len = web_bootstrap_js_end - web_bootstrap_js; + namespace WEB_Utils { AsyncWebServer server(80); @@ -189,4 +190,5 @@ namespace WEB_Utils { server.begin(); } -} + +} \ No newline at end of file diff --git a/src/wifi_utils.cpp b/src/wifi_utils.cpp index e3a3284..4cd15e9 100644 --- a/src/wifi_utils.cpp +++ b/src/wifi_utils.cpp @@ -14,6 +14,7 @@ extern bool WiFiConnected; extern long WiFiAutoAPTime; extern bool WiFiAutoAPStarted; + namespace WIFI_Utils { void checkWiFi() { @@ -143,7 +144,7 @@ namespace WIFI_Utils { Config.writeFile(); ESP.restart(); - } + } }