SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.

Dependencies:   TSI USBDevice mbed-dev

Fork of SmartWheels by haofan Zheng

Revision:
50:c387c88141fb
Parent:
48:f76b5e252444
Child:
54:f1f5648dfacf
diff -r f76b5e252444 -r c387c88141fb Hardwares/ArduCAM.cpp
--- a/Hardwares/ArduCAM.cpp	Wed Apr 05 21:35:47 2017 +0000
+++ b/Hardwares/ArduCAM.cpp	Thu Apr 06 18:22:02 2017 +0000
@@ -10,19 +10,17 @@
 
 #include <string>
 
-#define CAM_BLK_CAL_LEFT    75
-#define CAM_BLK_CAL_RIGHT   85
+#define CAM_BLK_CAL_LEFT    ((RESOLUTION_WIDTH / 2) - 2)
+#define CAM_BLK_CAL_RIGHT   ((RESOLUTION_WIDTH / 2) + 2)
 
 //#define CAM_DISP_DEBUG
 //#define CAM_DISP_DEBUG_CENTER
-#define CAM_DISP_IMG
+//#define CAM_DISP_IMG
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-extern SPI g_spi_port;
-
 static DigitalOut cam_cs(PIN_ACC_CS, 1);
 
 static uint8_t temp_mid_pos = RESOLUTION_WIDTH / 2;
@@ -321,6 +319,7 @@
         {
             ardu_utft_write_DATA(static_cast<uint8_t>(pixel >> 8), static_cast<uint8_t>(pixel));
         }
+        
 #elif defined(CAM_DISP_IMG)
         ardu_utft_write_DATA(static_cast<uint8_t>(pixel >> 8), static_cast<uint8_t>(pixel));
 #endif
@@ -371,8 +370,6 @@
     
     temp_mid_pos = RESOLUTION_WIDTH / 2;
     
-    uint8_t leftPos = 0;
-    uint8_t rightPos = 0;
     for (uint8_t i = 0; i < CAM_ROI_UPPER_LIMIT; ++i)
     {
         ardu_utft_set_camimg_row(CAM_ROI_UPPER_LIMIT - i);