Moved to Team 9.
Fork of LineScan by
Diff: LineScan.cpp
- Revision:
- 27:173b2f564143
- Parent:
- 26:5e70edee216d
--- a/LineScan.cpp Tue Apr 28 01:05:47 2015 +0000 +++ b/LineScan.cpp Thu May 21 06:54:06 2015 +0000 @@ -1,7 +1,7 @@ #include "LineScan.h" #include <string.h> -#define THRESH 4000 +#define THRESH 1000 #define MEAN_REF 10000 //ideal mean we should see #define CAM_CTRL_GAIN 0.002 //should be small @@ -62,7 +62,7 @@ l_idx_ary[0] = -1; if(array) { - avg[0] = array[SKIP - 1]/2 + array[SKIP]/2; + avg[0] = array[SKIP - 1]/2 + array[SKIP]/2; // To cut off the (invalid) ends of the data. diff[0] = 0; tele_linescan_diff[0] = diff[0]; @@ -288,7 +288,7 @@ } //AGC, simple proportional controller total = total / frameLen; - exposureChange = ((float)(MEAN_REF - total)) * CAM_CTRL_GAIN; + exposureChange = ((float)(MEAN_REF - total)) * CAM_CTRL_GAIN; // This is actually I control. *exposure += (int)exposureChange; if(*exposure < 0) *exposure = 0; @@ -347,10 +347,12 @@ return position; } + + float getLinePos2(AnalogIn cam, DigitalOut *camSi, DigitalOut *camClk, - int *exposure) + int *exposure) // Doesn't send telem. { uint16_t lineAry[NUM_PIX]; float position; @@ -362,7 +364,7 @@ } //process line scan data - position = processFn2(lineAry, NUM_PIX, exposure);//, tele_linescan_diff); + position = processFn2(lineAry, NUM_PIX, exposure); return position; }