[Firebug-cvs] fireboard/fireboard/sensors/leadtek9546 GpsPacket.nc,1.2,1.3 gps_driverM.nc,1.6,1.7 le
Brought to you by:
doolin
From: <do...@pr...> - 2004-01-28 22:50:52
|
Update of /cvsroot/firebug/fireboard/fireboard/sensors/leadtek9546 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19299/sensors/leadtek9546 Modified Files: GpsPacket.nc gps_driverM.nc leadtek_9546.h Log Message: Fixed string extraction code for gga messages, It was attempting to stuff floats into shorts. Thats a nogo. Index: GpsPacket.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/leadtek9546/GpsPacket.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GpsPacket.nc 14 Jan 2004 17:20:28 -0000 1.2 --- GpsPacket.nc 28 Jan 2004 22:39:59 -0000 1.3 *************** *** 223,231 **** command result_t Send.send(TOS_MsgPtr msg) { state = PACKET; ! msg->crc = 1; /* Fake out the CRC as passed. */ ! return call txBytes((uint8_t *)msg, TOS_MsgLength(msg->type)); } /* Command to transfer a variable length packet */ command result_t SendVarLenPacket.send(uint8_t* packet, uint8_t numBytes) { --- 223,237 ---- command result_t Send.send(TOS_MsgPtr msg) { + GPS_Msg * gps_msg = (GPS_Msg*)msg; state = PACKET; ! //msg->crc = 1; /* Fake out the CRC as passed. */ ! ! //return call txBytes((uint8_t *)msg, TOS_MsgLength(msg->type)); ! //return call txBytes(msg->data, msg->length); ! return call SendVarLenPacket.send(msg->data, msg->length); } + + /* Command to transfer a variable length packet */ command result_t SendVarLenPacket.send(uint8_t* packet, uint8_t numBytes) { *************** *** 491,492 **** --- 497,499 ---- } } + Index: gps_driverM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/leadtek9546/gps_driverM.nc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gps_driverM.nc 21 Jan 2004 20:36:29 -0000 1.6 --- gps_driverM.nc 28 Jan 2004 22:40:00 -0000 1.7 *************** *** 26,34 **** command uint8_t extract_hours(char * data); command uint8_t extract_minutes(char * data); ! command uint16_t extract_dec_sec(char * data); command uint8_t extract_Lat_deg(char * data); ! command uint16_t extract_Lat_dec_min(char * data); command uint8_t extract_Long_deg(char * data); ! command uint16_t extract_Long_dec_min(char * data); command uint8_t extract_NSEWind(char * data); command uint8_t extract_num_sats(char * data); --- 26,34 ---- command uint8_t extract_hours(char * data); command uint8_t extract_minutes(char * data); ! command float extract_dec_sec(char * data); command uint8_t extract_Lat_deg(char * data); ! command float extract_Lat_dec_min(char * data); command uint8_t extract_Long_deg(char * data); ! command float extract_Long_dec_min(char * data); command uint8_t extract_NSEWind(char * data); command uint8_t extract_num_sats(char * data); *************** *** 36,40 **** command result_t isGGA(uint8_t * data); ! command result_t parse_gga(GPS_Msg * gps_data); command uint8_t get_gps_fix(char * data); --- 36,40 ---- command result_t isGGA(uint8_t * data); ! command result_t parse_gga(GPS_Msg * data); command uint8_t get_gps_fix(char * data); *************** *** 76,80 **** * to determine the values. */ ! norace uint8_t gps_fix = 0; enum {IDLE, BUSY, BUSY_0, BUSY_1, GET_SAMPLE_0, GET_SAMPLE_1, --- 76,80 ---- * to determine the values. */ ! norace bool have_gps_fix = 0; enum {IDLE, BUSY, BUSY_0, BUSY_1, GET_SAMPLE_0, GET_SAMPLE_1, *************** *** 187,190 **** --- 187,191 ---- command result_t log_gga_data_to_eeprom(GGA_Msg * pGGA) { + #if 0 int j; char gga_log_array[GPS_CHAR]; *************** *** 211,214 **** --- 212,216 ---- // Write into eeprom here. + #endif return SUCCESS; } *************** *** 218,221 **** --- 220,224 ---- int i; + SODbg(DBG_USR2, "\r\n"); for (i=0; i<=gps_data->length; i++) { /** UARTPutChar is an SODebug function. *************** *** 224,228 **** UARTPutChar(gps_data->data[i]); } ! //SODbg(DBG_USR2, "\r\n"); } --- 227,231 ---- UARTPutChar(gps_data->data[i]); } ! SODbg(DBG_USR2, "\r\n"); } *************** *** 243,260 **** GPS_MsgPtr gps_data = (GPS_MsgPtr)data; ! ! ! signal Sensor.dataReady(gps_data); ! /* if ((call isGGA(gps_data->data))) { ! //SODbg(DBG_USR2, "gps_driverM.GpsReceive.receive() GGA Data\r\n"); call parse_gga(gps_data); ! if (gps_fix) { ! signal Sensor.dataReady(gps_data); ! call Sensor.powerOff(); } } - */ return data; --- 246,261 ---- GPS_MsgPtr gps_data = (GPS_MsgPtr)data; ! //signal Sensor.dataReady(gps_data); ! if ((call isGGA(gps_data->data))) { ! call parse_gga(gps_data); ! if (have_gps_fix) { ! //signal Sensor.dataReady(gps_data); ! call spew_to_uart(gps_data); ! signal Sensor.dataReady(&gga_msg); } } return data; *************** *** 354,362 **** // Finding the gps fix should probably done somewhere else. ! gps_fix = call get_gps_fix(gga_fields[6]); //SODbg(DBG_USR2, "gps_new.parse_gga(): gps_fix %i \r\n", gps_fix); ! //call load_gga_struct(gga_fields); ! return SUCCESS; } --- 355,364 ---- // Finding the gps fix should probably done somewhere else. ! have_gps_fix = call get_gps_fix(gga_fields[6]); //SODbg(DBG_USR2, "gps_new.parse_gga(): gps_fix %i \r\n", gps_fix); ! if (have_gps_fix) { ! call load_gga_struct(gga_fields); ! } return SUCCESS; } *************** *** 373,384 **** /** FIXME: Where is data[6]? The decimal point? */ ! command uint16_t extract_dec_sec(char * data) { ! uint16_t dec_sec; ! dec_sec = 10000*(data[4]-'0') + 1000*(data[5]-'0') ! + 100*(data[7]-'0') + 10*(data[8]-'0') ! + (data[9]-'0'); ! return dec_sec; } --- 375,387 ---- /** FIXME: Where is data[6]? The decimal point? */ ! command float extract_dec_sec(char * data) { ! float dec_secs; ! dec_secs = 10*(data[4]-'0') + (data[5]-'0') + 0.1*(data[7]-'0') ! + 0.01*(data[8]-'0') ! + 0.001*(data[9]-'0'); ! ! return dec_secs; } *************** *** 387,396 **** } ! command uint16_t extract_Lat_dec_min(char * data) { ! uint16_t dec_min; dec_min = 100000*(data[2]-'0') + 10000*(data[3]-'0') + 1000*(data[4]-'0') + 100*(data[5]-'0') + 10*(data[6]-'0') + (data[7]-'0'); return dec_min; } --- 390,404 ---- } ! command float extract_Lat_dec_min(char * data) { ! float dec_min; ! dec_min = 10*(data[2]-'0') + (data[3]-'0') + 0.1*(data[5]-'0') ! + 0.01*(data[6]-'0') + 0.001*(data[7]-'0') + 0.0001*(data[8]-'0'); ! ! /* dec_min = 100000*(data[2]-'0') + 10000*(data[3]-'0') + 1000*(data[4]-'0') + 100*(data[5]-'0') + 10*(data[6]-'0') + (data[7]-'0'); + */ return dec_min; } *************** *** 401,410 **** } ! command uint16_t extract_Long_dec_min(char * data) { ! uint16_t dec_min; dec_min = 100000*(data[3]-'0') + 10000*(data[4]-'0') + 1000*(data[5]-'0') + 100*(data[6]-'0') + 10*(data[7]-'0') + (data[8]-'0'); return dec_min; } --- 409,424 ---- } ! command float extract_Long_dec_min(char * data) { ! float dec_min; ! ! dec_min = 10*(data[3]-'0') + (data[4]-'0') + 0.1*(data[6]-'0') ! + 0.01*(data[7]-'0') + 0.001*(data[8]-'0') + 0.0001*(data[9]-'0'); ! ! /* dec_min = 100000*(data[3]-'0') + 10000*(data[4]-'0') + 1000*(data[5]-'0') + 100*(data[6]-'0') + 10*(data[7]-'0') + (data[8]-'0'); + */ return dec_min; } *************** *** 446,450 **** gps_state = GPS_FINISHED; } ! gps_fix = 0; signal Sensor.powerOffDone(); return SUCCESS; --- 460,464 ---- gps_state = GPS_FINISHED; } ! have_gps_fix = 0; signal Sensor.powerOffDone(); return SUCCESS; *************** *** 494,504 **** command result_t Sensor.loadProgram(uint8_t * program) { ! TOS_MsgPtr msg = {0}; strcpy(msg->data,program); - signal Sensor.dataReady((void*)program); ! call GpsSend.send(msg); ! return SUCCESS; } --- 508,524 ---- command result_t Sensor.loadProgram(uint8_t * program) { ! //TOS_MsgPtr msg = {0}; ! //strcpy(msg->data,program); ! GPS_Msg * msg; ! //msg->data = program; ! ! msg->length = strlen(program); ! program[0] = msg->length; strcpy(msg->data,program); ! ! signal Sensor.dataReady((void*)program); ! return call GpsSend.send(msg); } Index: leadtek_9546.h =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/leadtek9546/leadtek_9546.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** leadtek_9546.h 23 Jan 2004 01:08:26 -0000 1.3 --- leadtek_9546.h 28 Jan 2004 22:40:00 -0000 1.4 *************** *** 133,141 **** * FIXME: Find out what leadtek uses for a proprietary header string. */ ! //const uint8_t gps_gga_mask[] = {"$PLTC,NMEA," NMEA_GGA_MASK NMEA_END1 NMEA_END2}; ! //const uint8_t gps_rmc_mask[] = {"$PLTC,NMEA," NMEA_RMC_MASK NMEA_END1 NMEA_END2}; const uint8_t gps_syncmode_on[] = {"$LTC,SYNCMODE,1" NMEA_END1 NMEA_END2}; ! const uint8_t gps_syncmode_off[] = {"$LTC,SYNCMODE,0" NMEA_END1 NMEA_END2}; typedef struct _gga_msg GGA_Msg; --- 133,143 ---- * FIXME: Find out what leadtek uses for a proprietary header string. */ ! const uint8_t gps_gga_mask[] = {"$LTC,NMEA," NMEA_GGA_MASK NMEA_END1 NMEA_END2}; ! const uint8_t gps_rmc_mask[] = {"$LTC,NMEA," NMEA_RMC_MASK NMEA_END1 NMEA_END2}; const uint8_t gps_syncmode_on[] = {"$LTC,SYNCMODE,1" NMEA_END1 NMEA_END2}; ! const uint8_t gps_syncmode_off[] = {" ""$LTC,SYNCMODE,0*6F" NMEA_END1 NMEA_END2}; + const uint8_t gps_test[] = {" ""$LTC,1552,1*69" NMEA_END1 NMEA_END2}; + const uint8_t gps_test1[] = {" ""$LTC,1551,3,4*70" NMEA_END1 NMEA_END2}; typedef struct _gga_msg GGA_Msg; *************** *** 154,166 **** struct _gga_msg { uint8_t hours; uint8_t minutes; ! uint16_t dec_sec; uint8_t Lat_deg; ! uint16_t Lat_dec_min; uint8_t Long_deg; ! uint16_t Long_dec_min; uint8_t NSEWind; uint8_t num_sats; --- 156,170 ---- + + // 18 bytes. struct _gga_msg { uint8_t hours; uint8_t minutes; ! float dec_sec; uint8_t Lat_deg; ! float Lat_dec_min; uint8_t Long_deg; ! float Long_dec_min; uint8_t NSEWind; uint8_t num_sats; |