[Firebug-cvs] fireboard/beta/apps/XSensorMTS400 Makefile,1.7,1.8 TestMTS400.nc,1.3,1.4 TestMTS400M.n
Brought to you by:
doolin
From: David M. D. <do...@us...> - 2005-05-27 00:38:34
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7193 Modified Files: Makefile TestMTS400.nc TestMTS400M.nc sensorboardApp.h Log Message: Moved gga parsing to nmea module. Index: TestMTS400M.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400M.nc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TestMTS400M.nc 26 May 2005 18:29:58 -0000 1.7 --- TestMTS400M.nc 27 May 2005 00:38:13 -0000 1.8 *************** *** 144,148 **** *****************************************************************************/ ! includes gps; #include "appFeatures.h" --- 144,148 ---- *****************************************************************************/ ! #include "appFeatures.h" *************** *** 193,196 **** --- 193,198 ---- interface ADC as TaosCh1; + interface NMEA as nmea; + interface Timer; interface Leds; *************** *** 201,204 **** --- 203,212 ---- implementation { + // Why do some #includes need to be located + // in the implementation and not at the top + // of the file? + #include "gps.h" + #include "NMEA.h" + enum {START, BUSY, *************** *** 538,626 **** uint32_t temp; bool end_of_field; ! char *packet_format; char *pdata; float dec_secs,dec_min; ! //change to GPS packet!! GPS_MsgPtr gps_data = (GPS_MsgPtr)data; // if gps have been scaned then stop receiving gps uart packet if (state == GPS_DONE) return data; ! // check for NMEA format, gga_fields[0] ! packet_format = gps_data->data; ! // ! if ( !((packet_format[3] == 'G') && (packet_format[4] == 'G') && ! (packet_format[5] == 'A'))) { ! //SODbg(DBG_USR2, "No NEMA format, gps packet parese failed!! \n"); return data; ! } ! ! // parse comma delimited fields to gga_filed[][] ! end_of_field = FALSE; ! i=0; ! k=0; ! length = gps_data->length; ! while (i < GGA_FIELDS) { ! // assemble gga_fields array ! end_of_field = FALSE; ! j = 0; ! while ((!end_of_field) & (k < length)) { ! if (gps_data->data[k] == GPS_DELIMITER) { ! end_of_field = TRUE; ! } ! else { ! gga_fields[i][j] = gps_data->data[k]; ! } ! j++; ! k++; ! } ! // two commas (,,) indicate empty field ! // if field is empty, set it equal to 0 ! if (j <= 1) { ! for (m=0; m<10; m++) gga_fields[i][m] = '0'; ! } ! i++; } ! ! // uint8_t ! pack->xData.dataGps.fixed=(uint8_t)(gga_fields[6][0]-'0'); // invalid ! ! // gga_msg.hours = call extract_hours(gga_fields[1]); ! pdata=gga_fields[1]; ! pack->xData.dataGps.hour=10*(pdata[0]-'0') + (pdata[1]-'0'); ! ! // gga_msg.minutes = call extract_minutes(gga_fields[1]); ! pack->xData.dataGps.minute=10*(pdata[2]-'0') + (pdata[3]-'0'); ! ! // uint32_t ! // gga_msg.dec_sec = call extract_dec_sec(gga_fields[1]); ! dec_secs = 10*(pdata[4]-'0') + (pdata[5]-'0') + 0.1*(pdata[7]-'0') ! + 0.01*(pdata[8]-'0') ! + 0.001*(pdata[9]-'0'); ! temp = (uint32_t)(dec_secs * 1000); pack->xData.dataGps.dec_sec = temp; ! ! // gga_msg.Lat_deg = call extract_Lat_deg(gga_fields[2]); ! pdata=gga_fields[2]; ! pack->xData.dataGps.lat_deg= (uint16_t)(10*(pdata[0]-'0') + (pdata[1]-'0')); ! ! // gga_msg.Lat_dec_min = call extract_Lat_dec_min(gga_fields[2]); ! dec_min = 10*(pdata[2]-'0') + (pdata[3]-'0') + 0.1*(pdata[5]-'0') ! + 0.01*(pdata[6]-'0') + 0.001*(pdata[7]-'0') + 0.0001*(pdata[8]-'0'); ! temp = (uint32_t)(dec_min * 10000); pack->xData.dataGps.lat_dec_min = temp; ! ! // gga_msg.Long_deg = call extract_Long_deg(gga_fields[4]); ! pdata = gga_fields[4]; ! pack->xData.dataGps.long_deg = ! (100*(pdata[0]-'0') + 10*(pdata[1]-'0') + (pdata[2]-'0')); ! ! // gga_msg.Long_dec_min = call extract_Long_dec_min(gga_fields[4]); ! dec_min = 10*(pdata[3]-'0') + (pdata[4]-'0') + 0.1*(pdata[6]-'0') ! + 0.01*(pdata[7]-'0') + 0.001*(pdata[8]-'0') + 0.0001*(pdata[9]-'0'); ! temp = (uint32_t)(dec_min * 10000); pack->xData.dataGps.long_dec_min= temp; ! NS = (gga_fields[3][0] == 'N') ? 1 : 0; EW = (gga_fields[5][0] == 'W') ? 1 : 0; --- 546,590 ---- uint32_t temp; bool end_of_field; ! char * leadtek_string; char *pdata; float dec_secs,dec_min; ! GGA_Data gga_data = {0}; ! GGA_Data * gga_data_ptr; ! //change to GPS packet!! GPS_MsgPtr gps_data = (GPS_MsgPtr)data; + gga_data_ptr = &gga_data; + + // if gps have been scaned then stop receiving gps uart packet if (state == GPS_DONE) return data; ! leadtek_string = gps_data->data; ! if (!is_gga_string_m(leadtek_string)) { return data; ! } else { ! // For some reason there is a compiler warning on ! // gga_data_ptr. ! call nmea.gga_parse(gga_data_ptr, leadtek_string); } ! ! if (gga_data_ptr->num_sats > 2) { ! pack->xData.dataGps.fixed = 1; ! } ! ! // Pack everything into xbow structs so that ! // xlisten can process it. ! pack->xData.dataGps.hour = gga_data_ptr->hours; ! pack->xData.dataGps.minute = gga_data_ptr->minutes; ! temp = (uint32_t)(gga_data_ptr->dec_sec * 1000); pack->xData.dataGps.dec_sec = temp; ! pack->xData.dataGps.lat_deg= gga_data_ptr->Lat_deg; ! temp = (uint32_t)(gga_data_ptr->Lat_dec_min * 10000); pack->xData.dataGps.lat_dec_min = temp; ! pack->xData.dataGps.long_deg = gga_data_ptr->Long_deg; ! temp = (uint32_t)(gga_data_ptr->Long_dec_min * 10000); pack->xData.dataGps.long_dec_min= temp; ! NS = (gga_fields[3][0] == 'N') ? 1 : 0; EW = (gga_fields[5][0] == 'W') ? 1 : 0; Index: sensorboardApp.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/sensorboardApp.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sensorboardApp.h 24 May 2005 21:53:17 -0000 1.3 --- sensorboardApp.h 27 May 2005 00:38:13 -0000 1.4 *************** *** 1,36 **** // $Id$ - #define MAKE_GPS_ENA_OUTPUT() sbi(DDRE,6) - #define SET_GPS_ENA() cbi(PORTE,6) - #define CLR_GPS_ENA() sbi(PORTE,6) - - #define GPS_MSG_LENGTH 100 - #define GPS_CHAR 11 - #define GGA_FIELDS 8 - #define GPS_CHAR_PER_FIELD 10 - #define GPS_DELIMITER ',' - #define GPS_END_MSG '*' - - // 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; - //}; ! //typedef struct _gga_msg GGA_Msg; ! // ! // - typedef struct XSensorHeader{ uint8_t board_id; uint8_t packet_id; // 3 --- 1,10 ---- // $Id$ + #ifndef SENSORBOARDAPP_H + #define SENSORBOARDAPP_H ! typedef struct XSensorHeader { uint8_t board_id; uint8_t packet_id; // 3 *************** *** 40,45 **** ! typedef struct GGAMsg ! { uint8_t hour; uint8_t minute; --- 14,19 ---- ! typedef struct GGAMsg { ! uint8_t hour; uint8_t minute; *************** *** 53,58 **** } __attribute__ ((packed)) GGAMsg; ! typedef struct XSensorMTS400DataMsg ! { uint16_t vref; uint16_t humidity; --- 27,33 ---- } __attribute__ ((packed)) GGAMsg; ! ! typedef struct XSensorMTS400DataMsg { ! uint16_t vref; uint16_t humidity; *************** *** 70,73 **** --- 45,49 ---- } __attribute__ ((packed)) XSensorMTS400DataMsg; + enum { AM_XSXMSG = 0, *************** *** 82,83 **** --- 58,61 ---- } __attribute__ ((packed)) XDataMsg; + + #endif /* SENSORBOARDAPP_H */ Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile 26 May 2005 18:29:58 -0000 1.7 --- Makefile 27 May 2005 00:38:13 -0000 1.8 *************** *** 12,17 **** -I$(XBOWROOT)/lib ! PFLAGS +=-I$(FIREBOARDROOT)/beta/tos/sensorboards/$(SENSORBOARD) ! # -I$(FIREBOARDROOT)/beta/tos/sensorboards/$(SENSORBOARD)/gps PFLAGS += -I$(FIREBOARDROOT)/interfaces --- 12,17 ---- -I$(XBOWROOT)/lib ! PFLAGS += -I$(FIREBOARDROOT)/beta/tos/sensorboards/$(SENSORBOARD) ! PFLAGS += -I$(FIREBOARDROOT)/beta/tos/sensorboards/$(SENSORBOARD)/GPS PFLAGS += -I$(FIREBOARDROOT)/interfaces Index: TestMTS400.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400.nc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestMTS400.nc 24 May 2005 21:53:17 -0000 1.3 --- TestMTS400.nc 27 May 2005 00:38:13 -0000 1.4 *************** *** 60,74 **** * */ ! #include "appFeatures.h" includes sensorboardApp; configuration TestMTS400 { - // this module does not provide any interface } implementation { ! components Main, TestMTS400M, SensirionHumidity, ! IntersemaPressure,MicaWbSwitch,GenericComm as Comm, ! TimerC, Voltage, LedsC, Accel, TaosPhoto, ! XEE_PARAMS_COMPONENT #ifdef MTS420 UARTGpsPacket, --- 60,92 ---- * */ ! includes sensorboardApp; + #include "appFeatures.h" + //#include "gps.h" + //#include "NMEA.h" + + + configuration TestMTS400 { } + implementation { ! ! ! components Main, ! TestMTS400M, ! SensirionHumidity, ! IntersemaPressure, ! MicaWbSwitch, ! GenericComm as Comm, ! TimerC, ! Voltage, ! NMEAC, ! LedsC, ! Accel, ! TaosPhoto, ! XEE_PARAMS_COMPONENT ! #ifdef MTS420 UARTGpsPacket, *************** *** 123,125 **** --- 141,146 ---- TestMTS400M.Leds -> LedsC; TestMTS400M.Timer -> TimerC.Timer[unique("Timer")]; + + TestMTS400M.nmea -> NMEAC; + } |