QC Control software

Dependencies:   mbed

Fork of dgps by Colin Stearns

Files at this revision

API Documentation at this revision

Comitter:
krobertson
Date:
Sat Apr 26 04:14:18 2014 +0000
Parent:
46:f89fc45811a1
Child:
50:030da136eacb
Commit message:
minor changes involving output for debugging. I need to pull and this software screws up when I do

Changed in this revision

handle/handleCompass.cpp Show annotated file Show diff for this revision Revisions of this file
handle/handleGPS.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
packet.h Show annotated file Show diff for this revision Revisions of this file
--- a/handle/handleCompass.cpp	Fri Apr 25 23:50:51 2014 +0000
+++ b/handle/handleCompass.cpp	Sat Apr 26 04:14:18 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	Fri Apr 25 23:50:51 2014 +0000
+++ b/handle/handleGPS.cpp	Sat Apr 26 04:14:18 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	Fri Apr 25 23:50:51 2014 +0000
+++ b/main.cpp	Sat Apr 26 04:14:18 2014 +0000
@@ -137,12 +137,12 @@
     //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);
--- a/packet.h	Fri Apr 25 23:50:51 2014 +0000
+++ b/packet.h	Sat Apr 26 04:14:18 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;
                 }
             }