da
Dependencies: mbed TrapezoidControl QEI
Diff: System/Process/Process.cpp
- Revision:
- 6:10e22bc327ce
- Parent:
- 4:ba9df71868df
- Child:
- 7:e88c5d47a3be
diff -r ba9df71868df -r 10e22bc327ce System/Process/Process.cpp --- a/System/Process/Process.cpp Mon Oct 01 13:47:19 2018 +0000 +++ b/System/Process/Process.cpp Mon Oct 01 14:01:03 2018 +0000 @@ -626,96 +626,7 @@ #if USE_PROCESS_NUM>4 static void Process4() { - static bool color_flag = false; - static bool traceon = false;//fase1 - static bool yokofla = false;//fase2 - static bool boxslip = false;//fase3 - - static bool compA = false; - static bool compB = false; - static bool compC = false; - static bool compD = false; - - static bool invationA = false; - static bool invationB = false; - static bool invationC = false; - static bool invationD = false; - - ColorDetection(); - // - if(Color_A[0] > Point[0] && Color_A[1] > Point[1] && Color_A[2] > Point[2] && !compA)//白 - { - invationA ^= 1;//start false,over true - compA = true;//on true,noon false - } - else if(!(Color_A[0] > Point[0] && Color_A[1] > Point[1] && Color_A[2] > Point[2]))compA = false;//茶 - - if(Color_B[0] > Point[0] && Color_B[1] > Point[1] && Color_B[2] > Point[2] && !compB)//白 - { - invationB ^= 1;//start false,over true - compB = true;//on true,noon false - } - else if(!(Color_B[0] > Point[0] && Color_B[1] > Point[1] && Color_B[2] > Point[2]))compB = false;//茶 - - if(Color_C[0] > Point[0] && Color_C[1] > Point[1] && Color_C[2] > Point[2] && !compC)//白 - { - invationC ^= 1;//start false,over true - compC = true;//on true,noon false - } - else if(!(Color_C[0] > Point[0] && Color_C[1] > Point[1] && Color_C[2] > Point[2]))compC = false;//茶 - - if(Color_D[0] > Point[0] && Color_D[1] > Point[1] && Color_D[2] > Point[2] && !compD)//白 - { - invationD ^= 1;//start false,over true - compD = true;//on true,noon false - } - else if(!(Color_D[0] > Point[0] && Color_D[1] > Point[1] && Color_D[2] > Point[2]))compD = false;//茶 - - - // - - if(controller->Button.B && !color_flag) - { - traceon ^= 1; - color_flag = true; - } - else if(!controller->Button.B)color_flag = false; - - if(traceon) - { - if(compA && compD) - { - motor[TIRE_FR].dir = BACK; - motor[TIRE_FL].dir = BACK; - motor[TIRE_BR].dir = BACK; - motor[TIRE_BL].dir = BACK; - - motor[TIRE_FR].pwm = startP; - motor[TIRE_FL].pwm = startP; - motor[TIRE_BR].pwm = startP; - motor[TIRE_BL].pwm = startP; - } - else if(compB && compC) - { - motor[TIRE_FR].dir = FOR; - motor[TIRE_FL].dir = FOR; - motor[TIRE_BR].dir = FOR; - motor[TIRE_BL].dir = FOR; - - motor[TIRE_FR].pwm = startP; - motor[TIRE_FL].pwm = startP; - motor[TIRE_BR].pwm = startP; - motor[TIRE_BL].pwm = startP; - } - else - { - motor[TIRE_FR].dir = BRAKE; - motor[TIRE_FL].dir = BRAKE; - motor[TIRE_BR].dir = BRAKE; - motor[TIRE_BL].dir = BRAKE; - } - } } #endif @@ -793,6 +704,12 @@ } #pragma region USER-DEFINED-FUNCTIONS +void rotconpulex() + { + + } + + void ColorDetection(){ GATE = 0;