From c0f1e2b875d12451ae14cba1fde3b35ea5f411cd Mon Sep 17 00:00:00 2001 From: Harry Jung Date: Sat, 24 Jan 2026 15:57:21 -0700 Subject: [PATCH 1/9] IMU made 6 axis --- Components/SystemTypes/SensorDataTypes.hpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Components/SystemTypes/SensorDataTypes.hpp b/Components/SystemTypes/SensorDataTypes.hpp index 21cc20a..25fe7b7 100644 --- a/Components/SystemTypes/SensorDataTypes.hpp +++ b/Components/SystemTypes/SensorDataTypes.hpp @@ -27,31 +27,35 @@ * @param accelZ The acceleration in the Z axis relative to the sensor */ struct IMUData { - uint32_t accelX; - uint32_t accelY; - uint32_t accelZ; + uint32_t gyroX; + uint32_t gyroY; + uint32_t gyroZ; + + uint32_t accelX; + uint32_t accelY; + uint32_t accelZ; }; /** * @param Temperature. Can be any where from -2147483648 to 2147483647 */ struct ThermocoupleData { - int32_t temperature; + int32_t temperature; }; -struct GPSData{ +struct GPSData { uint32_t gps; }; -struct BaroData{ +struct BaroData { uint32_t baro; }; -struct FilterData{ +struct FilterData { uint32_t filter; }; -struct MagData{ +struct MagData { uint32_t mag; }; From 4274d3f9fa29a8ae06776a46a9eeb9d9791b97f3 Mon Sep 17 00:00:00 2001 From: Harry Jung Date: Mon, 26 Jan 2026 17:12:20 -0700 Subject: [PATCH 2/9] Made mag a 3 axis measurement --- Components/SystemTypes/SensorDataTypes.hpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Components/SystemTypes/SensorDataTypes.hpp b/Components/SystemTypes/SensorDataTypes.hpp index 25fe7b7..8167da5 100644 --- a/Components/SystemTypes/SensorDataTypes.hpp +++ b/Components/SystemTypes/SensorDataTypes.hpp @@ -52,11 +52,22 @@ struct BaroData { }; struct FilterData { - uint32_t filter; + uint32_t alt; + uint32_t velo; + uint32_t acc; + + // predictions can be published later + /* + uint32_t alt_predict; + uint32_t velo_predict; + uint32_t acc_predict; + */ }; struct MagData { - uint32_t mag; + uint32_t magX; + uint32_t magY; + uint32_t magZ; }; #endif /* SENSORDATATYPES_HPP_ */ From cdefe0d5908e25dd7f5e88427bf1db9ef202dd41 Mon Sep 17 00:00:00 2001 From: Jad Dina Date: Tue, 27 Jan 2026 14:51:55 -0700 Subject: [PATCH 3/9] added new publishers and datatypes and fixed return err --- Components/DataBroker/Inc/DataBroker.hpp | 25 ++++++++++- .../SystemTypes/DataBrokerMessageTypes.hpp | 5 +++ Components/SystemTypes/SensorDataTypes.hpp | 44 ++++++++++++++----- 3 files changed, 61 insertions(+), 13 deletions(-) diff --git a/Components/DataBroker/Inc/DataBroker.hpp b/Components/DataBroker/Inc/DataBroker.hpp index 0605787..5351300 100644 --- a/Components/DataBroker/Inc/DataBroker.hpp +++ b/Components/DataBroker/Inc/DataBroker.hpp @@ -175,10 +175,26 @@ class DataBroker { * @brief Returns the correct Publisher object for a template type */ template - static constexpr auto getPublisher(void) { + static constexpr Publisher* getPublisher(void) { if constexpr (matchType()) { return &IMU_Data_publisher; - } else { + } + else if constexpr(matchType()){ + return &Baro_Data_publisher; + } + else if constexpr(matchType()){ + return &Mag_Data_publisher; + } + else if constexpr(matchType()){ + return &Filter_Data_publisher; + } + else if constexpr(matchType()){ + return &GPS_Data_publisher; + } + else if constexpr(matchType()){ + return &Mag_Data_publisher2; + } + else { SOAR_ASSERT(false, "This publisher type does not exist, you must create it"); return (Publisher*)nullptr; } @@ -186,6 +202,11 @@ class DataBroker { // List of Publishers inline static Publisher IMU_Data_publisher{DataBrokerMessageTypes::IMU_DATA}; + inline static Publisher Mag_Data_publisher{DataBrokerMessageTypes::MAG_DATA}; + inline static Publisher Baro_Data_publisher{DataBrokerMessageTypes::BARO_DATA}; + inline static Publisher Filter_Data_publisher{DataBrokerMessageTypes::FILTER_DATA}; + inline static Publisher GPS_Data_publisher{DataBrokerMessageTypes::GPS_DATA}; + inline static Publisher Mag_Data_publisher2{DataBrokerMessageTypes::MAG_DATA2}; }; /************************************ diff --git a/Components/SystemTypes/DataBrokerMessageTypes.hpp b/Components/SystemTypes/DataBrokerMessageTypes.hpp index 23f4965..2e11389 100644 --- a/Components/SystemTypes/DataBrokerMessageTypes.hpp +++ b/Components/SystemTypes/DataBrokerMessageTypes.hpp @@ -30,6 +30,7 @@ enum class DataBrokerMessageTypes : uint8_t { BARO_DATA, FILTER_DATA, MAG_DATA, + MAG_DATA2 }; namespace DataBrokerMessageType { @@ -64,6 +65,10 @@ inline std::string ToString(DataBrokerMessageTypes messageType) { std::string type{"MAG_DATA"}; return type; } + case DataBrokerMessageTypes::MAG_DATA2: { + std::string type{"MAG_DATA2"}; + return type; + } case DataBrokerMessageTypes::INVALID: [[fallthrough]]; default: { diff --git a/Components/SystemTypes/SensorDataTypes.hpp b/Components/SystemTypes/SensorDataTypes.hpp index 21cc20a..ebfdda3 100644 --- a/Components/SystemTypes/SensorDataTypes.hpp +++ b/Components/SystemTypes/SensorDataTypes.hpp @@ -26,17 +26,33 @@ * @param accelY The acceleration in the Y axis relative to the sensor * @param accelZ The acceleration in the Z axis relative to the sensor */ +struct ACCEL_t { + int16_t x; + int16_t y; + int16_t z; +}; + +struct GYRO_t { + int16_t x; + int16_t y; + int16_t z; +}; + struct IMUData { - uint32_t accelX; - uint32_t accelY; - uint32_t accelZ; + ACCEL_t accel; + GYRO_t gyro; + int16_t temp; }; -/** - * @param Temperature. Can be any where from -2147483648 to 2147483647 - */ -struct ThermocoupleData { - int32_t temperature; +struct MAG_t { + int16_t x; + int16_t y; + int16_t z; +}; + +struct MagData2 { + MAG_t mag; + int16_t temp; }; struct GPSData{ @@ -44,15 +60,21 @@ struct GPSData{ }; struct BaroData{ - uint32_t baro; + int16_t temp; + uint32_t pressure; }; struct FilterData{ uint32_t filter; }; -struct MagData{ - uint32_t mag; +struct MagData1 { + std::uint32_t rawX; + std::uint32_t rawY; + std::uint32_t rawZ; + float scaledX; + float scaledY; + float scaledZ; }; #endif /* SENSORDATATYPES_HPP_ */ From 81f5b1bceb2d28822a64af0f086b0bc6c0d0c59c Mon Sep 17 00:00:00 2001 From: Jad Dina Date: Wed, 28 Jan 2026 12:18:56 -0700 Subject: [PATCH 4/9] modifications for log integration --- Components/DataBroker/Inc/DataBroker.hpp | 25 ++++++++--------- .../SystemTypes/DataBrokerMessageTypes.hpp | 27 +++++++++++-------- Components/SystemTypes/SensorDataTypes.hpp | 20 +++++--------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Components/DataBroker/Inc/DataBroker.hpp b/Components/DataBroker/Inc/DataBroker.hpp index 5351300..34404f2 100644 --- a/Components/DataBroker/Inc/DataBroker.hpp +++ b/Components/DataBroker/Inc/DataBroker.hpp @@ -176,13 +176,16 @@ class DataBroker { */ template static constexpr Publisher* getPublisher(void) { - if constexpr (matchType()) { - return &IMU_Data_publisher; + if constexpr (matchType()) { + return &IMU32G_Data_publisher; } - else if constexpr(matchType()){ - return &Baro_Data_publisher; + else if constexpr(matchType()){ + return &Baro07_Data_publisher; } - else if constexpr(matchType()){ + else if constexpr(matchType()){ + return &Baro11_Data_publisher; + } + else if constexpr(matchType()){ return &Mag_Data_publisher; } else if constexpr(matchType()){ @@ -191,9 +194,6 @@ class DataBroker { else if constexpr(matchType()){ return &GPS_Data_publisher; } - else if constexpr(matchType()){ - return &Mag_Data_publisher2; - } else { SOAR_ASSERT(false, "This publisher type does not exist, you must create it"); return (Publisher*)nullptr; @@ -201,12 +201,13 @@ class DataBroker { } // List of Publishers - inline static Publisher IMU_Data_publisher{DataBrokerMessageTypes::IMU_DATA}; - inline static Publisher Mag_Data_publisher{DataBrokerMessageTypes::MAG_DATA}; - inline static Publisher Baro_Data_publisher{DataBrokerMessageTypes::BARO_DATA}; + inline static Publisher IMU32G_Data_publisher{DataBrokerMessageTypes::IMU32G_DATA}; + inline static Publisher Mag_Data_publisher{DataBrokerMessageTypes::MAG_DATA}; + inline static Publisher Baro07_Data_publisher{DataBrokerMessageTypes::BARO07_DATA}; + inline static Publisher Baro11_Data_publisher{DataBrokerMessageTypes::BARO11_DATA}; inline static Publisher Filter_Data_publisher{DataBrokerMessageTypes::FILTER_DATA}; inline static Publisher GPS_Data_publisher{DataBrokerMessageTypes::GPS_DATA}; - inline static Publisher Mag_Data_publisher2{DataBrokerMessageTypes::MAG_DATA2}; + }; /************************************ diff --git a/Components/SystemTypes/DataBrokerMessageTypes.hpp b/Components/SystemTypes/DataBrokerMessageTypes.hpp index 2e11389..290657e 100644 --- a/Components/SystemTypes/DataBrokerMessageTypes.hpp +++ b/Components/SystemTypes/DataBrokerMessageTypes.hpp @@ -25,12 +25,13 @@ ************************************/ enum class DataBrokerMessageTypes : uint8_t { INVALID = 0, - IMU_DATA, + IMU32G_DATA, + IMU16G_DATA, GPS_DATA, - BARO_DATA, + BARO07_DATA, + BARO11_DATA, FILTER_DATA, MAG_DATA, - MAG_DATA2 }; namespace DataBrokerMessageType { @@ -45,18 +46,26 @@ std::string ToString(DataBrokerMessageTypes messageType); inline std::string ToString(DataBrokerMessageTypes messageType) { switch (messageType) { - case DataBrokerMessageTypes::IMU_DATA: { - std::string type{"IMU_DATA"}; + case DataBrokerMessageTypes::IMU32G_DATA: { + std::string type{"IMU32G_DATA"}; return type; } + case DataBrokerMessageTypes::IMU16G_DATA: { + std::string type{"IMU16G_DATA"}; + return type; + } case DataBrokerMessageTypes::GPS_DATA: { std::string type{"GPS_DATA"}; return type; } - case DataBrokerMessageTypes::BARO_DATA: { - std::string type{"BARO_DATA"}; + case DataBrokerMessageTypes::BARO07_DATA: { + std::string type{"BARO07_DATA"}; return type; } + case DataBrokerMessageTypes::BARO11_DATA: { + std::string type{"BARO11_DATA"}; + return type; + } case DataBrokerMessageTypes::FILTER_DATA: { std::string type{"FILTER_DATA"}; return type; @@ -65,10 +74,6 @@ inline std::string ToString(DataBrokerMessageTypes messageType) { std::string type{"MAG_DATA"}; return type; } - case DataBrokerMessageTypes::MAG_DATA2: { - std::string type{"MAG_DATA2"}; - return type; - } case DataBrokerMessageTypes::INVALID: [[fallthrough]]; default: { diff --git a/Components/SystemTypes/SensorDataTypes.hpp b/Components/SystemTypes/SensorDataTypes.hpp index ebfdda3..23c6f16 100644 --- a/Components/SystemTypes/SensorDataTypes.hpp +++ b/Components/SystemTypes/SensorDataTypes.hpp @@ -38,28 +38,22 @@ struct GYRO_t { int16_t z; }; -struct IMUData { +struct IMU32GData { ACCEL_t accel; GYRO_t gyro; int16_t temp; }; -struct MAG_t { - int16_t x; - int16_t y; - int16_t z; -}; - -struct MagData2 { - MAG_t mag; - int16_t temp; -}; struct GPSData{ uint32_t gps; }; -struct BaroData{ +struct Baro07Data{ + int16_t temp; + uint32_t pressure; +}; +struct Baro11Data{ int16_t temp; uint32_t pressure; }; @@ -68,7 +62,7 @@ struct FilterData{ uint32_t filter; }; -struct MagData1 { +struct MagData { std::uint32_t rawX; std::uint32_t rawY; std::uint32_t rawZ; From 20b8fcd20e3c25158d6b4f6f9b28c6627c2f6835 Mon Sep 17 00:00:00 2001 From: Jad Dina Date: Fri, 30 Jan 2026 22:46:51 -0700 Subject: [PATCH 5/9] removed duplicate sensor publishers --- Components/DataBroker/Inc/DataBroker.hpp | 16 ++++++--------- .../SystemTypes/DataBrokerMessageTypes.hpp | 20 +++++-------------- Components/SystemTypes/SensorDataTypes.hpp | 11 +++++----- 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/Components/DataBroker/Inc/DataBroker.hpp b/Components/DataBroker/Inc/DataBroker.hpp index 34404f2..7622710 100644 --- a/Components/DataBroker/Inc/DataBroker.hpp +++ b/Components/DataBroker/Inc/DataBroker.hpp @@ -176,14 +176,11 @@ class DataBroker { */ template static constexpr Publisher* getPublisher(void) { - if constexpr (matchType()) { - return &IMU32G_Data_publisher; + if constexpr (matchType()) { + return &IMU_Data_publisher; } - else if constexpr(matchType()){ - return &Baro07_Data_publisher; - } - else if constexpr(matchType()){ - return &Baro11_Data_publisher; + else if constexpr(matchType()){ + return &Baro_Data_publisher; } else if constexpr(matchType()){ return &Mag_Data_publisher; @@ -201,10 +198,9 @@ class DataBroker { } // List of Publishers - inline static Publisher IMU32G_Data_publisher{DataBrokerMessageTypes::IMU32G_DATA}; + inline static Publisher IMU_Data_publisher{DataBrokerMessageTypes::IMU_DATA}; inline static Publisher Mag_Data_publisher{DataBrokerMessageTypes::MAG_DATA}; - inline static Publisher Baro07_Data_publisher{DataBrokerMessageTypes::BARO07_DATA}; - inline static Publisher Baro11_Data_publisher{DataBrokerMessageTypes::BARO11_DATA}; + inline static Publisher Baro_Data_publisher{DataBrokerMessageTypes::BARO_DATA}; inline static Publisher Filter_Data_publisher{DataBrokerMessageTypes::FILTER_DATA}; inline static Publisher GPS_Data_publisher{DataBrokerMessageTypes::GPS_DATA}; diff --git a/Components/SystemTypes/DataBrokerMessageTypes.hpp b/Components/SystemTypes/DataBrokerMessageTypes.hpp index 290657e..6cefc63 100644 --- a/Components/SystemTypes/DataBrokerMessageTypes.hpp +++ b/Components/SystemTypes/DataBrokerMessageTypes.hpp @@ -25,11 +25,9 @@ ************************************/ enum class DataBrokerMessageTypes : uint8_t { INVALID = 0, - IMU32G_DATA, - IMU16G_DATA, + IMU_DATA, GPS_DATA, - BARO07_DATA, - BARO11_DATA, + BARO_DATA, FILTER_DATA, MAG_DATA, }; @@ -46,26 +44,18 @@ std::string ToString(DataBrokerMessageTypes messageType); inline std::string ToString(DataBrokerMessageTypes messageType) { switch (messageType) { - case DataBrokerMessageTypes::IMU32G_DATA: { + case DataBrokerMessageTypes::IMU_DATA: { std::string type{"IMU32G_DATA"}; return type; } - case DataBrokerMessageTypes::IMU16G_DATA: { - std::string type{"IMU16G_DATA"}; - return type; - } case DataBrokerMessageTypes::GPS_DATA: { std::string type{"GPS_DATA"}; return type; } - case DataBrokerMessageTypes::BARO07_DATA: { - std::string type{"BARO07_DATA"}; + case DataBrokerMessageTypes::BARO_DATA: { + std::string type{"BARO_DATA"}; return type; } - case DataBrokerMessageTypes::BARO11_DATA: { - std::string type{"BARO11_DATA"}; - return type; - } case DataBrokerMessageTypes::FILTER_DATA: { std::string type{"FILTER_DATA"}; return type; diff --git a/Components/SystemTypes/SensorDataTypes.hpp b/Components/SystemTypes/SensorDataTypes.hpp index 23c6f16..7431496 100644 --- a/Components/SystemTypes/SensorDataTypes.hpp +++ b/Components/SystemTypes/SensorDataTypes.hpp @@ -38,10 +38,11 @@ struct GYRO_t { int16_t z; }; -struct IMU32GData { +struct IMUData { ACCEL_t accel; GYRO_t gyro; int16_t temp; + uint8_t id; }; @@ -49,13 +50,11 @@ struct GPSData{ uint32_t gps; }; -struct Baro07Data{ - int16_t temp; - uint32_t pressure; -}; -struct Baro11Data{ + +struct BaroData{ int16_t temp; uint32_t pressure; + uint8_t id; }; struct FilterData{ From 83ff27b7a814dccef4aee40b7ea270cc383f406a Mon Sep 17 00:00:00 2001 From: Jad Dina Date: Tue, 3 Feb 2026 18:44:52 -0700 Subject: [PATCH 6/9] modified data types --- Components/SystemTypes/SensorDataTypes.hpp | 6 +++--- CubeDefines.hpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Components/SystemTypes/SensorDataTypes.hpp b/Components/SystemTypes/SensorDataTypes.hpp index 7431496..c597de7 100644 --- a/Components/SystemTypes/SensorDataTypes.hpp +++ b/Components/SystemTypes/SensorDataTypes.hpp @@ -62,9 +62,9 @@ struct FilterData{ }; struct MagData { - std::uint32_t rawX; - std::uint32_t rawY; - std::uint32_t rawZ; + uint32_t rawX; + uint32_t rawY; + uint32_t rawZ; float scaledX; float scaledY; float scaledZ; diff --git a/CubeDefines.hpp b/CubeDefines.hpp index 80b53a4..68af849 100644 --- a/CubeDefines.hpp +++ b/CubeDefines.hpp @@ -16,6 +16,7 @@ #include // For uint32_t, etc. #include // Standard c printf, vsnprintf, etc. #include "cmsis_os.h" // CMSIS RTOS definitions +#include "Mutex.hpp" /* Global Functions ------------------------------------------------------------------*/ void cube_print(const char* format, ...); From e31883bf4fea4cb2a3ce4e8d15292bf0bdee30b2 Mon Sep 17 00:00:00 2001 From: Jad Dina Date: Thu, 5 Feb 2026 08:03:04 -0700 Subject: [PATCH 7/9] Uart7 for testing --- Drivers/Inc/UARTTask.hpp | 78 ++++++++++++++++++++++++++++++ Drivers/UARTTask.cpp | 100 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 Drivers/Inc/UARTTask.hpp create mode 100644 Drivers/UARTTask.cpp diff --git a/Drivers/Inc/UARTTask.hpp b/Drivers/Inc/UARTTask.hpp new file mode 100644 index 0000000..9216fe3 --- /dev/null +++ b/Drivers/Inc/UARTTask.hpp @@ -0,0 +1,78 @@ +/* + * UARTTask.hpp + * + * Created on: Feb 4, 2026 + * Author: jaddina + */ + +#ifndef DRIVERS_INC_UARTTASK_HPP_ +#define DRIVERS_INC_UARTTASK_HPP_ + +/** + ****************************************************************************** + * File Name : UARTTask.hpp + * Description : + ****************************************************************************** +*/ +#ifndef SOAR_COMMS_UARTTASK_HPP_ +#define SOAR_COMMS_UARTTASK_HPP_ +/* Includes ------------------------------------------------------------------*/ +#include "Task.hpp" +#include "SystemDefines.hpp" +#include "UARTDriver.hpp" + + + +/* Macros ------------------------------------------------------------------*/ +enum UART_TASK_COMMANDS { + UART_TASK_COMMAND_NONE = 0, + UART_TASK_COMMAND_SEND_DEBUG, + UART_TASK_COMMAND_SEND_RADIO, + UART_TASK_COMMAND_SEND_PBB, + UART_TASK_COMMAND_MAX +}; + + +/* Class ------------------------------------------------------------------*/ +class UARTTask : public Task +{ +public: + static UARTTask& Inst() { + static UARTTask inst; + return inst; + } + + void InitTask(); + +protected: + static void RunTask(void* pvParams) { UARTTask::Inst().Run(pvParams); } // Static Task Interface, passes control to the instance Run(); + + void Run(void* pvParams); // Main run code + + void ConfigureUART(); + void HandleCommand(Command& cm); + +private: + UARTTask() : Task(UART_TASK_QUEUE_DEPTH_OBJS) {} // Private constructor + UARTTask(const UARTTask&); // Prevent copy-construction + UARTTask& operator=(const UARTTask&); // Prevent assignment +}; + + +/* Utility Functions ------------------------------------------------------------------*/ +namespace UARTUtils +{ + +} + + +#endif // SOAR_COMMS_UARTTASK_HPP_ + + + + + + + + +#endif /* DRIVERS_INC_UARTTASK_HPP_ */ diff --git a/Drivers/UARTTask.cpp b/Drivers/UARTTask.cpp new file mode 100644 index 0000000..cd7a193 --- /dev/null +++ b/Drivers/UARTTask.cpp @@ -0,0 +1,100 @@ +/* + * UARTTask.cpp + * + * Created on: Feb 4, 2026 + * Author: jaddina + */ +/** + ****************************************************************************** + * File Name : UARTTask.cpp + * Description : UART + ****************************************************************************** +*/ + +#include "UARTTask.hpp" +#include "UARTDriver.hpp" + +/** + * TODO: Currently not used, would be used for DMA buffer configuration or interrupt setup + * @brief Configures UART DMA buffers and interrupts + * +*/ +void UARTTask::ConfigureUART() +{ + // UART 5 - Uses polling for now (switch to DMA or interrupts once SOAR-Protocol is defined) +} + +/** + * @brief Initializes UART task with the RTOS scheduler +*/ +void UARTTask::InitTask() +{ + // Make sure the task is not already initialized + SOAR_ASSERT(rtTaskHandle == nullptr, "Cannot initialize UART task twice"); + + // Start the task + BaseType_t rtValue = + xTaskCreate((TaskFunction_t)UARTTask::RunTask, + (const char*)"UARTTask", + (uint16_t)UART_TASK_STACK_DEPTH_WORDS, + (void*)this, + (UBaseType_t)UART_TASK_RTOS_PRIORITY, + (TaskHandle_t*)&rtTaskHandle); + + //Ensure creation succeded + SOAR_ASSERT(rtValue == pdPASS, "UARTTask::InitTask() - xTaskCreate() failed"); + + // Configure DMA + +} + +/** + * @brief Instance Run loop for the UART Task, runs on scheduler start as long as the task is initialized. + * @param pvParams RTOS Passed void parameters, contains a pointer to the object instance, should not be used +*/ +void UARTTask::Run(void * pvParams) +{ + //UART Task loop + while(1) { + Command cm; + + //Wait forever for a command + qEvtQueue->ReceiveWait(cm); + + //Process the command + HandleCommand(cm); + } +} + +/** + * @brief HandleCommand handles any command passed to the UART task primary event queue. Responsible for + * handling all commands, even if unsupported. (Unexpected commands must still be reset) + * @param cm Reference to the command object to handle +*/ +void UARTTask::HandleCommand(Command& cm) +{ + //Switch for the GLOBAL_COMMAND + switch (cm.GetCommand()) { + case DATA_COMMAND: { + //Switch for task specific command within DATA_COMMAND + switch (cm.GetTaskCommand()) { + case UART_TASK_COMMAND_SEND_DEBUG: + UART::Debug->Transmit(cm.GetDataPointer(), cm.GetDataSize()); + break; + + default: + SOAR_PRINT("UARTTask - Received Unsupported DATA_COMMAND {%d}\n", cm.GetTaskCommand()); + break; + } + } + case TASK_SPECIFIC_COMMAND: { + break; + } + default: + SOAR_PRINT("UARTTask - Received Unsupported Command {%d}\n", cm.GetCommand()); + break; + } + + //No matter what we happens, we must reset allocated data + cm.Reset(); +} From b9e78cdd8c93fc5f7dd940991ffd8aa8c8c19969 Mon Sep 17 00:00:00 2001 From: Harry Jung Date: Sat, 7 Feb 2026 00:34:30 -0700 Subject: [PATCH 8/9] PubSub publisher types. May conflict with Jad's types. --- Components/DataBroker/Inc/DataBroker.hpp | 31 ++++++++++++++++++------ 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/Components/DataBroker/Inc/DataBroker.hpp b/Components/DataBroker/Inc/DataBroker.hpp index 0605787..82b9c6d 100644 --- a/Components/DataBroker/Inc/DataBroker.hpp +++ b/Components/DataBroker/Inc/DataBroker.hpp @@ -175,17 +175,34 @@ class DataBroker { * @brief Returns the correct Publisher object for a template type */ template - static constexpr auto getPublisher(void) { - if constexpr (matchType()) { - return &IMU_Data_publisher; - } else { - SOAR_ASSERT(false, "This publisher type does not exist, you must create it"); - return (Publisher*)nullptr; - } + static auto getPublisher(void) { + if constexpr (matchType()) { + return &IMU_Data_publisher; + + } else if constexpr (matchType()) { + return &GPS_Data_publisher; + + } else if constexpr (matchType()) { + return &Mag_Data_publisher; + + } else if constexpr (matchType()) { + return &Baro_Data_publisher; + + } else if constexpr (matchType()) { + return &Filter_Data_publisher; + + } else { + SOAR_ASSERT(false, "This publisher type does not exist"); + return (Publisher*)nullptr; + } } // List of Publishers inline static Publisher IMU_Data_publisher{DataBrokerMessageTypes::IMU_DATA}; + inline static Publisher GPS_Data_publisher { DataBrokerMessageTypes::GPS_DATA }; + inline static Publisher Mag_Data_publisher { DataBrokerMessageTypes::MAG_DATA }; + inline static Publisher Baro_Data_publisher { DataBrokerMessageTypes::BARO_DATA }; + inline static Publisher Filter_Data_publisher { DataBrokerMessageTypes::FILTER_DATA }; }; /************************************ From 0c5069ad3512f5d90bc7145d41e4f60ef0ee96dd Mon Sep 17 00:00:00 2001 From: Jad Dina Date: Sat, 7 Feb 2026 11:34:23 -0700 Subject: [PATCH 9/9] testing changes --- CubeTask.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/CubeTask.cpp b/CubeTask.cpp index 894c093..b10a922 100644 --- a/CubeTask.cpp +++ b/CubeTask.cpp @@ -36,6 +36,7 @@ void CubeTask::InitTask() void CubeTask::Run(void * pvParams) { //UART Task loop + while(1) { Command cm;