summaryrefslogtreecommitdiff
path: root/ao-tools/lib
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-11-20 11:56:48 -0800
committerKeith Packard <keithp@keithp.com>2009-11-20 12:10:19 -0800
commit8065b8146a31438e66f83c13b99281ec47439a73 (patch)
treece8adbc55e45f9e074f587b840ab39a977187b8a /ao-tools/lib
parent6894541e0ee144bfc689cc02d4ed333711d3b500 (diff)
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 <keithp@keithp.com>
Diffstat (limited to 'ao-tools/lib')
-rw-r--r--ao-tools/lib/cc-logfile.c16
-rw-r--r--ao-tools/lib/cc.h5
2 files changed, 21 insertions, 0 deletions
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;