diff options
author | Keith Packard <keithp@keithp.com> | 2017-04-30 17:34:08 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-04-30 17:34:08 -0700 |
commit | 34fda7bff76d59bcfbcec6a44275829c45e42189 (patch) | |
tree | 0e90ed00856e8f76caa878766fe0eb00bc910cd2 /src | |
parent | c02adbdd8f41c1aa1fdf4748c910d23e5485108f (diff) |
src/kernel: Add GPS lock blink LED to tracker code
Blinks an LED briefly once every three seconds when GPS is locked.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel/ao_tracker.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/kernel/ao_tracker.c b/src/kernel/ao_tracker.c index 4abd309a..46278530 100644 --- a/src/kernel/ao_tracker.c +++ b/src/kernel/ao_tracker.c @@ -164,6 +164,25 @@ ao_tracker(void) } } +#ifdef AO_LED_GPS_LOCK + +static struct ao_task ao_gps_lock_task; + +static void +ao_gps_lock(void) +{ + for (;;) { + if ((gps_data.flags & (AO_GPS_VALID|AO_GPS_COURSE_VALID)) == + (AO_GPS_VALID|AO_GPS_COURSE_VALID)) + { + ao_led_for(AO_LED_GPS_LOCK, AO_MS_TO_TICKS(20)); + } + ao_delay(AO_SEC_TO_TICKS(3)); + } +} +#endif + + static uint8_t erasing_current; void @@ -222,4 +241,7 @@ ao_tracker_init(void) #endif ao_cmd_register(&ao_tracker_cmds[0]); ao_add_task(&ao_tracker_task, ao_tracker, "tracker"); +#ifdef AO_LED_GPS_LOCK + ao_add_task(&ao_gps_lock_task, ao_gps_lock, "gps lock"); +#endif } |