X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=aoview%2Faoview_state.c;h=030db99ffca94eb8fd4a5db237425e5b3c13f2f6;hp=4ba1854e0237fc3584786aa2793f6901b957c6a3;hb=e506ed4b6efb86eab50204658fcd433b987e3831;hpb=2e06772c8b6fd74f86e640ed97f0d5bc8c095c2f diff --git a/aoview/aoview_state.c b/aoview/aoview_state.c index 4ba1854e..030db99f 100644 --- a/aoview/aoview_state.c +++ b/aoview/aoview_state.c @@ -18,7 +18,7 @@ #include "aoview.h" #include -static inline double sqr(a) { return a * a; }; +static inline double sqr(double a) { return a * a; }; static void aoview_great_circle (double start_lat, double start_lon, @@ -103,7 +103,7 @@ aoview_state_derive(struct aostate *state) state->main_sense = state->main / 32767.0 * 15.0; state->battery = state->batt / 32767.0 * 5.0; if (!strcmp(state->state, "pad")) { - if (state->locked) { + if (state->locked && state->nsat > 4) { state->npad++; state->pad_lat_total += state->lat; state->pad_lon_total += state->lon; @@ -128,6 +128,11 @@ aoview_state_derive(struct aostate *state) state->max_height = state->height; aoview_great_circle(state->pad_lat, state->pad_lon, state->lat, state->lon, &state->distance, &state->bearing); + if (state->npad) { + state->gps_height = state->alt - state->pad_alt; + } else { + state->gps_height = 0; + } } void @@ -167,8 +172,6 @@ aoview_state_speak(struct aostate *state) state->flight_vel / 2700); last_tick = state->tick; last_altitude = this_altitude; - printf ("report at tick %d height %d\n", - state->tick, this_altitude); } } @@ -203,7 +206,7 @@ aoview_state_notify(struct aostate *state) if (state->locked) { aoview_state_add_deg("Latitude", state->lat, 'N', 'S'); aoview_state_add_deg("Longitude", state->lon, 'E', 'W'); - aoview_table_add_row("GPS alt", "%d", state->alt); + aoview_table_add_row("GPS height", "%d", state->gps_height); aoview_table_add_row("GPS time", "%02d:%02d:%02d", state->gps_time.hour, state->gps_time.minute, @@ -239,5 +242,4 @@ void aoview_state_init(GladeXML *xml) { aoview_state_new(); - aoview_voice_speak("initializing rocket flight monitoring system\n"); }