Colin Stearns
/
qcControl
QC Control software
Fork of dgps by
Revision 42:c78632c16d54, committed 2014-04-23
- Comitter:
- krobertson
- Date:
- Wed Apr 23 04:16:46 2014 +0000
- Parent:
- 40:7b4d6043f533
- Parent:
- 41:df156ae5631b
- Child:
- 43:b8cbe6f0ec47
- Commit message:
- merged
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/handle/handleGPS.cpp Wed Apr 23 04:09:06 2014 +0000 +++ b/handle/handleGPS.cpp Wed Apr 23 04:16:46 2014 +0000 @@ -93,9 +93,9 @@ void GPSHandle::handleUpdate(){ char c; reading = false; - while(getPS().rx_ready_with_timeout(&GPS::getSerial())){ + while(getPS().rx_ready_with_timeout(&GPS::getSerial(),0,1000)){ c = GPS::getSerial().getc(); - USB::getSerial().printf("%c",c); + //USB::getSerial().printf("%c",c); if (reading) { if(line_i>=MAXREADIN){reading=false;return;} if (c == '*') { //sentence buffer complete; we're ignoring the checksum @@ -122,7 +122,7 @@ longitude = degrees + minutes/60; USB::getSerial().printf("\nMy GPS data: Lat: %f, Lon: %f, Alt: %f, Time:%f\r\n",latitude,longitude,altitude,timeS); DH::Locs().add(LHType_locs,DataLocation(latitude,longitude,altitude,timeS)); - USB::getSerial().printf("Current Time:%f\r\n",DH::Locs().getC().getTime()); + // USB::getSerial().printf("Current Time:%f\r\n",DH::Locs().getC().getTime()); return; } }
--- a/main.cpp Wed Apr 23 04:09:06 2014 +0000 +++ b/main.cpp Wed Apr 23 04:16:46 2014 +0000 @@ -134,12 +134,16 @@ getPS().openConnection(); getPS().closeConnection(); //Main Loop + int count = 0; while(1){ + USB::getSerial().printf("Running GPS...\r\n"); GPSHandle::getGPSHand().run(); USB::getSerial().printf("Requesting commands from egg...\r\n"); - wait_us(100000); - CommandHandle::getCommandHand().run(); - wait_us(100000); + if(count % 100 == 0){ + wait_us(100000); + CommandHandle::getCommandHand().run(); + wait_us(100000); + } if(GPSHandle::getGPSHand().if_image_location()){ USB::getSerial().printf("Taking picture and sending...\r\n"); wait_us(100000); @@ -147,10 +151,11 @@ USB::getSerial().printf("sent all data\r\n"); wait_us(100000); GPSHandle::getGPSHand().next_waypoint(); + wait_us(100000); }else{ USB::getSerial().printf("Not close enough to waypoint for image\r\n"); } - wait_us(1000000); + count++; //} // Run image handler
--- a/packet.h Wed Apr 23 04:09:06 2014 +0000 +++ b/packet.h Wed Apr 23 04:16:46 2014 +0000 @@ -96,15 +96,22 @@ } } - char rx_ready_with_timeout(Serial* serialDevice = NULL){ + char rx_ready_with_timeout(Serial* serialDevice = NULL, float seconds = 0, unsigned int u_seconds = 0){ if(serialDevice == NULL){ serialDevice = &outputDevice; } + if(seconds==0 && u_seconds==0){ + seconds = 3.0; + } if(serialDevice->readable()){ return 1; }else{ EvTimer t; - t.set_s_period(3.0); + if(seconds>0){ + t.set_s_period(seconds); + }else{ + t.set_us_period(u_seconds); + } t.start_timer(); while(t.get_num_trips() == 0){ if(serialDevice->readable()){