|
|
@ -228,13 +228,16 @@ static void sitl_simulator_output(void) |
|
|
|
static void timer_handler(int signum) |
|
|
|
static void timer_handler(int signum) |
|
|
|
{ |
|
|
|
{ |
|
|
|
static uint32_t last_update_count; |
|
|
|
static uint32_t last_update_count; |
|
|
|
|
|
|
|
static bool in_timer; |
|
|
|
|
|
|
|
|
|
|
|
if (_interrupts_are_blocked()) { |
|
|
|
if (in_timer || _interrupts_are_blocked()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
uint8_t oldSREG = SREG; |
|
|
|
uint8_t oldSREG = SREG; |
|
|
|
cli(); |
|
|
|
cli(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
in_timer = true; |
|
|
|
|
|
|
|
|
|
|
|
#ifndef __CYGWIN__ |
|
|
|
#ifndef __CYGWIN__ |
|
|
|
/* make sure we die if our parent dies */ |
|
|
|
/* make sure we die if our parent dies */ |
|
|
|
if (kill(parent_pid, 0) != 0) { |
|
|
|
if (kill(parent_pid, 0) != 0) { |
|
|
@ -267,11 +270,13 @@ static void timer_handler(int signum) |
|
|
|
if (update_count == 0) { |
|
|
|
if (update_count == 0) { |
|
|
|
sitl_update_gps(0, 0, 0, 0, 0, false); |
|
|
|
sitl_update_gps(0, 0, 0, 0, 0, false); |
|
|
|
SREG = oldSREG; |
|
|
|
SREG = oldSREG; |
|
|
|
|
|
|
|
in_timer = false; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (update_count == last_update_count) { |
|
|
|
if (update_count == last_update_count) { |
|
|
|
SREG = oldSREG; |
|
|
|
SREG = oldSREG; |
|
|
|
|
|
|
|
in_timer = false; |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
last_update_count = update_count; |
|
|
|
last_update_count = update_count; |
|
|
@ -295,6 +300,7 @@ static void timer_handler(int signum) |
|
|
|
timer_scheduler.run(); |
|
|
|
timer_scheduler.run(); |
|
|
|
|
|
|
|
|
|
|
|
SREG = oldSREG; |
|
|
|
SREG = oldSREG; |
|
|
|
|
|
|
|
in_timer = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|