Moved to Team 9.

Fork of LineScan by Nicholas Gan

Files at this revision

API Documentation at this revision

Comitter:
ng3600
Date:
Mon Nov 23 23:57:58 2015 +0000
Parent:
38:1ac5f0ab5ae6
Commit message:
Bugfix, does not start right-to-left search at last element in array anymore. Start at last entry in array.

Changed in this revision

LineScan.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 1ac5f0ab5ae6 -r ea0660f7d724 LineScan.cpp
--- a/LineScan.cpp	Sat Nov 21 04:19:29 2015 +0000
+++ b/LineScan.cpp	Mon Nov 23 23:57:58 2015 +0000
@@ -135,8 +135,8 @@
     }
     
     if(preferLeftLine){
-        l_walker = l_idx_ary + IDX_ARY_LEN - 1;
-        h_walker = h_idx_ary + IDX_ARY_LEN - 1;
+        l_walker = l_idx_ary + l_idx_pos - 1;
+        h_walker = h_idx_ary + h_idx_pos - 1;
         
         while(*l_walker != -1 && *h_walker != -1){
             //evaluate out and advance if line is white on black and returns center of smallest white band
@@ -151,9 +151,6 @@
                 h_walker--;
             }
             l_walker--;
-            
-            //serial.printf("%d %d\r\n", *h_walker, *l_walker);
-            //serial.printf("%.2f\r\n", out);
         }
     } else {
         l_walker = l_idx_ary + 1;
@@ -172,9 +169,6 @@
                 l_walker++;
             }
             h_walker++;
-            
-            //serial.printf("%d %d\r\n", *h_walker, *l_walker);
-            //serial.printf("%.2f\r\n", out);
         }
     }