Skip to content

Commit

Permalink
AP_InertialSensor: fixed wait_for_sample() in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Feb 23, 2024
1 parent 5fd8f22 commit c4df9ef
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libraries/AP_InertialSensor/AP_InertialSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1973,6 +1973,13 @@ void AP_InertialSensor::update(void)
*/
void AP_InertialSensor::wait_for_sample(void)
{
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
auto *sitl = AP::sitl();
if (sitl == nullptr) {
hal.scheduler->delay_microseconds(1000);
return;
}
#endif
if (_have_sample) {
// the user has called wait_for_sample() again without
// consuming the sample with update()
Expand Down

0 comments on commit c4df9ef

Please sign in to comment.