mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 08:23:34 +08:00
px4io: moved blue heartbeat LED to main loop
this allows us to tell if the main loop is running by looking for a blinking blue LED
This commit is contained in:
@@ -117,6 +117,13 @@ show_debug_messages(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
heartbeat_blink(void)
|
||||
{
|
||||
static bool heartbeat = false;
|
||||
LED_BLUE(heartbeat = !heartbeat);
|
||||
}
|
||||
|
||||
int
|
||||
user_start(int argc, char *argv[])
|
||||
{
|
||||
@@ -201,6 +208,7 @@ user_start(int argc, char *argv[])
|
||||
*/
|
||||
|
||||
uint64_t last_debug_time = 0;
|
||||
uint64_t last_heartbeat_time = 0;
|
||||
for (;;) {
|
||||
|
||||
/* track the rate at which the loop is running */
|
||||
@@ -216,6 +224,11 @@ user_start(int argc, char *argv[])
|
||||
controls_tick();
|
||||
perf_end(controls_perf);
|
||||
|
||||
if ((hrt_absolute_time() - last_heartbeat_time) > 250*1000) {
|
||||
last_heartbeat_time = hrt_absolute_time();
|
||||
heartbeat_blink();
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* check for debug activity */
|
||||
show_debug_messages();
|
||||
|
||||
Reference in New Issue
Block a user