diff options
author | Keith Packard <keithp@keithp.com> | 2009-08-18 23:38:16 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-08-18 23:38:28 -0700 |
commit | 33edd62992a32b0ec8ca66d879fa300871db5937 (patch) | |
tree | fcc537ef40f60948e75e753d7d992ef0fdab58c6 /ao-view/aoview_state.c | |
parent | 29687cbd462a332d9a36ed87500c5b737dcae3f4 (diff) |
Update ao-view to add GPS satellite tracking data
This adds another column to the display to hold per-satellite GPS
tracking data and a count of the visible and locked sats.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-view/aoview_state.c')
-rw-r--r-- | ao-view/aoview_state.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ao-view/aoview_state.c b/ao-view/aoview_state.c index 7efd33b0..f75066dd 100644 --- a/ao-view/aoview_state.c +++ b/ao-view/aoview_state.c @@ -168,6 +168,8 @@ aoview_state_derive(struct aodata *data, struct aostate *state) aoview_great_circle(state->pad_lat, state->pad_lon, state->gps.lat, state->gps.lon, &state->distance, &state->bearing); } + if (data->gps_tracking.channels) + state->gps_tracking = data->gps_tracking; if (state->npad) { state->gps_height = state->gps.alt - state->pad_alt; } else { @@ -308,6 +310,7 @@ aoview_state_notify(struct aodata *data) if (state->gps_valid) { aoview_state_add_deg(1, "Latitude", state->gps.lat, 'N', 'S'); aoview_state_add_deg(1, "Longitude", state->gps.lon, 'E', 'W'); + aoview_table_add_row(1, "GPS altitude", "%d", state->gps.alt); aoview_table_add_row(1, "GPS height", "%d", state->gps_height); aoview_table_add_row(1, "GPS time", "%02d:%02d:%02d", state->gps.gps_time.hour, @@ -330,6 +333,27 @@ aoview_state_notify(struct aodata *data) aoview_state_add_deg(1, "Pad longitude", state->pad_lon, 'E', 'W'); aoview_table_add_row(1, "Pad GPS alt", "%gm", state->pad_alt); } + if (state->gps.gps_connected) { + int nsat_vis = 0; + int nsat_locked = 0; + int c; + + for (c = 0; c < state->gps_tracking.channels; c++) { + if ((state->gps_tracking.sats[c].state & 0xff) == 0xbf) + nsat_locked++; + } + aoview_table_add_row(2, "Satellites Visible", "%d", state->gps_tracking.channels); + aoview_table_add_row(2, "Satellites Locked", "%d", nsat_locked); + for (c = 0; c < state->gps_tracking.channels; c++) { + aoview_table_add_row(2, "Satellite id,state,C/N0", + "%3d,%02x,%2d%s", + state->gps_tracking.sats[c].svid, + state->gps_tracking.sats[c].state, + state->gps_tracking.sats[c].c_n0, + (state->gps_tracking.sats[c].state & 0xff) == 0xbf ? + " LOCKED" : ""); + } + } aoview_table_finish(); aoview_label_show(state); aoview_speak_state(state); |