From 388ae8bb21a722f5e845a5ff3da707d70b40e1b3 Mon Sep 17 00:00:00 2001 From: sourland Date: Thu, 25 Jan 2024 13:54:51 +0200 Subject: [PATCH] fix can --- src/FreeRTOSTasks/CANTestTask.cpp | 7 ++++--- src/Platform/CAN/Driver.cpp | 9 +++++---- src/Platform/TaskInitialization.cpp | 4 ++-- src/main.cpp | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/FreeRTOSTasks/CANTestTask.cpp b/src/FreeRTOSTasks/CANTestTask.cpp index abfd436..0247bf5 100644 --- a/src/FreeRTOSTasks/CANTestTask.cpp +++ b/src/FreeRTOSTasks/CANTestTask.cpp @@ -7,9 +7,10 @@ void CANTestTask::execute() { frame.data.at(i) = i; } + String testPayload("WHO LIVES IN A PINEAPPLE UNDER THE SEA?"); while (true) { - CAN::Application::sendPingMessage(CAN::ADCS, false); - canGatekeeperTask->send(frame); - vTaskDelay(pdMS_TO_TICKS(2000)); + CAN::Application::createLogMessage(CAN::NodeIDs::OBC, false, testPayload.data(), false); + xTaskNotify(canGatekeeperTask->taskHandle, 0, eNoAction); + vTaskDelay(pdMS_TO_TICKS(1000)); } } \ No newline at end of file diff --git a/src/Platform/CAN/Driver.cpp b/src/Platform/CAN/Driver.cpp index c0fa1fd..f46736e 100644 --- a/src/Platform/CAN/Driver.cpp +++ b/src/Platform/CAN/Driver.cpp @@ -150,18 +150,19 @@ void CAN::Driver::send(const CAN::Frame &message) { memset(&Driver::txFifo, 0, MCAN1_TX_FIFO_BUFFER_ELEMENT_SIZE); - Driver::txFifo.brs = 1; + Driver::txFifo.brs = 0; Driver::txFifo.fdf = 1; Driver::txFifo.xtd = 0; Driver::txFifo.id = Driver::writeId(message.id); Driver::txFifo.dlc = Driver::convertLengthToDLC(message.data.size()); std::copy(message.data.begin(), message.data.end(), Driver::txFifo.data); - + MCAN1_MessageTransmitFifo(1, &Driver::txFifo); + MCAN0_MessageTransmitFifo(1, &Driver::txFifo); if (AcubeSATParameters::obcCANBUSActive.getValue() == Main) { - MCAN0_MessageTransmitFifo(1, &Driver::txFifo); + } else { - MCAN1_MessageTransmitFifo(1, &Driver::txFifo); + } } diff --git a/src/Platform/TaskInitialization.cpp b/src/Platform/TaskInitialization.cpp index 37354f4..33031d7 100644 --- a/src/Platform/TaskInitialization.cpp +++ b/src/Platform/TaskInitialization.cpp @@ -3,11 +3,11 @@ void initializeTasks() { uartGatekeeperTask.emplace(); timeKeepingTask.emplace(); - ambientTemperatureTask.emplace(); +// ambientTemperatureTask.emplace(); watchdogTask.emplace(); mcuTemperatureTask.emplace(); - ambientTemperatureTask->createTask(); +// ambientTemperatureTask->createTask(); mcuTemperatureTask->createTask(); timeKeepingTask->createTask(); uartGatekeeperTask->createTask(); diff --git a/src/main.cpp b/src/main.cpp index 678b1aa..ad0a2d1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,14 +39,14 @@ extern "C" void main_cpp() { housekeepingTask.emplace(); canGatekeeperTask.emplace(); canTestTask.emplace(); - nandTask.emplace(); +// nandTask.emplace(); mramTask.emplace(); tcHandlingTask->createTask(); housekeepingTask->createTask(); canGatekeeperTask->createTask(); canTestTask->createTask(); - nandTask->createTask(); +// nandTask->createTask(); mramTask->createTask(); vTaskStartScheduler();