mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-02 19:53:57 -04:00
SITL: Scheduler correct misplaced parenthese && switch to do while loop
This commit is contained in:
parent
86e495f415
commit
f9c8827809
@ -38,14 +38,17 @@ void Scheduler::init()
|
||||
void Scheduler::delay_microseconds(uint16_t usec)
|
||||
{
|
||||
uint64_t start = AP_HAL::micros64();
|
||||
uint64_t dtime;
|
||||
while ((dtime=(AP_HAL::micros64() - start) < usec)) {
|
||||
do {
|
||||
uint64_t dtime = AP_HAL::micros64() - start;
|
||||
if (dtime >= usec) {
|
||||
break;
|
||||
}
|
||||
if (_stopped_clock_usec) {
|
||||
_sitlState->wait_clock(start+usec);
|
||||
_sitlState->wait_clock(start + usec);
|
||||
} else {
|
||||
usleep(usec - dtime);
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
void Scheduler::delay(uint16_t ms)
|
||||
|
Loading…
Reference in New Issue
Block a user