Skip to content

Commit

Permalink
AP_Periph: use a longer loop delay on non-H7
Browse files Browse the repository at this point in the history
the short delay broke the F412 based CUAV_GPS
  • Loading branch information
tridge committed Sep 2, 2021
1 parent b9d62e7 commit 6e33910
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Tools/AP_Periph/can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ extern AP_Periph_FW periph;
#define HAL_CAN_POOL_SIZE 4000
#endif

#ifndef HAL_PERIPH_LOOP_DELAY_US
// delay between can loop updates. This needs to be longer on F4
#if defined(STM32H7)
#define HAL_PERIPH_LOOP_DELAY_US 64
#else
#define HAL_PERIPH_LOOP_DELAY_US 512
#endif
#endif

#define DEBUG_PRINTS 0
#define DEBUG_PKTS 0
#if DEBUG_PRINTS
Expand Down Expand Up @@ -1623,7 +1632,7 @@ void AP_Periph_FW::can_update()
#endif
const uint32_t now_us = AP_HAL::micros();
while ((AP_HAL::micros() - now_us) < 1000) {
hal.scheduler->delay_microseconds(64);
hal.scheduler->delay_microseconds(HAL_PERIPH_LOOP_DELAY_US);
processTx();
processRx();
}
Expand Down

0 comments on commit 6e33910

Please sign in to comment.