File tree Expand file tree Collapse file tree 1 file changed +21
-12
lines changed Expand file tree Collapse file tree 1 file changed +21
-12
lines changed Original file line number Diff line number Diff line change 33
33
int bytesPerFrame;
34
34
int errors = 0 ;
35
35
int count = 0 ;
36
+ int bestTime = 100000 ;
37
+ int worstTime = 0 ;
38
+ int delayTime = 300 ;
39
+
40
+
36
41
long timer = 0 ;
37
42
Arduino_CRC32 crc32;
38
43
@@ -56,31 +61,35 @@ void setup() {
56
61
}
57
62
58
63
void loop () {
64
+
65
+ // sliding delay window to try different start times wrt camera VSYNC
66
+ if (delayTime>0 ) {delayTime=delayTime-10 ;}
67
+ delay (delayTime);
59
68
60
69
// benchmarking
61
70
timer = millis ();
62
71
Camera.readFrame (data);
63
72
timer = millis () - timer;
64
- Serial.print (timer);
65
- Serial.println (" ms " );
66
-
67
- // error checking
68
- if (error_checking) {
69
- uint32_t const crc32_res = crc32.calc (data, bytesPerFrame);
70
-
71
- Serial.print (" 0x" );
72
- Serial.print (crc32_res, HEX);
73
+ // Check if it is a best case or worse case time
74
+ bestTime = min (timer, bestTime);
75
+ worstTime = max (timer, worstTime);
73
76
74
77
// Test against known checksum values (minor pixel variations at the start but were visually confirmed to be a good test pattern)
78
+ uint32_t const crc32_res = crc32.calc (data, bytesPerFrame);
75
79
if (crc32_res != 0x15AB2939 && crc32_res != 0xD3EC95E && crc32_res != 0xB9C43ED9 ) {
76
80
errors++;
77
81
};
78
82
79
83
count++;
84
+
80
85
Serial.print (" errors:" );
81
86
Serial.print (errors);
82
87
Serial.print (" /" );
83
- Serial.println (count);
84
- }
85
-
88
+ Serial.print (count);
89
+ Serial.print (" best:" );
90
+ Serial.print (bestTime);
91
+ Serial.print (" ms worst:" );
92
+ Serial.print (worstTime);
93
+ Serial.println (" ms" );
94
+
86
95
}
You can’t perform that action at this time.
0 commit comments