Colin Stearns
/
qcControl
QC Control software
Fork of dgps by
Revision 50:030da136eacb, committed 2014-04-26
- Comitter:
- krobertson
- Date:
- Sat Apr 26 04:26:48 2014 +0000
- Parent:
- 48:dc9269ce9a79
- Parent:
- 49:06721139d298
- Child:
- 51:d6b64ac3c30d
- Commit message:
- pulling
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/handle/handleCompass.cpp Sat Apr 26 04:03:20 2014 +0000 +++ b/handle/handleCompass.cpp Sat Apr 26 04:26:48 2014 +0000 @@ -19,5 +19,5 @@ } compass.read(); heading = compass.get_heading(); - USB::getSerial().printf("Compass heading: %f\r\n",heading); + //USB::getSerial().printf("Compass heading: %f\r\n",heading); } \ No newline at end of file
--- a/handle/handleGPS.cpp Sat Apr 26 04:03:20 2014 +0000 +++ b/handle/handleGPS.cpp Sat Apr 26 04:26:48 2014 +0000 @@ -62,7 +62,7 @@ bool GPSHandle::if_image_location(){ double lon_thresh = 0.00005; double lat_thresh = 0.000035; - USB::getSerial().printf("Checking if at waypoint\r\n"); + //USB::getSerial().printf("Checking if at waypoint\r\n"); DataLocation current_loc = DH::Locs().getC(LHType_locs,DH::Locs().getI(LHType_locs)); DataLocation next_waypoint = DH::Locs().getC(LHType_targ,DH::Locs().getI(LHType_targ)); USB::getSerial().printf("current: %f,%f ... waypoint: %f,%f \r\n",current_loc.getLat(),current_loc.getLon(),next_waypoint.getLat(),next_waypoint.getLon());
--- a/main.cpp Sat Apr 26 04:03:20 2014 +0000 +++ b/main.cpp Sat Apr 26 04:26:48 2014 +0000 @@ -137,26 +137,26 @@ //Main Loop int count = 0; while(1){ - USB::getSerial().printf("Running GPS...\r\n"); + //USB::getSerial().printf("Running GPS...\r\n"); GPSHandle::getGPSHand().run(); - USB::getSerial().printf("Running Compass...\r\n"); + //USB::getSerial().printf("Running Compass...\r\n"); compassHandle::getCompassHand().run(); - USB::getSerial().printf("Requesting commands from egg...\r\n"); if(count % 100 == 0){ + USB::getSerial().printf("Requesting commands from egg...\r\n"); 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); - ImageHandle::getImageHand().run(); - 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"); + if(GPSHandle::getGPSHand().if_image_location()){ + USB::getSerial().printf("Taking picture and sending...\r\n"); + wait_us(100000); + ImageHandle::getImageHand().run(); + 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"); + } } count++; //}
--- a/packet.h Sat Apr 26 04:03:20 2014 +0000 +++ b/packet.h Sat Apr 26 04:26:48 2014 +0000 @@ -72,6 +72,7 @@ EvTimer t; t.set_s_period(30); t.start_timer(); + char con_status_steady; char timed_out = 0; do{ USB::getSerial().printf("trying to connect...\r\n"); @@ -81,18 +82,28 @@ wait_us(200000); } setTCPConStatus = 1; + con_status_steady = 1; wait_us(200000); + for(int i=0;i<10;i++){ + if(!getTCPConStatus){ + con_status_steady = 0; + break; + } + wait_us(1000); + } timed_out = t.get_num_trips(); - }while(!getTCPConStatus && !timed_out); + }while(!con_status_steady && !timed_out); t.stop_timer(); if(timed_out>0){ if(hover_attempt){ //emergency landing goes here USB::getSerial().printf("Second Attempt Connection failure. Emergency Landing.\r\n"); + wait_us(10000000); }else{ //hover and give it another shot USB::getSerial().printf("First Attempt Connection failure. Hover and retry.\r\n"); //hover code goes here + wait_us(10000000); openConnection(close_conn, 1); } } @@ -117,13 +128,13 @@ if(serialDevice == NULL){ serialDevice = &outputDevice; } - if(seconds==0 && u_seconds==0){ - seconds = 3.0; - } if(serialDevice->readable()){ return 1; }else{ EvTimer t; + if(seconds==0 && u_seconds==0){ + seconds = 3.0; + } if(seconds>0){ t.set_s_period(seconds); }else{ @@ -132,6 +143,7 @@ t.start_timer(); while(t.get_num_trips() == 0){ if(serialDevice->readable()){ + t.stop_timer(); return 1; } }