CAN forwarding as optional feature

This commit is contained in:
CarlWachter 2024-08-30 13:07:58 +02:00
parent 296fa965d9
commit f59eb971a4
2 changed files with 8 additions and 5 deletions

View File

@ -62,7 +62,9 @@ namespace sta
if(canBusSysQueueBuffer_[i] != nullptr){ if(canBusSysQueueBuffer_[i] != nullptr){
sysMsg = *canBusSysQueueBuffer_[i]; sysMsg = *canBusSysQueueBuffer_[i];
canBusSysQueueBuffer_[i] = nullptr; canBusSysQueueBuffer_[i] = nullptr;
#ifndef STA_CAN_BUS_FWD_ENABLE
handleSysMessage(sysMsg.header, sysMsg.payload);
#else
if (!handleSysMessage(sysMsg.header, sysMsg.payload)){ if (!handleSysMessage(sysMsg.header, sysMsg.payload)){
// Append to the correct thread's queue // Append to the correct thread's queue
@ -73,6 +75,7 @@ namespace sta
} }
} }
} }
#endif // STA_CAN_BUS_FWD_ENABLE
} }
} }
} }

View File

@ -27,10 +27,10 @@ namespace sta
#ifdef STA_TACOS_WATCHDOG_ENABLED #ifdef STA_TACOS_WATCHDOG_ENABLED
status_{ThreadStatus::STOPPED}, status_{ThreadStatus::STOPPED},
#endif // STA_TACOS_WATCHDOG_ENABLED #endif // STA_TACOS_WATCHDOG_ENABLED
#ifdef STA_CAN_BUS_ENABLE #ifdef STA_CAN_BUS_FWD_ENABLE
CAN_queue_{STA_RTOS_CAN_BUS_QUEUE_LENGTH}, CAN_queue_{STA_RTOS_CAN_BUS_QUEUE_LENGTH},
canID_{0}, canID_{0},
#endif // STA_CAN_BUS_ENABLE #endif // STA_CAN_BUS_FWD_ENABLE
terminate_{false}, terminate_{false},
previous_tick_{0} previous_tick_{0}
{ {
@ -189,7 +189,7 @@ namespace sta
TacosThread::~TacosThread(){} TacosThread::~TacosThread(){}
#ifdef STA_CAN_BUS_ENABLE #ifdef STA_CAN_BUS_FWD_ENABLE
void TacosThread::setCanID(uint32_t canID){ void TacosThread::setCanID(uint32_t canID){
canID_ = canID; canID_ = canID;
} }
@ -197,7 +197,7 @@ namespace sta
uint32_t TacosThread::getCanID(){ uint32_t TacosThread::getCanID(){
return canID_; return canID_;
} }
#endif // STA_CAN_BUS_ENABLE #endif // STA_CAN_BUS_FWD_ENABLE
} // namespace tacos } // namespace tacos
} // namespace sta } // namespace sta