From fe26453f38557879ecc35d618461c47859349a2a Mon Sep 17 00:00:00 2001
From: Zoe Pfister <zoe.pfister@uibk.ac.at>
Date: Thu, 26 Jan 2023 14:59:37 +0100
Subject: [PATCH] Minor changes

---
 host/host_central_mast/include/MessageType.h        |  3 ++-
 host/host_central_mast/lib/Utilities/Definitions.h  |  4 +++-
 .../lib/Utilities/SDCardLogger.cpp                  |  1 +
 host/host_central_mast/lib/Utilities/SDCardLogger.h |  1 -
 host/host_central_mast/src/main.cpp                 | 13 +++++--------
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/host/host_central_mast/include/MessageType.h b/host/host_central_mast/include/MessageType.h
index 2d99e33..787afad 100644
--- a/host/host_central_mast/include/MessageType.h
+++ b/host/host_central_mast/include/MessageType.h
@@ -10,6 +10,7 @@ enum MessageType { dataAck, hostChange };
 typedef struct response {
     MessageType type;
     uint8_t mac[6];
-    long time;
+    long time; // Clang-Tidy: Narrowing conversion from 'unsigned long' to signed type 'long' is implementation-defined
+               // (see rtc in main.cpp)
 } response;
 #endif // HOST_CENTRAL_MAST_MESSAGETYPE_H
diff --git a/host/host_central_mast/lib/Utilities/Definitions.h b/host/host_central_mast/lib/Utilities/Definitions.h
index dbde555..5f5cc45 100644
--- a/host/host_central_mast/lib/Utilities/Definitions.h
+++ b/host/host_central_mast/lib/Utilities/Definitions.h
@@ -24,7 +24,7 @@
 #define LED_PIN 12
 
 // See all AT commands, if wanted
-//#define DUMP_AT_COMMANDS
+// #define DUMP_AT_COMMANDS
 
 #define TAG_ESPNOW "ESPNOW"
 #define TAG_MAIN "MAIN"
@@ -35,6 +35,8 @@
 
 #define SD_CARD_FAIL_COUNTER 100
 
+constexpr bool PRINT_TO_SERIAL = true;
+
 // global definition of RTC. Initialised in main
 extern ESP32Time rtc;
 
diff --git a/host/host_central_mast/lib/Utilities/SDCardLogger.cpp b/host/host_central_mast/lib/Utilities/SDCardLogger.cpp
index f3ee7a6..b7fe7c7 100644
--- a/host/host_central_mast/lib/Utilities/SDCardLogger.cpp
+++ b/host/host_central_mast/lib/Utilities/SDCardLogger.cpp
@@ -23,6 +23,7 @@ namespace SDCardLogger {
             }
             return 1;
         }
+
         // write evaluated format string into buffer
         int ret = vsnprintf(log_print_buffer, sizeof(log_print_buffer), logstring.c_str(), args);
 
diff --git a/host/host_central_mast/lib/Utilities/SDCardLogger.h b/host/host_central_mast/lib/Utilities/SDCardLogger.h
index 635a12e..c14a07d 100644
--- a/host/host_central_mast/lib/Utilities/SDCardLogger.h
+++ b/host/host_central_mast/lib/Utilities/SDCardLogger.h
@@ -12,7 +12,6 @@
 namespace SDCardLogger {
     void printDebugToSerial(bool printToSerialAsWell);
     int vprintf_into_sd(const char *szFormat, va_list args);
-    void sdNotAvailable(bool sdNotAvailable);
 }; // namespace SDCardLogger
 
 #endif // HOST_CENTRAL_MAST_SDCARDLOGGER_H
diff --git a/host/host_central_mast/src/main.cpp b/host/host_central_mast/src/main.cpp
index ee3b061..63694b4 100644
--- a/host/host_central_mast/src/main.cpp
+++ b/host/host_central_mast/src/main.cpp
@@ -165,7 +165,7 @@ void setup() {
         esp_log_write(ESP_LOG_ERROR, TAG_MAIN, "SD Card setup failed: %s\n", e.what());
     }
 
-    SDCardLogger::printDebugToSerial(true);
+    SDCardLogger::printDebugToSerial(PRINT_TO_SERIAL);
 
     //	https://stackoverflow.com/questions/60442350/arduinos-esp-log-set-vprintf-does-not-work-on-esp32
     esp_log_set_vprintf(&SDCardLogger::vprintf_into_sd);
@@ -266,10 +266,11 @@ void loop() {
         queue.pop();
         xSemaphoreGive(xMutex);
 
+        RequestInformation requestInformation{POST, "influxdb.qe-forte.uibk.ac.at",
+                                              80,   "/api/v2/write?org=QE&bucket=esp32test&precision=s",
+                                              data, headers};
+
         try {
-            RequestInformation requestInformation{POST, "influxdb.qe-forte.uibk.ac.at",
-                                                  80,   "/api/v2/write?org=QE&bucket=esp32test&precision=s",
-                                                  data, headers};
             connectionManager.connect(requestInformation);
         } catch (const std::exception &e) {
             esp_log_write(ESP_LOG_ERROR, TAG_GSM, "Error sending data: %s\n", e.what());
@@ -277,10 +278,6 @@ void loop() {
         esp_log_write(ESP_LOG_DEBUG, TAG_GSM, "Data sent: %s\n", data.c_str());
     }
 
-    //    RequestInformation requestInformation("GET", "vsh.pp.ua", "/TinyGSM/logo.txt", "");
-    //    auto s = connectionManager.connect(80, requestInformation);
-    //    esp_log_write(ESP_LOG_DEBUG, TAG_GSM, "Response: %s\n", s.c_str());
-
     connectionManager.gprsDisconnect();
     delay(5000L);
 
-- 
GitLab