mirror of https://github.com/ArduPilot/ardupilot
HAL_AVR: fixed race condition in delay()
This commit is contained in:
parent
ca4bc8d760
commit
0f3e30a0c3
|
@ -1,3 +1,4 @@
|
|||
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
@ -183,6 +184,7 @@ void AVRScheduler::delay(uint32_t ms)
|
|||
while (ms > 0) {
|
||||
while ((micros() - start) >= 1000) {
|
||||
ms--;
|
||||
if (ms == 0) break;
|
||||
start += 1000;
|
||||
}
|
||||
if (_min_delay_cb_ms <= ms) {
|
||||
|
|
Loading…
Reference in New Issue