[Firebug-cvs] firebug/project/src/FireBug .cvsignore,1.1,1.2 FireBug.nc,1.1,1.2 FireBugM.nc,1.1,1.2
Brought to you by:
doolin
From: <do...@us...> - 2004-01-05 15:08:42
|
Update of /cvsroot/firebug/firebug/project/src/FireBug In directory sc8-pr-cvs1:/tmp/cvs-serv3949 Modified Files: .cvsignore FireBug.nc FireBugM.nc Log Message: Updating from non sf archive. Index: .cvsignore =================================================================== RCS file: /cvsroot/firebug/firebug/project/src/FireBug/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 17 Dec 2003 13:07:56 -0000 1.1 --- .cvsignore 5 Jan 2004 15:08:35 -0000 1.2 *************** *** 1 **** ! build --- 1 ---- ! build *~ Index: FireBug.nc =================================================================== RCS file: /cvsroot/firebug/firebug/project/src/FireBug/FireBug.nc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FireBug.nc 17 Dec 2003 13:07:56 -0000 1.1 --- FireBug.nc 5 Jan 2004 15:08:35 -0000 1.2 *************** *** 7,10 **** --- 7,12 ---- includes RoutingStack; + //includes gps; + configuration FireBug { *************** *** 14,51 **** implementation { ! components Main, ! FireBugM, MHSender, LedsC, - MicaWbSwitch, VirtualComm, ParentSelection, ! UARTGpsPacket, ! TimerWrapper; ! //Accel; Main.StdControl -> FireBugM.StdControl; FireBugM.MultiHopSend -> MHSender.MultiHopSend[RS_DATA_TYPE]; - ParentSelection.InForwardReceive -> VirtualComm.ReceiveMsg[RS_DATA_TYPE]; FireBugM.Timer1 -> TimerWrapper.Timer[unique("Timer")]; FireBugM.Timer2 -> TimerWrapper.Timer[unique("Timer")]; FireBugM.Leds -> LedsC; - Main.StdControl -> MHSender.StdControl; ! ! // Wiring for gps ! FireBugM.GpsControl -> UARTGpsPacket; ! FireBugM.GpsSend -> UARTGpsPacket; ! FireBugM.GpsReceive -> UARTGpsPacket; ! FireBugM.GpsCmd -> UARTGpsPacket.GpsCmd; ! ! ! ! // Wiring for Accelerometer, not yet dealt with in Makelocal ! #if 0 ! FireBugM.AccelControl -> Accel.StdControl; ! FireBugM.AccelCmd -> Accel.AccelCmd; ! #endif } --- 16,38 ---- implementation { ! components FireBugM, MHSender, LedsC, VirtualComm, ParentSelection, ! TimerWrapper, ! Main; ! Main.StdControl -> FireBugM.StdControl; + Main.StdControl -> MHSender.StdControl; + FireBugM.MultiHopSend -> MHSender.MultiHopSend[RS_DATA_TYPE]; FireBugM.Timer1 -> TimerWrapper.Timer[unique("Timer")]; FireBugM.Timer2 -> TimerWrapper.Timer[unique("Timer")]; FireBugM.Leds -> LedsC; ! ParentSelection.InForwardReceive -> VirtualComm.ReceiveMsg[RS_DATA_TYPE]; } Index: FireBugM.nc =================================================================== RCS file: /cvsroot/firebug/firebug/project/src/FireBug/FireBugM.nc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FireBugM.nc 17 Dec 2003 13:07:56 -0000 1.1 --- FireBugM.nc 5 Jan 2004 15:08:35 -0000 1.2 *************** *** 17,24 **** includes RoutingStack; ! includes gps; ! /** FIXME: Move these to the gps.h file. */ #define GPS_MSG_LENGTH 100 --- 17,25 ---- includes RoutingStack; ! //includes gps; ! /** ! * Move this stuff into the gps.h file. */ #define GPS_MSG_LENGTH 100 *************** *** 38,43 **** interface StdControl; - command result_t parseGPS(int8_t gga_string[GPS_MSG_LENGTH], uint8_t length); - command result_t logGPS(char gga_fields[GPS_FIELDS][GPS_CHAR_PER_FIELD]); } --- 39,42 ---- *************** *** 48,82 **** interface Timer as Timer2; interface Leds; - - interface I2CSwitchCmds as GpsCmd; - interface StdControl as GpsControl; - interface BareSendMsg as GpsSend; - interface ReceiveMsg as GpsReceive; - - - //Accels - #if 0 - interface StdControl as AccelControl; - interface I2CSwitchCmds as AccelCmd; - #endif - - } } - #define DATA_FREQ 10000 implementation { #include "SODebug.h" ! #include "gps.h" TOS_Msg msgToSend; ! //GPS_MsgPtr gps_data; struct DataFormat_t { uint16_t addr; uint16_t cnt; float temp; ! float rel_hum; ! float baro_pres; }; --- 47,82 ---- interface Timer as Timer2; interface Leds; } } implementation { #include "SODebug.h" ! TOS_Msg msgToSend; ! //GGA_Msg *pGGA; ! uint8_t pHours; ! uint8_t pMinutes; ! uint16_t pDec_sec; ! uint8_t pLat_deg; ! uint16_t pLat_dec_min; ! uint8_t pLong_deg; ! uint16_t pLong_dec_min; ! uint8_t pNSEWind; struct DataFormat_t { uint16_t addr; uint16_t cnt; + 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; float temp; ! //float rel_hum; ! //float baro_pres; }; *************** *** 87,118 **** bool gps_active; //true if gps is active ! command result_t StdControl.init() { ! gps_active = TRUE; init_debug(); call Leds.init(); - call GpsControl.init(); - //call AccelControl.init(); //initialize accelerometer return SUCCESS; } command result_t StdControl.start() { int i; counter = 0; - call GpsControl.start(); - SODbg(DBG_USR2, "FireBugM.GpsControl.start() called\n"); - - call Timer1.start(TIMER_REPEAT, 5000); - - //if (! call GpsCmd.PowerSwitch(1)) { //turn on GPS power - // call Leds.yellowToggle(); - // SODbg(DBG_USR2, "Failed to power on gps \n"); - //} - - call Leds.redToggle(); for (i = 0; i < 29; i++) { msgToSend.data[i] = 0; --- 87,107 ---- bool gps_active; //true if gps is active ! bool gps_done; command result_t StdControl.init() { ! gps_active = FALSE; ! gps_done = TRUE; init_debug(); call Leds.init(); return SUCCESS; } command result_t StdControl.start() { + int i; counter = 0; for (i = 0; i < 29; i++) { msgToSend.data[i] = 0; *************** *** 127,138 **** event result_t Timer1.fired() { - //call GpsCmd.GpsPower(1); ! SODbg(DBG_USR2, "FireBugM.Timer1.fired()\n"); ! ! if (! call GpsCmd.PowerSwitch(1)) { //turn on GPS power call Leds.yellowToggle(); ! SODbg(DBG_USR2, "Failed to power on gps \n"); } return SUCCESS; } --- 116,132 ---- event result_t Timer1.fired() { ! #if 0 ! if (!gps_active){ call Leds.yellowToggle(); ! //if (! call GpsCmd.PowerSwitch(1)) { //turn on GPS power ! call GpsCmd.PowerSwitch(1); ! gps_active = TRUE; ! } ! else{ ! gps_active = FALSE; } + #endif + return SUCCESS; } *************** *** 154,160 **** uint8_t *dataPortion; uint16_t availableLength = 0; - struct DataFormat_t *df; ! SODbg(DBG_USR2, "FireBugM.Timer2.fired()\n"); if (sending == 1) { --- 148,153 ---- uint8_t *dataPortion; uint16_t availableLength = 0; ! struct DataFormat_t *df; if (sending == 1) { *************** *** 162,174 **** } dataPortion = call MultiHopSend.getBuffer(&msgToSend, &availableLength); df = (struct DataFormat_t *) dataPortion; df->addr = TOS_LOCAL_ADDRESS; df->cnt = counter++; ! //df->temp = gps_data->data[0]; ! //df->rel_hum = gps_data->data[1]; ! //df->baro_pres = gps_data->data[2]; sending = call MultiHopSend.send(&msgToSend, sizeof(struct DataFormat_t)); return SUCCESS; } --- 155,189 ---- } + #if 0 dataPortion = call MultiHopSend.getBuffer(&msgToSend, &availableLength); df = (struct DataFormat_t *) dataPortion; df->addr = TOS_LOCAL_ADDRESS; df->cnt = counter++; ! df->hours = pHours; ! df->minutes = pMinutes; ! df->dec_sec = pDec_sec; ! df->Lat_deg = pLat_deg; ! df->Lat_dec_min = pLat_dec_min; ! df->Long_deg = pLong_deg; ! df->Long_dec_min = pLong_dec_min; ! df->NSEWind = pNSEWind; ! df->temp = 100.1; ! //df->rel_hum = 36.2; ! //df->baro_pres = 28.3; ! ! SODbg(DBG_USR2, "hours:%i\n", df->hours); ! SODbg(DBG_USR2, "hours:%i\n", pHours); ! //SODbg(DBG_USR2, "minutes:%i\n", df->minutes); ! //SODbg(DBG_USR2, "dec_sec:%i\n", df->dec_sec); ! //SODbg(DBG_USR2, "Lat_deg:%i\n", df->Lat_deg); ! //SODbg(DBG_USR2, "Lat_dec_min:%i\n", df->Lat_dec_min); ! //SODbg(DBG_USR2, "Long_deg:%i\n", df->Long_deg); ! //SODbg(DBG_USR2, "Long_dec_min:%i\n", df->Long_dec_min); ! //SODbg(DBG_USR2, "NSEWind:%i\n", df->NSEWind); ! //SODbg(DBG_USR2, "hours:%h\n", df->temp); sending = call MultiHopSend.send(&msgToSend, sizeof(struct DataFormat_t)); + #endif + return SUCCESS; } *************** *** 185,416 **** event result_t MultiHopSend.sendDone(TOS_MsgPtr msg, uint8_t success) { sending = 0; call Timer2.stop(); return SUCCESS; } - // ************************** - //*Packet received from GPS* - //************************** - // - //*The following should be executed in GpsPacket - - - event TOS_MsgPtr GpsReceive.receive(TOS_MsgPtr data) { - - int8_t gga_string[GPS_MSG_LENGTH]; - bool gga_read = FALSE; - bool gga_read_done = FALSE; - uint16_t i = 0; - uint8_t j = 0; - uint8_t k = 0; - - GPS_MsgPtr gps_data = (GPS_MsgPtr)data; - SODbg(DBG_USR2, "gps_data:%i,\n", gps_data->length); - for (k = 0; k <= gps_data->length ; k++) UARTPutChar(gps_data->data[k]); - SODbg(DBG_USR2, "\n"); - - while (!gga_read_done) { - - if(gps_data->data[i] == 'G') { - if(gps_data->data[i+1] == 'G') { - if(gps_data->data[i+2] == 'A') { - gga_read = TRUE; - } - } - } - - if(gps_data->data[i] == GPS_END_MSG) { - if(gga_read) { - if(call GpsCmd.PowerSwitch(0)) { - SODbg(DBG_USR2, "GPS Power Off\n"); - } - call parseGPS(gga_string, j); - gga_read = FALSE; - gga_read_done = TRUE; - } - } - - if(gga_read) { - gga_string[j] = gps_data->data[i]; - j++; - } - - i++; - } - - call Leds.greenToggle(); - return data; - } - - - - //**************** - //*Parse GPS Data* - //**************** - //* - //* Fields are comma delimited - //* NMEA string parsed by field and stored into - //* gga_fields array - - - command result_t parseGPS(int8_t gga_string[GPS_MSG_LENGTH], uint8_t length) { - - char gga_fields[GPS_FIELDS][GPS_CHAR_PER_FIELD]; - - bool end_of_field = FALSE; - uint8_t i=0; - uint8_t j,m; - uint16_t k=0; - - //***DEBUG: Output NMEA message*** - uint16_t q; - SODbg(DBG_USR2, "parse GPS: \n"); - for(q=0; q<length; q++) UARTPutChar(gga_string[q]); - SODbg(DBG_USR2, "\n"); - //******************************** - - // Parse and store comma delimited fields into EEPROM - while (i < GPS_FIELDS) { - - // assemble gga_fields array - end_of_field = FALSE; - j = 0; - while (!end_of_field & k < length) { - if (gga_string[k] == GPS_DELIMITER) { - end_of_field = TRUE; - } - else { - gga_fields[i][j] = gga_string[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++; - } - - //call logGPS(gga_fields); - return SUCCESS; - } - - - - // ************** - //*Log GGA data* - //************** - //* - //* Assemble GGA message structure from gga_fields - //* Store GGA data into line 25 of EEPROM - - - command result_t logGPS(char gga_fields[GPS_FIELDS][GPS_CHAR_PER_FIELD]) { - - #if 0 - GGA_Msg *pGGA; - char gga_log_array[GPS_CHAR]; - - char NS; - char EW; - uint8_t j; - uint8_t nos; // number of satellites - - // Assemble GGA_Msg - - pGGA->hours = 10*(gga_fields[1][0]-'0') + (gga_fields[1][1]-'0'); - gga_log_array[0] = pGGA->hours; - pGGA->minutes = 10*(gga_fields[1][2]-'0') + (gga_fields[1][3]-'0'); - gga_log_array[1] = pGGA->minutes; - pGGA->dec_sec = 10000*(gga_fields[1][4]-'0') + 1000*(gga_fields[1][5]-'0') + 100*(gga_fields[1][7]-'0') + 10*(gga_fields[1][8]-'0') + (gga_fields[1][9]-'0'); - gga_log_array[2] = (pGGA->dec_sec)>>8; // MSB - gga_log_array[3] = pGGA->dec_sec; // LSB - - pGGA->Lat_deg = 10*(gga_fields[2][0]-'0') + (gga_fields[2][1]-'0'); - gga_log_array[4] = pGGA->Lat_deg; - pGGA->Lat_dec_min = 100000*(gga_fields[2][2]-'0') + 10000*(gga_fields[2][3]-'0') + 1000*(gga_fields[2][4]-'0') + 100*(gga_fields[2][5]-'0') + 10*(gga_fields[2][6]-'0') + (gga_fields[2][7]-'0'); - gga_log_array[5] = (pGGA->Lat_dec_min)>>8; - gga_log_array[6] = pGGA->Lat_dec_min; - - pGGA->Long_deg = 100*(gga_fields[4][0]-'0') + 10*(gga_fields[4][1]-'0') + (gga_fields[4][2]-'0'); - gga_log_array[7] = pGGA->Long_deg; - pGGA->Long_dec_min = 100000*(gga_fields[4][3]-'0') + 10000*(gga_fields[4][4]-'0') + 1000*(gga_fields[4][5]-'0') + 100*(gga_fields[4][6]-'0') + 10*(gga_fields[4][7]-'0') + (gga_fields[4][8]-'0'); - gga_log_array[8] = (pGGA->Long_dec_min)>>8; - gga_log_array[9] = pGGA->Long_dec_min; - - NS = (gga_fields[3][0] == 'N') ? 1 : 0; - EW = (gga_fields[5][0] == 'W') ? 1 : 0; - pGGA->NSEWind = EW | (NS<<4); // eg. Status = 000N000E = 00010000 - gga_log_array[10] = pGGA->NSEWind; - - nos = 10*(gga_fields[7][0]-'0') + (gga_fields[7][1]-'0'); - - //***DEBUG: Output GGA data before gga_fields*** - SODbg(DBG_USR2, "LOGGER GPS:\n"); - for(j=0; j<11; j++) UARTPutChar(gga_log_array[j]); - SODbg(DBG_USR2, "\n"); - //***************************************** - - #endif - - return SUCCESS; - } - - - - - /****************************************************************************** - * Packet received from GPS - ASCII msg - * 1st byte in pkt is number of ascii bytes - * async used only for testing - *****************************************************************************/ - - - //((((((((((((((This is a alternative way from the above)))))))))))))) - /* - - event TOS_MsgPtr GpsReceive.receive(TOS_MsgPtr data) { //change to GPS packet!! - uint8_t i; - - GPS_MsgPtr gps_data = (GPS_MsgPtr)data; - - //gps_data = (GPS_MsgPtr)data; - call Leds.greenToggle(); - - //for (i = 0; i <= gps_data->data[0] ; i++) UARTPutChar(gps_data->data[i]); - for (i = 0; i <= gps_data->length ; i++) UARTPutChar(gps_data->data[i]); - - SODbg(DBG_USR2, "\n"); - call Timer2.start(TIMER_ONE_SHOT,300); - return data; - } - */ - - - event result_t GpsSend.sendDone(TOS_MsgPtr msg, result_t success) { - return SUCCESS; - } - - - event result_t GpsCmd.SwitchesSet(uint8_t PowerState){ - gps_active = TRUE; - call Leds.yellowToggle(); - SODbg(DBG_USR2, "Gps power on \n"); - - return SUCCESS; - } - - - #if 0 - event result_t AccelCmd.SwitchesSet(uint8_t PowerState){ - return SUCCESS; - } - #endif } --- 200,211 ---- event result_t MultiHopSend.sendDone(TOS_MsgPtr msg, uint8_t success) { + sending = 0; call Timer2.stop(); + SODbg(DBG_USR2, "radio_senddone, power gps again\n"); return SUCCESS; } } |