Stop using SiRF state info.
authorKeith Packard <keithp@keithp.com>
Mon, 16 Nov 2009 00:20:18 +0000 (16:20 -0800)
committerKeith Packard <keithp@keithp.com>
Mon, 16 Nov 2009 00:20:18 +0000 (16:20 -0800)
With the switch to the skytraq GPS unit, we don't have the same level
of detail in the GPS stream, so stop reporting that in the telemetry
stream, in the UI and writing it to eeprom.

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/ao-postflight/ao-postflight.c
ao-tools/lib/cc-logfile.c
ao-tools/lib/cc-telem.c
ao-tools/lib/cc.h
src/ao.h
src/ao_gps_print.c
src/ao_gps_sirf.c
src/ao_gps_skytraq.c
src/ao_gps_test.c

index 733eb38c0b56a60b778cccf9d2cc356906bec2f5..c12939aaedb72b966116eb5d1d228df67d27ad93 100644 (file)
@@ -360,7 +360,7 @@ analyse_flight(struct cc_flightraw *f, FILE *summary_file, FILE *detail_file,
                        nsat = 0;
                        for (k = 0; k < f->gps.sats[j].nsat; k++) {
                                fprintf (gps_file, " %12.7f", (double) f->gps.sats[j].sat[k].c_n);
-                               if (f->gps.sats[j].sat[k].state == 0xbf)
+                               if (f->gps.sats[j].sat[k].svid != 0)
                                        nsat++;
                        }
                        fprintf(gps_file, " %d\n", nsat);
@@ -381,7 +381,7 @@ analyse_flight(struct cc_flightraw *f, FILE *summary_file, FILE *detail_file,
                        }
                        nsat = 0;
                        for (k = 0; k < f->gps.sats[j].nsat; k++)
-                               if (f->gps.sats[j].sat[k].state == 0xbf)
+                               if (f->gps.sats[j].sat[k].svid != 0)
                                        nsat++;
 
                        fprintf(kml_file, "%12.7f, %12.7f, %12.7f <!-- time %12.7f sats %d -->",
index 3d346bccd3faa326a15793a6f53112810c0aaef2..9d086c8231cdb78ba8a80fb14b6b587699b8d4be 100644 (file)
@@ -212,7 +212,6 @@ read_eeprom(const char *line, struct cc_flightraw *f, double *ground_pres, int *
        case AO_LOG_GPS_SAT:
                sat.time = tick;
                sat.svid = a;
-               sat.state = (b & 0xff);
                sat.c_n = (b >> 8) & 0xff;
                gpssat_add(&f->gps, &sat);
                break;
index 9a2f6155a4345ce12bd22e022a83a89dc590237f..ccd40ac2cb9db31e15501c57ab8bcfc6bbfaa287 100644 (file)
@@ -178,18 +178,25 @@ cc_telem_parse(const char *input_line, struct cc_telem *telem)
        }
        if (tracking_pos >= 0 && nword >= tracking_pos + 2 && strcmp(words[tracking_pos], "SAT") == 0) {
                int     c, n, pos;
+               int     per_sat;
+               int     state;
+
+               if (version >= 2)
+                       per_sat = 2;
+               else
+                       per_sat = 3;
                cc_parse_int(&n, words[tracking_pos + 1]);
                pos = tracking_pos + 2;
-               if (nword >= pos + n * 3) {
+               if (nword >= pos + n * per_sat) {
                        telem->gps_tracking.channels = n;
                        for (c = 0; c < n; c++) {
                                cc_parse_int(&telem->gps_tracking.sats[c].svid,
                                                 words[pos + 0]);
-                               cc_parse_hex(&telem->gps_tracking.sats[c].state,
-                                                words[pos + 1]);
+                               if (version < 2)
+                                       cc_parse_hex(&state, words[pos + 1]);
                                cc_parse_int(&telem->gps_tracking.sats[c].c_n0,
-                                                words[pos + 2]);
-                               pos += 3;
+                                                words[pos + per_sat - 1]);
+                               pos += per_sat;
                        }
                } else {
                        telem->gps_tracking.channels = 0;
index ebc0db7d9ee22a90e8aff73cd71c21c13524bc4e..0e8ced8a63c6c93d3897d23647fa8cde17064b41 100644 (file)
@@ -103,7 +103,6 @@ struct cc_gpselt {
 struct cc_gpssat {
        double          time;
        uint16_t        svid;
-       uint8_t         state;
        uint8_t         c_n;
 };
 
index c1a0f6e396228906e7b4942240a1a0049c9cf82f..b72cac5c4aac6ddbe524cff75d41b7d2f8344a2a 100644 (file)
--- a/src/ao.h
+++ b/src/ao.h
@@ -536,7 +536,7 @@ struct ao_log_record {
                } gps_altitude;
                struct {
                        uint16_t        svid;
-                       uint8_t         state;
+                       uint8_t         unused;
                        uint8_t         c_n;
                } gps_sat;
                struct {
@@ -747,18 +747,8 @@ struct ao_gps_data {
        uint16_t                v_error;        /* m */
 };
 
-#define SIRF_SAT_STATE_ACQUIRED                        (1 << 0)
-#define SIRF_SAT_STATE_CARRIER_PHASE_VALID     (1 << 1)
-#define SIRF_SAT_BIT_SYNC_COMPLETE             (1 << 2)
-#define SIRF_SAT_SUBFRAME_SYNC_COMPLETE                (1 << 3)
-#define SIRF_SAT_CARRIER_PULLIN_COMPLETE       (1 << 4)
-#define SIRF_SAT_CODE_LOCKED                   (1 << 5)
-#define SIRF_SAT_ACQUISITION_FAILED            (1 << 6)
-#define SIRF_SAT_EPHEMERIS_AVAILABLE           (1 << 7)
-
 struct ao_gps_sat_data {
        uint8_t         svid;
-       uint8_t         state;
        uint8_t         c_n_1;
 };
 
index 95439ec709c6eb9542ed70e1c274a93a08a4c20c..b8b73cd2f847e8b600f079da6c61312998545784 100644 (file)
@@ -112,17 +112,16 @@ ao_gps_tracking_print(__xdata struct ao_gps_tracking_data *gps_tracking_data) __
        sat = gps_tracking_data->sats;
        v = 0;
        for (c = 0; c < n; c++) {
-               if (sat->svid && sat->state)
+               if (sat->svid)
                        v++;
                sat++;
        }
        printf("%d ", v);
        sat = gps_tracking_data->sats;
        for (c = 0; c < n; c++) {
-               if (sat->svid && sat->state)
-                       printf (" %3d %02x %3d",
+               if (sat->svid)
+                       printf (" %3d %3d",
                                sat->svid,
-                               sat->state,
                                sat->c_n_1);
                sat++;
        }
index 5843876051d3d3ecf86f50ea091afdf78e745c06..eb00224cf97fc99740ef6c9ccec65ea50d0c40ac 100644 (file)
@@ -108,7 +108,6 @@ static __xdata struct sirf_geodetic_nav_data        ao_sirf_data;
 
 struct sirf_measured_sat_data {
        uint8_t         svid;
-       uint16_t        state;
        uint8_t         c_n_1;
 };
 
@@ -264,8 +263,7 @@ static const struct sirf_packet_parse measured_tracker_data_packet[] = {
 
 static const struct sirf_packet_parse measured_sat_data_packet[] = {
        { SIRF_U8, offsetof (struct sirf_measured_sat_data, svid) },            /* 0 SV id */
-       { SIRF_DISCARD, 2 },                                                    /* 1 azimuth, 2 elevation */
-       { SIRF_U16, offsetof (struct sirf_measured_sat_data, state) },          /* 2 state */
+       { SIRF_DISCARD, 4 },                                                    /* 1 azimuth, 2 elevation, 3 state */
        { SIRF_U8, offsetof (struct sirf_measured_sat_data, c_n_1) },           /* C/N0 1 */
        { SIRF_DISCARD, 9 },                                                    /* C/N0 2-10 */
        { SIRF_END, 0 },
@@ -421,7 +419,6 @@ ao_gps(void) __reentrant
                        ao_gps_tracking_data.channels = ao_sirf_tracker_data.channels;
                        for (i = 0; i < 12; i++) {
                                ao_gps_tracking_data.sats[i].svid = ao_sirf_tracker_data.sats[i].svid;
-                               ao_gps_tracking_data.sats[i].state = (uint8_t) ao_sirf_tracker_data.sats[i].state;
                                ao_gps_tracking_data.sats[i].c_n_1 = ao_sirf_tracker_data.sats[i].c_n_1;
                        }
                        ao_mutex_put(&ao_gps_mutex);
index b2eef04bfd24521ef884f877ecc2a92089216816..bf192f28e4f0f0e4d8a0eef3e0fcaa688b328ba5 100644 (file)
@@ -326,10 +326,8 @@ ao_gps(void) __reentrant
                                ao_gps_skip_field();    /* elevation */
                                ao_gps_lexchar();
                                ao_gps_skip_field();    /* azimuth */
-                               if (ao_gps_tracking_next.sats[i].c_n_1 = ao_gps_decimal(2))     /* C/N0 */
-                                       ao_gps_tracking_next.sats[i].state = 0xbf;
-                               else
-                                       ao_gps_tracking_next.sats[i].state = 0;
+                               if (!(ao_gps_tracking_next.sats[i].c_n_1 = ao_gps_decimal(2)))  /* C/N0 */
+                                       ao_gps_tracking_next.sats[i].svid = 0;
                                ao_gps_tracking_next.channels = i + 1;
                        }
                        if (ao_gps_char == '*') {
index 3692f0e53b0cc5865d76c76eaf8c21a2ab808e61..fddfedfd075afe8ae70680803691f010b572aaf2 100644 (file)
@@ -59,7 +59,6 @@ struct ao_gps_data {
 
 struct ao_gps_sat_data {
        uint8_t         svid;
-       uint8_t         state;
        uint8_t         c_n_1;
 };
 
@@ -435,9 +434,9 @@ ao_dump_state(void *wchan)
        printf("\n");
        printf ("\t");
        for (i = 0; i < 12; i++)
-               printf (" %2d(%02x)",
+               printf (" %2d(%02d)",
                        ao_gps_tracking_data.sats[i].svid,
-                       ao_gps_tracking_data.sats[i].state);
+                       ao_gps_tracking_data.sats[i].c_n_1);
        printf ("\n");
 }