Skip to content

Commit

Permalink
fix can
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourland committed Jan 25, 2024
1 parent b13049c commit 388ae8b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/FreeRTOSTasks/CANTestTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ void CANTestTask::execute() {
frame.data.at(i) = i;
}

String<ECSSMaxMessageSize> 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));
}
}
9 changes: 5 additions & 4 deletions src/Platform/CAN/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Platform/TaskInitialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 388ae8b

Please sign in to comment.