[Firebug-cvs] mts400/apps/TestGPS gps_new.nc,1.1,1.2 gps_newM.nc,1.2,1.3
Brought to you by:
doolin
From: <do...@us...> - 2003-11-12 01:44:23
|
Update of /cvsroot/firebug/mts400/apps/TestGPS In directory sc8-pr-cvs1:/tmp/cvs-serv25577/apps/TestGPS Modified Files: gps_new.nc gps_newM.nc Log Message: GPS sensor now runs by itself independently of the humidity sensor. Not sure if it is running correctly yet. Will need to compare output with GGA spec. Index: gps_new.nc =================================================================== RCS file: /cvsroot/firebug/mts400/apps/TestGPS/gps_new.nc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gps_new.nc 11 Nov 2003 01:58:36 -0000 1.1 --- gps_new.nc 12 Nov 2003 01:44:20 -0000 1.2 *************** *** 6,44 **** configuration gps_new { - #if 0 - provides { - interface SplitControl; - } - #endif - } implementation { ! components Main, ! gps_newM, ! MicaWbSwitch, ! UARTGpsPacket, ! TimerC, ! // NoLeds, ! LedsC; ! Main.StdControl -> gps_newM.StdControl; ! Main.StdControl -> TimerC.StdControl; ! Main.StdControl -> MicaWbSwitch.StdControl; ! //Easy stuff ! gps_newM.Leds -> LedsC; ! gps_newM.Timer -> TimerC.Timer[unique("Timer")]; ! /** New stuff for using gps without sensirion. */ //gps_newM.SwitchControl -> MicaWbSwitch.StdControl; gps_newM.PowerSwitch -> MicaWbSwitch.Switch[0]; gps_newM.IOSwitch -> MicaWbSwitch.Switch[1]; ! ! gps_newM.GpsControl -> UARTGpsPacket; ! gps_newM.GpsSend -> UARTGpsPacket; ! gps_newM.GpsReceive -> UARTGpsPacket; ! gps_newM.GpsCmd -> UARTGpsPacket.GpsCmd; } --- 6,35 ---- configuration gps_new { } implementation { ! components Main, ! gps_newM, ! MicaWbSwitch, ! UARTGpsPacket, ! TimerC, ! LedsC; ! Main.StdControl -> gps_newM.StdControl; ! Main.StdControl -> TimerC.StdControl; ! Main.StdControl -> MicaWbSwitch.StdControl; ! gps_newM.Leds -> LedsC; ! gps_newM.Timer -> TimerC.Timer[unique("Timer")]; ! /** Use gps without sensirion. */ //gps_newM.SwitchControl -> MicaWbSwitch.StdControl; gps_newM.PowerSwitch -> MicaWbSwitch.Switch[0]; gps_newM.IOSwitch -> MicaWbSwitch.Switch[1]; ! gps_newM.GpsControl -> UARTGpsPacket; ! gps_newM.GpsSend -> UARTGpsPacket; ! gps_newM.GpsReceive -> UARTGpsPacket; ! gps_newM.GpsCmd -> UARTGpsPacket.GpsCmd; } Index: gps_newM.nc =================================================================== RCS file: /cvsroot/firebug/mts400/apps/TestGPS/gps_newM.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gps_newM.nc 12 Nov 2003 00:11:47 -0000 1.2 --- gps_newM.nc 12 Nov 2003 01:44:20 -0000 1.3 *************** *** 14,24 **** interface Leds; ! // new stuff for using gps without sensirion ! interface StdControl as SwitchControl; ! interface Switch as PowerSwitch; ! interface Switch as IOSwitch; ! interface StdControl as GpsControl; ! //interface SplitControl as GpsControl; interface I2CSwitchCmds as GpsCmd; --- 14,22 ---- interface Leds; ! interface StdControl as SwitchControl; ! interface Switch as PowerSwitch; ! interface Switch as IOSwitch; ! interface StdControl as GpsControl; interface I2CSwitchCmds as GpsCmd; *************** *** 33,47 **** #include "gps.h" ! char state; ! ! enum {IDLE, BUSY, BUSY_0, BUSY_1, GET_SAMPLE_0, GET_SAMPLE_1, ! OPENSCK, OPENDATA, CLOSESCK, CLOSEDATA, POWEROFF, ! MAIN_SWITCH_ON, MAIN_SWITCH_OFF, WAIT_SWITCH_ON, WAIT_SWITCH_OFF, TIMER}; - /**** StdControl **/ command result_t StdControl.init() { --- 31,50 ---- #include "gps.h" ! /** 0 means GPS runs forever, 1 means it takes one reading ! * and powers down. ! * FIXME: The GPS sensor powers back up after it powers down, ! * this should not happen and is a problem. ! */ ! #define GPS_ONE_SHOT 0 + char state; + enum {IDLE, BUSY, BUSY_0, BUSY_1, GET_SAMPLE_0, GET_SAMPLE_1, + OPENSCK, OPENDATA, CLOSESCK, CLOSEDATA, POWEROFF, + MAIN_SWITCH_ON, MAIN_SWITCH_OFF, WAIT_SWITCH_ON, + WAIT_SWITCH_OFF, TIMER}; command result_t StdControl.init() { *************** *** 49,55 **** init_debug(); call Leds.init(); ! /* Control.init in GpsPacket.nc */ call GpsControl.init(); - return SUCCESS; } --- 52,57 ---- init_debug(); call Leds.init(); ! /** Control.init in GpsPacket.nc */ call GpsControl.init(); return SUCCESS; } *************** *** 57,60 **** --- 59,64 ---- command result_t StdControl.start() { + call Leds.redOn(); + /* Control.start in GpsPacket.nc */ call GpsControl.start(); *************** *** 65,68 **** --- 69,73 ---- } + /** Do we need this? */ call Timer.start(TIMER_REPEAT, 1000) ; *************** *** 72,89 **** command result_t StdControl.stop() { ! return call Timer.stop(); ! //return SUCCESS; } ! /****************************************************/ ! /** Timer */ ! event result_t Timer.fired() { ! call Leds.greenToggle(); ! ! return SUCCESS; ! } --- 77,101 ---- command result_t StdControl.stop() { ! SODbg(DBG_USR2, "StdControl.stop() \n"); ! ! #if GPS_ONE_SHOT ! if (call GpsCmd.PowerSwitch(GPS_POWER_OFF)) { ! SODbg(DBG_USR2, "GPS sensor powered off. \n"); ! } ! #define ! /** Timer.stop always returns success. */ ! call Timer.stop(); ! return SUCCESS; } ! /****************************************************/ ! /** Timer */ ! event result_t Timer.fired() { ! //call Leds.greenToggle(); ! return SUCCESS; ! } *************** *** 93,183 **** /** PowerSwitch */ ! event result_t PowerSwitch.getDone(char value) { ! return SUCCESS; ! } ! event result_t PowerSwitch.setDone(bool local_result) { ! switch(state) { ! case MAIN_SWITCH_ON: ! state = IDLE; ! //signal GpsControl.startDone(); ! break; ! case MAIN_SWITCH_OFF: ! state = POWEROFF; ! //signal GpsControl.stopDone(); ! break; ! case WAIT_SWITCH_ON: ! ! if (call PowerSwitch.set(MICAWB_GPS_POWER,1) == SUCCESS) { ! state = MAIN_SWITCH_ON; ! } ! break; ! case WAIT_SWITCH_OFF: ! if (call PowerSwitch.set(MICAWB_GPS_POWER,0) == SUCCESS) { ! state = MAIN_SWITCH_OFF; } - default: - break; - - } - return SUCCESS; - - - - } - - - event result_t PowerSwitch.setAllDone(bool local_result) { - return SUCCESS; - } - ! /****************************************************/ ! /** IOSwitch */ - //#if 0 - event result_t IOSwitch.getDone(char value) { - return SUCCESS; - } ! event result_t IOSwitch.setAllDone(bool local_result) { ! return SUCCESS; ! } ! event result_t IOSwitch.setDone(bool local_result) { ! SODbg(DBG_USR2, "SensirionHumidityM.SwitchI2W: state: %i \n", state); ! if (state == OPENSCK) { //SCK line enabled ! state = OPENDATA; ! return call IOSwitch.set(MICAWB_HUMIDITY_DATA,1); ! } else if (state == OPENDATA) { //Data line enabled ! state = TIMER; ! SODbg(DBG_USR2, "SensirionHumidityM.SwitchI2W: Timer Started \n"); ! return call Timer.start(TIMER_ONE_SHOT, 100); ! } else if (state == CLOSESCK) { ! state = CLOSEDATA; ! return call IOSwitch.set(MICAWB_HUMIDITY_DATA,0); ! } else if (state == CLOSEDATA) { ! } ! return SUCCESS; ! } ! //#endif ! ! /** * Packet received from GPS - ASCII msg * 1st byte in pkt is number of ascii bytes ! * async used only for testing */ event TOS_MsgPtr GpsReceive.receive(TOS_MsgPtr data) { --- 105,194 ---- /** PowerSwitch */ ! event result_t PowerSwitch.getDone(char value) { ! return SUCCESS; ! } ! /** FIXME: Make sure we don't need the startDone, stopDone ! * calls. ! */ ! event result_t PowerSwitch.setDone(bool local_result) { ! switch(state) { ! ! case MAIN_SWITCH_ON: ! state = IDLE; ! /** GpsControl is wired to GpsPacket.nc */ ! //signal GpsControl.startDone(); ! break; ! case MAIN_SWITCH_OFF: ! state = POWEROFF; ! /** GpsControl is wired to GpsPacket.nc */ ! //signal GpsControl.stopDone(); ! break; ! case WAIT_SWITCH_ON: ! if (call PowerSwitch.set(MICAWB_GPS_POWER,1) == SUCCESS) { ! state = MAIN_SWITCH_ON; ! } ! break; ! case WAIT_SWITCH_OFF: ! if (call PowerSwitch.set(MICAWB_GPS_POWER,0) == SUCCESS) { ! state = MAIN_SWITCH_OFF; ! } ! default: ! break; } + return SUCCESS; + } ! event result_t PowerSwitch.setAllDone(bool local_result) { ! return SUCCESS; ! } ! event result_t IOSwitch.getDone(char value) { ! return SUCCESS; ! } ! event result_t IOSwitch.setAllDone(bool local_result) { ! return SUCCESS; ! } ! /** FIXME: Rewrite this with a switch/case. */ ! event result_t IOSwitch.setDone(bool local_result) { ! SODbg(DBG_USR2, "IOSwitch.setDone(): state: %i \n", state); ! if (state == OPENSCK) { //SCK line enabled ! state = OPENDATA; ! return call IOSwitch.set(MICAWB_HUMIDITY_DATA,1); ! } else if (state == OPENDATA) { //Data line enabled ! state = TIMER; ! SODbg(DBG_USR2, "IOSwitch.setDone(): Timer Started, state: %i \n", ! state); ! return call Timer.start(TIMER_ONE_SHOT, 100); ! } else if (state == CLOSESCK) { ! state = CLOSEDATA; ! return call IOSwitch.set(MICAWB_HUMIDITY_DATA,0); ! } else if (state == CLOSEDATA) { ! } ! return SUCCESS; ! } /** * Packet received from GPS - ASCII msg * 1st byte in pkt is number of ascii bytes ! * async used only for testing. ! * ! * FIXME: Why is the data return? It should be ! * declared const. ! * ! * This function is called from GpsPacket.receiveTask(). */ event TOS_MsgPtr GpsReceive.receive(TOS_MsgPtr data) { *************** *** 190,194 **** UARTPutChar(gps_data->data[i]); } ! SODbg(DBG_USR2, "\n"); return data; } --- 201,206 ---- UARTPutChar(gps_data->data[i]); } ! SODbg(DBG_USR2, "\n"); ! call StdControl.stop(); return data; } *************** *** 196,199 **** --- 208,213 ---- event result_t GpsSend.sendDone(TOS_MsgPtr msg, result_t success) { + SODbg(DBG_USR2, "GpsSend.sendDone()\n", state); + return SUCCESS; } *************** *** 206,211 **** return SUCCESS; } - - } --- 220,223 ---- |