Remove GPS data missing from skytraq. Save max height/accel/speed
[fw/altos] / src / ao_gps_sirf.c
index 5843876051d3d3ecf86f50ea091afdf78e745c06..a6167e6b8f21ab1fcabe16d2781129aa9089512a 100644 (file)
@@ -20,6 +20,7 @@
 #endif
 
 __xdata uint8_t ao_gps_mutex;
+__xdata uint16_t ao_gps_tick;
 __xdata struct ao_gps_data     ao_gps_data;
 __xdata struct ao_gps_tracking_data    ao_gps_tracking_data;
 
@@ -108,7 +109,6 @@ static __xdata struct sirf_geodetic_nav_data        ao_sirf_data;
 
 struct sirf_measured_sat_data {
        uint8_t         svid;
-       uint16_t        state;
        uint8_t         c_n_1;
 };
 
@@ -264,8 +264,7 @@ static const struct sirf_packet_parse measured_tracker_data_packet[] = {
 
 static const struct sirf_packet_parse measured_sat_data_packet[] = {
        { SIRF_U8, offsetof (struct sirf_measured_sat_data, svid) },            /* 0 SV id */
-       { SIRF_DISCARD, 2 },                                                    /* 1 azimuth, 2 elevation */
-       { SIRF_U16, offsetof (struct sirf_measured_sat_data, state) },          /* 2 state */
+       { SIRF_DISCARD, 4 },                                                    /* 1 azimuth, 2 elevation, 3 state */
        { SIRF_U8, offsetof (struct sirf_measured_sat_data, c_n_1) },           /* C/N0 1 */
        { SIRF_DISCARD, 9 },                                                    /* C/N0 2-10 */
        { SIRF_END, 0 },
@@ -392,6 +391,7 @@ ao_gps(void) __reentrant
                switch (i) {
                case 41:
                        ao_mutex_get(&ao_gps_mutex);
+                       ao_gps_tick = ao_time();
                        ao_gps_data.hour = ao_sirf_data.utc_hour;
                        ao_gps_data.minute = ao_sirf_data.utc_minute;
                        ao_gps_data.second = ao_sirf_data.utc_second / 1000;
@@ -421,7 +421,6 @@ ao_gps(void) __reentrant
                        ao_gps_tracking_data.channels = ao_sirf_tracker_data.channels;
                        for (i = 0; i < 12; i++) {
                                ao_gps_tracking_data.sats[i].svid = ao_sirf_tracker_data.sats[i].svid;
-                               ao_gps_tracking_data.sats[i].state = (uint8_t) ao_sirf_tracker_data.sats[i].state;
                                ao_gps_tracking_data.sats[i].c_n_1 = ao_sirf_tracker_data.sats[i].c_n_1;
                        }
                        ao_mutex_put(&ao_gps_mutex);
@@ -433,25 +432,8 @@ ao_gps(void) __reentrant
 
 __xdata struct ao_task ao_gps_task;
 
-static void
-gps_dump(void) __reentrant
-{
-       ao_mutex_get(&ao_gps_mutex);
-       ao_gps_print(&ao_gps_data);
-       putchar('\n');
-       ao_gps_tracking_print(&ao_gps_tracking_data);
-       putchar('\n');
-       ao_mutex_put(&ao_gps_mutex);
-}
-
-__code struct ao_cmds ao_gps_cmds[] = {
-       { 'g', gps_dump,        "g                                  Display current GPS values" },
-       { 0, gps_dump, NULL },
-};
-
 void
 ao_gps_init(void)
 {
        ao_add_task(&ao_gps_task, ao_gps, "gps");
-       ao_cmd_register(&ao_gps_cmds[0]);
 }