From c875fb0e61a4741db34e6eacdc9e0445eb04ff50 Mon Sep 17 00:00:00 2001 From: walkermburns Date: Mon, 5 Feb 2024 21:02:12 -0500 Subject: [PATCH] Fixed (TM) circular buffer implementation in DashboardInterface --- lib/interfaces/include/MessageQueueDefine.h | 1 + lib/interfaces/src/DashboardInterface.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/interfaces/include/MessageQueueDefine.h b/lib/interfaces/include/MessageQueueDefine.h index 08c672398..28561e931 100644 --- a/lib/interfaces/include/MessageQueueDefine.h +++ b/lib/interfaces/include/MessageQueueDefine.h @@ -4,6 +4,7 @@ #include "FlexCAN_T4.h" constexpr std::size_t CANBufferSize = 16; +// does this need to be 3 params like our original definitions of the buffers? using CANBufferType = Circular_Buffer; #endif \ No newline at end of file diff --git a/lib/interfaces/src/DashboardInterface.cpp b/lib/interfaces/src/DashboardInterface.cpp index f7d73162b..78a6a06c3 100644 --- a/lib/interfaces/src/DashboardInterface.cpp +++ b/lib/interfaces/src/DashboardInterface.cpp @@ -48,7 +48,9 @@ void DashboardInterface::write() can_msg.id = Pack_DASHBOARD_MCU_STATE_hytech(&msg, can_msg.buf, &can_msg.len, NULL); // TODO fix - // msg_queue_->push_back(can_msg, sizeof(CAN_message_t)); + uint8_t buf[sizeof(CAN_message_t)]; + memmove(buf, &msg, sizeof(msg)); + msg_queue_->push_back(buf, sizeof(CAN_message_t)); } @@ -56,7 +58,7 @@ void DashboardInterface::write() void DashboardInterface::setLED(DashLED_e led, LEDColors_e color) { // TODO this no worky - // _data.LED[static_cast(led)] = static_cast color; + _data.LED[static_cast(led)] = static_cast(color); } DialMode_e DashboardInterface::getDialMode() {return _data.dial_mode;}