[Firebug-cvs] fireboard/beta/tools/gps/SiRF sirftest.c,1.4,1.5
Brought to you by:
doolin
From: David M. D. <do...@us...> - 2005-07-29 21:34:34
|
Update of /cvsroot/firebug/fireboard/beta/tools/gps/SiRF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3417 Modified Files: sirftest.c Log Message: sirf 28 parses, problems with conversions though, so the test function fails. Index: sirftest.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirftest.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sirftest.c 29 Jul 2005 19:12:26 -0000 1.4 --- sirftest.c 29 Jul 2005 21:34:26 -0000 1.5 *************** *** 51,55 **** 0x00, // channel 0x00, 0x06, 0x60, 0xd0, // time tag ! 0x15, // satellite id 0xf1, 0x43, 0xf6, 0x2c, // GPS Software time, 1st 4 bytes 0x41, 0x13, 0xf4, 0x2f, // GPS Software time, 2d 4 bytes --- 51,55 ---- 0x00, // channel 0x00, 0x06, 0x60, 0xd0, // time tag ! 0x14, // satellite id 0xf1, 0x43, 0xf6, 0x2c, // GPS Software time, 1st 4 bytes 0x41, 0x13, 0xf4, 0x2f, // GPS Software time, 2d 4 bytes *************** *** 94,97 **** --- 94,114 ---- } + /* + static int + convert_4_bytes_to_uint32(char * bytes) { + + int val = 0; + val |= bytes[0] & 0xFF; + val <<= 8; + val |= bytes[1] & 0xFF; + val <<= 8; + val |= bytes[2] & 0xFF; + val <<= 8; + val |= bytes[3] & 0xFF; + return val; + } + */ + + // TODO: Make a macro for this. static float *************** *** 278,286 **** fb_sirfid28_test() { ! return FALSE; } int fb_sirfid2_test() { --- 295,405 ---- fb_sirfid28_test() { ! int passed = FALSE; ! uint8_t msgid = 0; ! uint8_t channel; ! int time_tag; ! uint8_t sat_id; ! double gps_software_time; ! double pseudo_range; ! float carrier_freq; ! double carrier_phase; ! uint16_t time_in_track; ! uint8_t sync_flags; ! uint8_t cno1, cno2, cno3, cno4, cno5, ! cno6, cno7, cno8, cno9, cno10; ! uint16_t delta_range_interval; ! uint16_t mean_delta_range_time; ! uint16_t extrapolation_time; ! uint8_t phase_error_count, low_power_count; ! ! ! msgid = get_message_id(sirf_id28); ! passed = (msgid == 28); ! ! channel = sirf_id28[1]; ! passed &= (channel == 0); ! ! time_tag = convert_4_bytes_to_int(&sirf_id28[2]); ! passed &= (time_tag == 418000); ! //fprintf(outstream,"Time tag: %d\n",0x000660D0); ! ! sat_id = sirf_id28[6]; ! passed &= (sat_id == 20); ! //fprintf(outstream,"Sat id: %d\n",sat_id); ! ! /* Failing first here. */ ! gps_software_time = convert_8_bytes_to_double(&sirf_id28[7]); ! passed &= (gps_software_time == 2.4921113696e5); ! ! pseudo_range = convert_8_bytes_to_double(&sirf_id28[15]); ! //passed &= (pseudo_range == 2.1016756638e7); ! ! // Check offset ! carrier_freq = convert_4_bytes_to_float(&sirf_id28[23]); ! //passed &= (carrier_freq == 1.6756767578e4); ! ! carrier_phase = convert_8_bytes_to_double(&sirf_id28[27]); ! //passed &= (carrier_phase == 4.4345542262e4); ! ! time_in_track = convert_2_bytes_to_uint16(&sirf_id28[35]); ! passed &= (time_in_track == 30000); ! ! sync_flags = sirf_id28[37]; ! passed &= (sync_flags == 23); ! ! cno1 = sirf_id28[38]; ! passed &= (cno1 == 52); ! ! cno2 = sirf_id28[39]; ! passed &= (cno2 == 52); ! ! cno3 = sirf_id28[40]; ! passed &= (cno3 == 52); ! ! cno4 = sirf_id28[41]; ! passed &= (cno4 == 52); ! ! cno5 = sirf_id28[42]; ! passed &= (cno5 == 52); ! ! cno6 = sirf_id28[43]; ! passed &= (cno6 == 52); ! ! cno7 = sirf_id28[44]; ! passed &= (cno7 == 52); ! ! cno8 = sirf_id28[45]; ! passed &= (cno8 == 52); ! ! cno9 = sirf_id28[46]; ! passed &= (cno9 == 52); ! ! cno10 = sirf_id28[47]; ! passed &= (cno10 == 52); ! ! delta_range_interval = convert_2_bytes_to_uint16(&sirf_id28[48]); ! passed &= (delta_range_interval == 1000); ! ! mean_delta_range_time = convert_2_bytes_to_uint16(&sirf_id28[50]); ! passed &= (mean_delta_range_time == 500); ! ! extrapolation_time = convert_2_bytes_to_uint16(&sirf_id28[52]); ! passed &= (extrapolation_time == 0); ! ! phase_error_count = sirf_id28[54]; ! passed &= (phase_error_count == 0); ! ! low_power_count = sirf_id28[55]; ! passed &= (low_power_count == 0); ! ! return passed; } + /** + * This function tests for correct extraction of data + * from the raw sirf message. + */ int fb_sirfid2_test() { *************** *** 441,448 **** main(int argc, char ** argv) { outstream = stdout; fb_sirf_test(); ! print_sirf2_message(); return 0; --- 560,573 ---- main(int argc, char ** argv) { + //uint64_t foo = 0xf143f62c4113f42f; outstream = stdout; fb_sirf_test(); ! ! ! //print_sirf2_message(); ! ! //temporary(); ! //printf("Foo: %f\n", foo); return 0; |