X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Flib%2Fcc-logfile.c;h=842e5c7c3cdb1b791dda54de28a9764ae8071a34;hp=9d086c8231cdb78ba8a80fb14b6b587699b8d4be;hb=2d77c18b15834046b7b79d49d87211828f2409e9;hpb=b0d7e3f9c9322542e9b649bb6ad7f7e5bb99dffa diff --git a/ao-tools/lib/cc-logfile.c b/ao-tools/lib/cc-logfile.c index 9d086c82..842e5c7c 100644 --- a/ao-tools/lib/cc-logfile.c +++ b/ao-tools/lib/cc-logfile.c @@ -136,6 +136,7 @@ gpsdata_free(struct cc_gpsdata *data) #define AO_LOG_GPS_LON 'W' #define AO_LOG_GPS_ALT 'H' #define AO_LOG_GPS_SAT 'V' +#define AO_LOG_GPS_DATE 'Y' #define AO_LOG_POS_NONE (~0UL) @@ -195,6 +196,10 @@ read_eeprom(const char *line, struct cc_flightraw *f, double *ground_pres, int * * any stale data before adding this record */ gps.time = tick; + gps.hour = (a & 0xff); + gps.minute = (a >> 8) & 0xff; + gps.second = (b & 0xff); + gps.flags = (b >> 8) & 0xff; gps_valid = GPS_TIME; break; case AO_LOG_GPS_LAT: @@ -215,6 +220,11 @@ read_eeprom(const char *line, struct cc_flightraw *f, double *ground_pres, int * sat.c_n = (b >> 8) & 0xff; gpssat_add(&f->gps, &sat); break; + case AO_LOG_GPS_DATE: + f->year = 2000 + (a & 0xff); + f->month = (a >> 8) & 0xff; + f->day = (b & 0xff); + break; default: return 0; } @@ -253,6 +263,9 @@ read_telem(const char *line, struct cc_flightraw *f) { 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; @@ -266,12 +279,24 @@ read_telem(const char *line, struct cc_flightraw *f) timedata_add(&f->main, telem.tick, telem.main); timedata_add(&f->state, telem.tick, state_name_to_state(telem.state)); if (telem.gps.gps_locked) { + f->year = telem.gps.gps_time.year; + f->month = telem.gps.gps_time.month; + f->day = telem.gps.gps_time.day; gps.time = telem.tick; gps.lat = telem.gps.lat; gps.lon = telem.gps.lon; gps.alt = telem.gps.alt; + gps.hour = telem.gps.gps_time.hour; + gps.minute = telem.gps.gps_time.minute; + 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; }