From 9e5e4c1ad82d621ceb7286f72c87eeaf5976f9bf Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 4 Jul 2011 18:06:48 -0700 Subject: [PATCH] altos: Add sat info to GPS report command Plan to use this to report current flight computer state in idle mode. Signed-off-by: Keith Packard --- src/ao_gps_skytraq.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ao_gps_skytraq.c b/src/ao_gps_skytraq.c index d286a30a..6099ca96 100644 --- a/src/ao_gps_skytraq.c +++ b/src/ao_gps_skytraq.c @@ -312,9 +312,8 @@ ao_nmea_gsv(void) ao_gps_skip_field(); /* azimuth */ c = ao_gps_decimal(2); /* C/N0 */ if (i < AO_MAX_GPS_TRACKING) { - if (!(ao_gps_tracking_next.sats[i].c_n_1 = c)) - ao_gps_tracking_next.sats[i].svid = 0; - ao_gps_tracking_next.channels = i + 1; + if ((ao_gps_tracking_next.sats[i].c_n_1 = c) != 0) + ao_gps_tracking_next.channels = i + 1; } } if (ao_gps_char == '*') { @@ -461,17 +460,24 @@ __xdata struct ao_task ao_gps_task; static void gps_dump(void) __reentrant { + uint8_t i; ao_mutex_get(&ao_gps_mutex); printf ("Date: %02d/%02d/%02d\n", ao_gps_data.year, ao_gps_data.month, ao_gps_data.day); printf ("Time: %02d:%02d:%02d\n", ao_gps_data.hour, ao_gps_data.minute, ao_gps_data.second); printf ("Lat/Lon: %ld %ld\n", ao_gps_data.latitude, ao_gps_data.longitude); printf ("Alt: %d\n", ao_gps_data.altitude); printf ("Flags: 0x%x\n", ao_gps_data.flags); + printf ("Sats: %d", ao_gps_tracking_data.channels); + for (i = 0; i < ao_gps_tracking_data.channels; i++) + printf (" %d %d", + ao_gps_tracking_data.sats[i].svid, + ao_gps_tracking_data.sats[i].c_n_1); + printf ("\ndone\n"); ao_mutex_put(&ao_gps_mutex); } __code struct ao_cmds ao_gps_cmds[] = { - { gps_dump, "g\0Display current GPS values" }, + { gps_dump, "g\0Display GPS" }, { 0, NULL }, }; -- 2.30.2