Skip to content

Commit

Permalink
receive multiple frames during spin
Browse files Browse the repository at this point in the history
  • Loading branch information
PonomarevDA committed Jan 10, 2025
1 parent 7b4103c commit 22910e3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/dronecan.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,17 @@ static uint8_t uavcanProcessSending() {

static bool uavcanProcessReceiving(uint32_t crnt_time_ms) {
CanardCANFrame rx_frame;
int16_t res = canDriverReceive(&rx_frame, CAN_DRIVER_FIRST);
if (res) {
uint64_t crnt_time_us = crnt_time_ms * 1000;
canardHandleRxFrame(&g_canard, &rx_frame, crnt_time_us);
return true;
for (size_t idx = 0; idx < 10; idx++) {
int16_t res = canDriverReceive(&rx_frame, CAN_DRIVER_FIRST);
if (res) {
uint64_t crnt_time_us = crnt_time_ms * 1000;
canardHandleRxFrame(&g_canard, &rx_frame, crnt_time_us);
} else {
break;
}

}

return false;
}

Expand Down

0 comments on commit 22910e3

Please # to comment.