[Firebug-cvs] fireboard/beta/apps/XSensorMTS400 TestMTS400M.nc,1.19,1.20
Brought to you by:
doolin
From: Michael N. <mne...@us...> - 2005-09-09 00:03:19
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23957 Modified Files: TestMTS400M.nc Log Message: Testing updated to send arbitrary GPS commands Index: TestMTS400M.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400M.nc,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** TestMTS400M.nc 8 Sep 2005 23:33:46 -0000 1.19 --- TestMTS400M.nc 9 Sep 2005 00:03:11 -0000 1.20 *************** *** 224,228 **** // This sequence of steps is used when collecting data from the // various sensors. The steps are performed in this sequence. ! norace enum { START, BATTERY_REQUESTED, --- 224,228 ---- // This sequence of steps is used when collecting data from the // various sensors. The steps are performed in this sequence. ! typedef norace enum { START, BATTERY_REQUESTED, *************** *** 238,242 **** GPS_REQUESTED, GPS_DONE ! } readStep; // Log the current condition of the sensors. Primarily used for --- 238,243 ---- GPS_REQUESTED, GPS_DONE ! } readStep_t; ! readStep_t readStep; // Log the current condition of the sensors. Primarily used for *************** *** 299,310 **** //#define NMEA_ENABLE "$PSRF103,05,00,01,01*20\r\n" //VTG on //#define NMEA_DISABLE "$PSRF103,05,00,00,01*21\r\n" //VTG off #define NMEA_ENABLE "$PSRF103,01,00,01,01*24\r\n" //GLL on #define NMEA_DISABLE "$PSRF103,01,00,00,01*25\r\n" //GLL off // send message to the GPS to enable VTG messages on a 1 second cycle task void enableNMEAmessage() { if (!gpsIsPowered) { SODbg(DBG_USR2,"GPS off trying to Enable NMEA\n"); }; ! if ( call GpsSend.send(NMEA_ENABLE , strlen(NMEA_ENABLE)) == SUCCESS) { return; }; --- 300,371 ---- //#define NMEA_ENABLE "$PSRF103,05,00,01,01*20\r\n" //VTG on //#define NMEA_DISABLE "$PSRF103,05,00,00,01*21\r\n" //VTG off + //#define NMEA_ENABLE "$PSRF103,00,00,02,01*26\r\n" //GGA on 2 sec + //#define NMEA_ENABLE "$PSRF103,00,00,08,01*2C\r\n" //GGA on 8 sec + #define NMEA_ENABLE "$PSRF103,01,00,01,01*24\r\n" //GLL on + #define NMEA_ENABLE_LENGTH strlen(NMEA_ENABLE) #define NMEA_DISABLE "$PSRF103,01,00,00,01*25\r\n" //GLL off + #define NMEA_DISABLE_LENGTH strlen(NMEA_DISABLE) + + #if 0 + #define CHANGE_TO_SIRF_MODE "$PSRF100,0,4800,8,1,0*0F\r\n" + #define CHANGE_TO_SIRF_LENGTH strlen(CHANGE_TO_SIRF_MODE) + static const uint8_t const CHANGE_TO_NMEA_MODE[] = { + 0xA0, + 0xA2, + 0x00, + 0x18, + 0x81, + 0x02, + 0x01, + 0x01, + 0x00, + 0x01, + 0x05, + 0x01, + 0x05, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x12, + 0xC0, + 0x01, + 0x6A, + 0xB0, + 0xB3 + }; + #define CHANGE_TO_NMEA_LENGTH sizeof(CHANGE_TO_NMEA_MODE) + #define NMEA_ENABLE CHANGE_TO_NMEA_MODE + #define NMEA_ENABLE_LENGTH CHANGE_TO_NMEA_LENGTH + #define NMEA_DISABLE CHANGE_TO_SIRF_MODE + #define NMEA_DISABLE_LENGTH strlen(CHANGE_TO_SIRF_MODE) + #endif + // send message to the GPS to enable VTG messages on a 1 second cycle task void enableNMEAmessage() { + #if 0 + readStep_t localStep; + atomic localStep = readStep; + if (localStep != GPS_REQUESTED) { + // Wait until GPS is safely on + post enableNMEAmessage(); + return; + }; + #endif if (!gpsIsPowered) { SODbg(DBG_USR2,"GPS off trying to Enable NMEA\n"); }; ! if ( call GpsSend.send((char *)NMEA_ENABLE , NMEA_ENABLE_LENGTH) == SUCCESS) { ! SODbg(DBG_USR2,"GPS ENable NMEA\n"); return; }; *************** *** 316,320 **** event result_t GpsSend.sendDone(uint8_t *sendPtr, result_t status) { #if NMEA_MESSAGE_TESTING ! SODbg(DBG_USR2, "GPS %s commanded: %s",((status == SUCCESS) ? "OK" : "FAIL"),(char *)sendPtr); #endif return SUCCESS; --- 377,381 ---- event result_t GpsSend.sendDone(uint8_t *sendPtr, result_t status) { #if NMEA_MESSAGE_TESTING ! // SODbg(DBG_USR2, "GPS %s commanded: %s",((status == SUCCESS) ? "OK" : "FAIL"),(char *)sendPtr); #endif return SUCCESS; *************** *** 323,330 **** #if NMEA_MESSAGE_TESTING task void disableNMEAmessage() { if (!gpsIsPowered) { SODbg(DBG_USR2,"GPS off trying to Disable NMEA\n"); }; ! if ( call GpsSend.send(NMEA_DISABLE, strlen(NMEA_DISABLE)) == SUCCESS) { return; } --- 384,401 ---- #if NMEA_MESSAGE_TESTING task void disableNMEAmessage() { + #if 0 + readStep_t localStep; + atomic localStep = readStep; + if (localStep != GPS_REQUESTED) { + // Wait until GPS is safely on + post enableNMEAmessage(); + return; + }; + #endif if (!gpsIsPowered) { SODbg(DBG_USR2,"GPS off trying to Disable NMEA\n"); }; ! if ( call GpsSend.send(NMEA_DISABLE, NMEA_DISABLE_LENGTH) == SUCCESS) { ! SODbg(DBG_USR2,"GPS DISable NMEA\n"); return; } *************** *** 425,429 **** call TempHumControl.init(); //init Sensirion call PressureControl.init(); // init Intersema ! return SUCCESS; } --- 496,500 ---- call TempHumControl.init(); //init Sensirion call PressureControl.init(); // init Intersema ! SODbg(DBG_USR2,"InitComplete\n"); return SUCCESS; } *************** *** 436,439 **** --- 507,511 ---- call BattControl.start(); + SODbg(DBG_USR2,"Starting GPS\n"); #ifdef MTS420 call GpsControl.start(); *************** *** 465,469 **** *****************************************************************************/ event result_t Timer.fired() { ! uint8_t localStep; call Leds.redToggle(); --- 537,541 ---- *****************************************************************************/ event result_t Timer.fired() { ! readStep_t localStep; call Leds.redToggle(); *************** *** 484,498 **** static uint8_t cycleCount; cycleCount += 1; ! if (cycleCount == 10) { SODbg(DBG_USR2, "Trying NMEA On\n"); post enableNMEAmessage(); return SUCCESS; }; ! if (cycleCount == 70) { SODbg(DBG_USR2, "Trying NMEA OFF\n"); post disableNMEAmessage(); return SUCCESS; }; ! if (cycleCount == 120) { cycleCount = 0; }; --- 556,570 ---- static uint8_t cycleCount; cycleCount += 1; ! if (cycleCount == 5) { SODbg(DBG_USR2, "Trying NMEA On\n"); post enableNMEAmessage(); return SUCCESS; }; ! if (cycleCount == 30) { SODbg(DBG_USR2, "Trying NMEA OFF\n"); post disableNMEAmessage(); return SUCCESS; }; ! if (cycleCount >= 60) { cycleCount = 0; }; *************** *** 570,573 **** --- 642,646 ---- sensorStatus = SENSOR_PRESSURE_START; } + SODbg(DBG_USR2,"Pressure start\n"); return call PressureControl.start(); case PRESSURE_REQUESTED: *************** *** 658,666 **** // ???is this still appropriate? Double buffering should // eliminate the need. ! if (readStep == GPS_DONE) return; leadtek_string = pGPSdata->data; #if 1 if (leadtek_string[0] == '$') { int i; for (i=0;i < MIN(sizeof(pGPSdata->data),pGPSdata->length);i += 1) { --- 731,744 ---- // ???is this still appropriate? Double buffering should // eliminate the need. ! { ! readStep_t localStep; ! atomic localStep = readStep; ! if (localStep == GPS_DONE) return; ! } leadtek_string = pGPSdata->data; #if 1 if (leadtek_string[0] == '$') { + // echo the GPS message int i; for (i=0;i < MIN(sizeof(pGPSdata->data),pGPSdata->length);i += 1) { |