Moved to Team 9.

Fork of LineScan by Nicholas Gan

Revision:
29:c832523d7d96
Parent:
28:3006d46dcec5
Child:
31:25cec6b92c59
--- a/LineScan.cpp	Thu May 21 20:27:53 2015 +0000
+++ b/LineScan.cpp	Thu May 21 23:22:50 2015 +0000
@@ -38,6 +38,7 @@
     int highest = 0;
     int lowest = 0;
     int total = 0;
+    int global_max_diff = 0; // mainly for debugging thresh. 
     int h_idx_ary[10];
     int h_idx_pos = 0;
     int l_idx_ary[10];
@@ -47,6 +48,7 @@
     int out_width = frameLen;
     int i;
     float out = -1.0;
+    extern telemetry::Numeric<uint32_t> max_diff; 
     
     //for AGC
     float exposureChange;
@@ -68,6 +70,10 @@
             
             total += avg[i];    //AGC
             
+            if (abs(diff[i]) > abs(global_max_diff)) {  // max diff finding for debug
+                global_max_diff = abs(diff[i]);
+            }
+            
             
             //Finite State Machine
             //problem in this section, rewrite? find peaks and troughs
@@ -117,6 +123,8 @@
                     return out;
             }
         }
+        
+        max_diff = global_max_diff;
         //AGC, simple proportional controller
         total = total / frameLen;
         exposureChange = ((float)(MEAN_REF - total)) * CAM_CTRL_GAIN;