mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
HAL_SITL: fixed delay() for SITL threads
with the new thread_create() interface we need to handle delays a bit differently
This commit is contained in:
parent
785cf293cd
commit
10e9182c21
@ -56,15 +56,17 @@ void Scheduler::delay_microseconds(uint16_t usec)
|
||||
|
||||
void Scheduler::delay(uint16_t ms)
|
||||
{
|
||||
while (ms > 0) {
|
||||
uint32_t start = AP_HAL::millis();
|
||||
uint32_t now = start;
|
||||
do {
|
||||
delay_microseconds(1000);
|
||||
ms--;
|
||||
if (_min_delay_cb_ms <= ms) {
|
||||
if (_min_delay_cb_ms <= (ms - (now - start))) {
|
||||
if (in_main_thread()) {
|
||||
call_delay_cb();
|
||||
}
|
||||
}
|
||||
}
|
||||
now = AP_HAL::millis();
|
||||
} while (now - start < ms);
|
||||
}
|
||||
|
||||
void Scheduler::register_timer_process(AP_HAL::MemberProc proc)
|
||||
|
Loading…
Reference in New Issue
Block a user