whatever
Dependencies: C027 C027_Support M2XStreamClient PowerControl jsonlite mbed-rtos mbed
Fork of PONY_Ph0-uAXIS by
Diff: main.cpp
- Revision:
- 33:4ed19bed18c0
- Parent:
- 32:4b94cb22d338
- Child:
- 34:f28937f7657d
--- a/main.cpp Wed Nov 25 22:25:14 2015 +0000 +++ b/main.cpp Tue Dec 01 00:32:19 2015 +0000 @@ -46,7 +46,11 @@ wait(0.2); } - int ret; // Integer returns + //int ret; // Integer returns + //int len; // The length of the ret integer + + double la = 0, lo = 0; // Declare latitude and longitude variables + double UTCtime = 0; // Not 100% sure where this LARGE_DATA flag is being set, but I think we might be using it... (SGM) #ifdef LARGE_DATA @@ -55,21 +59,11 @@ char buf[512] = ""; #endif - if(sizeof(buf) > 600) - printf("(Using LARGE_DATA)\r\n"); - else - printf("(Not using large data)\r\n"); - - - printf("\r\nBegin test loop\r\n"); + ////////////////////////////////// GPSI2C gps; // Initialize GPS object - printf("GPS initialized...\r\n"); - - - /* while( (ret = gps.getMessage(buf, sizeof(buf))) < 1 ) { if (ret<0) @@ -79,23 +73,40 @@ myled = !myled; wait(1.0); }*/ - - if (gpsReady(gps, 5) ) { - printf("GPS ready"); + + + + + + + // How long will we wait before we accept ANY location value? + float locationLoopWait = 0.25; - float locationLoopWait = 0.25; - int locationLoopIter = 0; - - // How long will we wait before we accept ANY location value? int locationLoopTimeout = 30; int locationLoopCountout = (float) locationLoopTimeout / locationLoopWait; + + // Ready the GPS + if ( gpsReady(&gps, 5) ) { + if ( getGLL(&gps, locationLoopCountout, &la, &lo, &UTCtime) ) { + printf("Have GLL data:\r\n%s", buf); + } + else { + printf("Timeout; no valid GLL data received"); + } + } + + + + /* // Get a good GPS message - int len = LENGTH(ret); + printf("\r\nMessage loop wait=%fs\r\n",locationLoopWait); + + int locationLoopIter = 0; while(true) { locationLoopIter++; @@ -119,7 +130,7 @@ - /* + if ( _CHECK_TALKER("GLL") ) { char ch = '-'; // FIX: The getNmeaItem isn't working to capture the check character in a valid GLL code, which is unusual; the workaround seems to be that invalid GLL values DOES find a "V" @@ -155,18 +166,19 @@ */ - wait(locationLoopWait); - }// LOOP THAT MOFO + //wait(locationLoopWait); + //}// LOOP THAT MOFO // Begin parsing our GPS value - double la = 0, lo = 0; // Declare latitude and longitude variables + - gps.getNmeaAngle(1,buf,len,la); - gps.getNmeaAngle(3,buf,len,lo); + //gps.getNmeaAngle(1,buf,len,la); + //gps.getNmeaAngle(3,buf,len,lo); - printf("\r\n\nLatitude: %G\r\nLongitude: %G\r\n\n", la, lo); + printf("Latitude: %G\r\nLongitude: %G\r\nUTC Time:%f\r\n\n", la, lo, UTCtime); + @@ -230,13 +242,13 @@ } // Send SMS - char num1[32] = "+12062556786"; + char num1[32] = "+14259749434"; char smsText[144]; - sprintf(smsText, "PONY unit located at: %f, %f", la, lo); + sprintf(smsText, "PONY unit located at: %f, %f, UTC %f", la, lo, UTCtime); printf("Message: %s\r\n", smsText); - /* + printf("\r\nSend to: %s\r\n", num1); if( mdm.smsSend(num1, smsText) ) { @@ -246,52 +258,6 @@ printf("SMS fail. :-( \r\n"); } - */ - - - - - - - - //printf("\n\rThat's our IP address!\r\n"); - - // Let's send a text - //printf("\r\nAttempting to text:"); - - //char* txtText; - //sprintf(txtText, "PONY located at lat/long %G, %G", la, lo); - - //printf(txtText); - //printf(txtText); - //printf("' to %s\r\n", txtText); - - //char num[32] = "+14259749434"; - - //mdm.smsSend(num, txtText); + - //printf("debug check"); - - - - - - - - - - - - -} - - - - - - - - - - - +} \ No newline at end of file