mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-06 03:50:13 +02:00
Add timeout to CAN write to prevent crashing
This commit is contained in:
parent
56f7f205e4
commit
7025811c6e
4 changed files with 31 additions and 10 deletions
|
@ -271,10 +271,7 @@ int CAN_write_frame(const CAN_frame_t *p_frame) {
|
|||
// Write the frame to the controller
|
||||
CAN_write_frame_phy(p_frame);
|
||||
|
||||
// wait for the frame tx to complete
|
||||
xSemaphoreTake(sem_tx_complete, portMAX_DELAY);
|
||||
|
||||
return 0;
|
||||
return xSemaphoreTake(sem_tx_complete, 20) == pdTRUE ? 0 : -1;
|
||||
}
|
||||
|
||||
int CAN_stop() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue