Convert telemetry file GPS satellite information in cc_log_read
authorKeith Packard <keithp@keithp.com>
Sun, 22 Nov 2009 05:10:09 +0000 (21:10 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 22 Nov 2009 05:10:09 +0000 (21:10 -0800)
The satellite info wasn't being correctly converted from telemetry
files to the data log structure, so ao-postflight was not seeing it.

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/lib/cc-logfile.c

index b0fff9f8c0ea7f01d0be54449b1ff77cbead2c70..842e5c7c3cdb1b791dda54de28a9764ae8071a34 100644 (file)
@@ -263,6 +263,9 @@ read_telem(const char *line, struct cc_flightraw *f)
 {
        struct cc_telem         telem;
        struct cc_gpselt        gps;
 {
        struct cc_telem         telem;
        struct cc_gpselt        gps;
+       struct cc_gpssat        sat;
+       int                     s;
+
        if (!cc_telem_parse(line, &telem))
                return 0;
        f->ground_accel = telem.ground_accel;
        if (!cc_telem_parse(line, &telem))
                return 0;
        f->ground_accel = telem.ground_accel;
@@ -288,6 +291,12 @@ read_telem(const char *line, struct cc_flightraw *f)
                gps.second = telem.gps.gps_time.second;
                gpsdata_add(&f->gps, &gps);
        }
                gps.second = telem.gps.gps_time.second;
                gpsdata_add(&f->gps, &gps);
        }
+       for (s = 0; s < telem.gps_tracking.channels; s++) {
+               sat.time = telem.tick;
+               sat.svid = telem.gps_tracking.sats[s].svid;
+               sat.c_n = telem.gps_tracking.sats[s].c_n0;
+               gpssat_add(&f->gps, &sat);
+       }
        return 1;
 }
 
        return 1;
 }