From: Keith Packard Date: Fri, 20 Nov 2009 19:56:48 +0000 (-0800) Subject: Add GPS date/time output to ao-postflight. X-Git-Tag: debian/0.6+32+g87e6f3e~2 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=8065b8146a31438e66f83c13b99281ec47439a73;ds=sidebyside Add GPS date/time output to ao-postflight. GPS date/time information was already being stored in the log, it just wasn't getting displayed by ao-postflight. Signed-off-by: Keith Packard --- diff --git a/ao-tools/ao-postflight/ao-postflight.c b/ao-tools/ao-postflight/ao-postflight.c index c12939aa..a19b7ebb 100644 --- a/ao-tools/ao-postflight/ao-postflight.c +++ b/ao-tools/ao-postflight/ao-postflight.c @@ -208,6 +208,18 @@ analyse_flight(struct cc_flightraw *f, FILE *summary_file, FILE *detail_file, "Serial: %9d\n" "Flight: %9d\n", f->serial, f->flight); + if (f->year) { + fprintf(summary_file, + "Date: %04d-%02d-%02d\n", + f->year, f->month, f->day); + } + if (f->gps.num) { + fprintf(summary_file, + "Time: %2d:%02d:%02d\n", + f->gps.data[0].hour, + f->gps.data[0].minute, + f->gps.data[0].second); + } boost_start = f->accel.data[0].time; boost_stop = f->accel.data[f->accel.num-1].time; for (i = 0; i < f->state.num; i++) { diff --git a/ao-tools/lib/cc-logfile.c b/ao-tools/lib/cc-logfile.c index 9d086c82..b0fff9f8 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; } @@ -266,10 +276,16 @@ 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); } return 1; diff --git a/ao-tools/lib/cc.h b/ao-tools/lib/cc.h index 0e8ced8a..bdeeaaf5 100644 --- a/ao-tools/lib/cc.h +++ b/ao-tools/lib/cc.h @@ -86,6 +86,10 @@ struct cc_timedata { struct cc_gpselt { double time; + int hour; + int minute; + int second; + int flags; double lat; double lon; double alt; @@ -149,6 +153,7 @@ struct cc_flightraw { int serial; double ground_accel; double ground_pres; + int year, month, day; struct cc_timedata accel; struct cc_timedata pres; struct cc_timedata temp;