SITL: fixed delay() to account for signal interrupions

when a timer went off we stopped the delay() code
This commit is contained in:
Andrew Tridgell 2012-03-03 11:11:14 +11:00
parent fe173227de
commit ae51173656
1 changed files with 4 additions and 1 deletions

View File

@ -59,7 +59,10 @@ long unsigned int micros(void)
void delayMicroseconds(unsigned usec) void delayMicroseconds(unsigned usec)
{ {
usleep(usec); uint32_t start = micros();
while (micros() - start < usec) {
usleep(usec - (micros() - start));
}
} }
void delay(long unsigned msec) void delay(long unsigned msec)