X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fao_gps_sirf.c;h=a6167e6b8f21ab1fcabe16d2781129aa9089512a;hp=2b3a5178120029bee4998de33631a862dedf6432;hb=4ad062969ae8a608b8428620579bbe114e580a11;hpb=33b0b6f2f2e07de105619a7b463226d2813152ab diff --git a/src/ao_gps_sirf.c b/src/ao_gps_sirf.c index 2b3a5178..a6167e6b 100644 --- a/src/ao_gps_sirf.c +++ b/src/ao_gps_sirf.c @@ -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 }, @@ -302,7 +301,7 @@ static const char ao_gps_set_message_rate[] = { }; void -ao_sirf_set_message_rate(uint8_t msg, uint8_t rate) +ao_sirf_set_message_rate(uint8_t msg, uint8_t rate) __reentrant { uint16_t cksum = 0x00a6; uint8_t i; @@ -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]); }