SITL: usleep only on AP_HAL_SITL
This commit is contained in:
parent
b360521d0b
commit
edef2ceb56
@ -40,6 +40,8 @@
|
|||||||
|
|
||||||
using namespace SITL;
|
using namespace SITL;
|
||||||
|
|
||||||
|
extern const AP_HAL::HAL& hal;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
parent class for all simulator types
|
parent class for all simulator types
|
||||||
*/
|
*/
|
||||||
@ -281,7 +283,13 @@ void Aircraft::sync_frame_time(void)
|
|||||||
}
|
}
|
||||||
if (sleep_debt_us > min_sleep_time) {
|
if (sleep_debt_us > min_sleep_time) {
|
||||||
// sleep if we have built up a debt of min_sleep_tim
|
// sleep if we have built up a debt of min_sleep_tim
|
||||||
|
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
||||||
usleep(sleep_debt_us);
|
usleep(sleep_debt_us);
|
||||||
|
#elif CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
|
||||||
|
hal.scheduler->delay_microseconds(sleep_debt_us);
|
||||||
|
#else
|
||||||
|
// ??
|
||||||
|
#endif
|
||||||
sleep_debt_us -= (get_wall_time_us() - now);
|
sleep_debt_us -= (get_wall_time_us() - now);
|
||||||
}
|
}
|
||||||
last_wall_time_us = get_wall_time_us();
|
last_wall_time_us = get_wall_time_us();
|
||||||
|
Loading…
Reference in New Issue
Block a user