From 4c7d8a4229ef8f53b170573edadbd3dac7c64a85 Mon Sep 17 00:00:00 2001 From: Nemanja Stojoski Date: Sun, 15 Oct 2023 11:47:29 +0200 Subject: [PATCH] More fixes after rebase --- ground_station/src/hmi/hmi.cpp | 2 +- ground_station/src/hmi/window.cpp | 10 +++++----- ground_station/src/hmi/window.hpp | 2 +- ground_station/src/logging/recorder.cpp | 8 +++++--- ground_station/src/telemetry/telemetry.cpp | 1 + 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ground_station/src/hmi/hmi.cpp b/ground_station/src/hmi/hmi.cpp index cfc10ffa..ccb7f611 100644 --- a/ground_station/src/hmi/hmi.cpp +++ b/ground_station/src/hmi/hmi.cpp @@ -572,7 +572,7 @@ void Hmi::update(void *pvParameter) { if (millis() - barUpdate >= 1000) { barUpdate = millis(); - float voltage = static_cast(analogRead(18)) * 0.00059154929F; + const float voltage = static_cast(analogRead(18)) * 0.00059154929F; if (!ref->isLogging) { ref->flashFreeMemory = Utils::getFlashMemoryUsage(); } diff --git a/ground_station/src/hmi/window.cpp b/ground_station/src/hmi/window.cpp index af9e531b..232745a4 100644 --- a/ground_station/src/hmi/window.cpp +++ b/ground_station/src/hmi/window.cpp @@ -68,26 +68,26 @@ void Window::initBar() { display.drawLine(0, 18, 400, 18, BLACK); } -void Window::updateBar(float batteryVoltage, bool usb, bool logging, bool location, bool time, int32_t free_memory) { +void Window::updateBar(float batteryVoltage, bool usb, bool logging, bool location, bool time, uint32_t free_memory) { static int32_t oldHour = 0; static int32_t oldMinute = 0; static bool oldUsbStatus = false; static bool oldLoggingStatus = false; - static int32_t oldFreeMemory = 0; + static uint32_t oldFreeMemory = 0; static bool blinkStatus = false; // Logging if (logging != oldLoggingStatus) { - display.drawBitmap(75, 1, bar_download, 16, 16, !logging); + display.drawBitmap(75, 1, bar_download, 16, 16, static_cast(!logging)); oldLoggingStatus = logging; } if (logging) { - display.drawBitmap(75, 1, bar_download, 16, 16, blinkStatus); + display.drawBitmap(75, 1, bar_download, 16, 16, static_cast(blinkStatus)); } // Location if (location) { - display.drawBitmap(329, 1, bar_location, 16, 16, !location); + display.drawBitmap(329, 1, bar_location, 16, 16, static_cast(!location)); } // Memory Usage diff --git a/ground_station/src/hmi/window.hpp b/ground_station/src/hmi/window.hpp index 16ff1cc7..24b97d3e 100644 --- a/ground_station/src/hmi/window.hpp +++ b/ground_station/src/hmi/window.hpp @@ -31,7 +31,7 @@ class Window { void initBar(); void updateBar(float batteryVoltage, bool usb = false, bool logging = false, bool location = false, bool time = false, - int32_t free_memory = 100); + uint32_t free_memory = 100); void initMenu(int16_t index); void updateMenu(int16_t index); diff --git a/ground_station/src/logging/recorder.cpp b/ground_station/src/logging/recorder.cpp index 2c1130eb..7ebc7416 100644 --- a/ground_station/src/logging/recorder.cpp +++ b/ground_station/src/logging/recorder.cpp @@ -50,9 +50,11 @@ void Recorder::recordTask(void *pvParameter) { ref->createFile(); } const auto &data = element.data; - snprintf(line, 128, "%hu,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", element.source, data.timestamp, data.state, data.errors, - data.lat, data.lon, data.altitude, data.velocity, data.voltage, - static_cast(data.pyro_continuity & 0x01), static_cast(data.pyro_continuity & 0x02)); + const auto pyro1_continuity = static_cast(data.pyro_continuity & 0x01U); + const auto pyro2_continuity = static_cast(data.pyro_continuity & 0x02U); + snprintf(line, 128, "%hu,%d,%d,%d,%d,%d,%d,%d,%d,%hu,%hu", element.source, data.timestamp, data.state, + data.errors, data.lat, data.lon, data.altitude, data.velocity, data.voltage, + static_cast(pyro1_continuity), static_cast(pyro2_continuity)); ref->file.println(line); count++; diff --git a/ground_station/src/telemetry/telemetry.cpp b/ground_station/src/telemetry/telemetry.cpp index b7638f2c..fa648c71 100644 --- a/ground_station/src/telemetry/telemetry.cpp +++ b/ground_station/src/telemetry/telemetry.cpp @@ -69,6 +69,7 @@ void Telemetry::initLink() { } if (testingPhrase[0] != 0) { + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) uint8 to char is OK testingCrc = crc32(testingPhrase, strlen(reinterpret_cast(testingPhrase))); } }