aa

Dependencies:   mbed

Revision:
47:a9cad8502999
Parent:
46:68296caae1af
Child:
48:5562a99479e5
--- a/System/Process/Process.cpp	Tue Nov 12 07:12:03 2019 +0000
+++ b/System/Process/Process.cpp	Tue Nov 12 08:22:43 2019 +0000
@@ -678,9 +678,9 @@
 
                 if(YELLOW) {
                     if(cross==1) {
-                        fast=30;
-                        normal=20;
-                        slow=20;
+                        fast=20;
+                        normal=15;
+                        slow=15;
                     } else if(cross==2) {
                         mode=21;
                         countss=0;
@@ -1159,9 +1159,6 @@
             if(DOLS==true||UPLS==true) {
                 motor[MOTOR_0].pwm = 200;
                 motor[MOTOR_0].dir = BRAKE;
-                fast=30;
-                normal=25;
-                slow=20;
                 mode=26;
             } else {
                 motor[MOTOR_0].pwm = 100;
@@ -1266,30 +1263,38 @@
         }
     } else {
         if(mode==21) {
-            motor[TIRE_FR].pwm = 0;
-            motor[TIRE_FR].dir = FREE;
+            motor[TIRE_FR].pwm = 255;
+            motor[TIRE_FR].dir = BRAKE;
             motor[TIRE_FL].pwm = 30;
             motor[TIRE_FL].dir = FOR;
             motor[TIRE_BR].pwm = 30;
             motor[TIRE_BR].dir = BACK;
-            motor[TIRE_BL].pwm = 0;
-            motor[TIRE_BL].dir = FREE;
+            motor[TIRE_BL].pwm = 255;
+            motor[TIRE_BL].dir = BRAKE;
             if(g[1]==0) {
                 mode=22;
                 fast=60;
                 normal=40;
-                slow=20;
+                slow=25;
             }
         } else if(mode==22) {
+            if(g[0]==98){
+                slow=25;
+                normal=30;
+                fast=40;
+            }
             if(g[3]==0) {
+                slow=25;
+                normal=40;
+                fast=40;
                 mode=23;
             }
             switch(g[0]) {
                 case 98:
                     solenoid.solenoid4 = SOLENOID_OFF;
-                    fast=30;
-                    normal=20;
-                    slow=20;
+                    fast=40;
+                    normal=30;
+                    slow=25;
                     motor[TIRE_FR].pwm = normal;
                     motor[TIRE_FR].dir = BACK;
                     motor[TIRE_FL].pwm = normal;
@@ -1411,14 +1416,6 @@
                 }
             }
         } else if(mode==23) {
-            motor[TIRE_FR].pwm = 100;
-            motor[TIRE_FR].dir = BRAKE;
-            motor[TIRE_FL].pwm = 100;
-            motor[TIRE_FL].dir = BRAKE;
-            motor[TIRE_BR].pwm = 100;
-            motor[TIRE_BR].dir = BRAKE;
-            motor[TIRE_BL].pwm = 100;
-            motor[TIRE_BL].dir = BRAKE;
             if(UPLS==true||DOLS==true) {
                 motor[MOTOR_0].pwm = 200;
                 motor[MOTOR_0].dir = BRAKE;
@@ -1431,7 +1428,14 @@
                 motor[MOTOR_0].pwm = 100;
                 motor[MOTOR_0].dir = BACK;
             }
-
+            motor[TIRE_FR].pwm = 100;
+            motor[TIRE_FR].dir = BRAKE;
+            motor[TIRE_FL].pwm = 100;
+            motor[TIRE_FL].dir = BRAKE;
+            motor[TIRE_BR].pwm = 100;
+            motor[TIRE_BR].dir = BRAKE;
+            motor[TIRE_BL].pwm = 100;
+            motor[TIRE_BL].dir = BRAKE;
         } else if(mode==24) {
             if(g[0]==98&&countss>=40000) {
                 mode=31;
@@ -1439,9 +1443,9 @@
             }
             switch(g[0]) {
                 case 98:
-                    fast=30;
-                    normal=20;
-                    slow=20;
+                    fast=40;
+                    normal=30;
+                    slow=25;
                     motor[TIRE_FR].pwm = normal;
                     motor[TIRE_FR].dir = BACK;
                     motor[TIRE_FL].pwm = normal;
@@ -1564,6 +1568,8 @@
             }
         }
     }
+    
+    /*
     if(mode==31) {
         motor[TIRE_FR].pwm = 0;
         motor[TIRE_FR].dir = FREE;
@@ -1591,16 +1597,32 @@
             countss=0;
             mode=40;
         }
+    } else 
+    */
+    if(mode==31) {
+        motor[TIRE_FR].pwm = 45;
+        motor[TIRE_FR].dir = BACK;
+        motor[TIRE_FL].pwm = 255;
+        motor[TIRE_FL].dir = BRAKE;
+        motor[TIRE_BR].pwm = 255;
+        motor[TIRE_BR].dir = BRAKE;
+        motor[TIRE_BL].pwm = 45;
+        motor[TIRE_BL].dir = FOR;
+        if(g[3]==0) {
+            cross=0;
+            countss=0;
+            mode=40;
+        }
     } else if(mode==40) {
         switch(g[3]) {
             case 98:
-                motor[TIRE_FR].pwm = normal;
+                motor[TIRE_FR].pwm = normal+15;
                 motor[TIRE_FR].dir = BACK;
-                motor[TIRE_FL].pwm = normal;
+                motor[TIRE_FL].pwm = normal+15;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = normal;
+                motor[TIRE_BR].pwm = normal+15;
                 motor[TIRE_BR].dir = FOR;
-                motor[TIRE_BL].pwm = normal;
+                motor[TIRE_BL].pwm = normal+15;
                 motor[TIRE_BL].dir = FOR;
                 if(countss>10000) {
                     cross++;
@@ -1614,33 +1636,33 @@
                 }
                 break;
             case 0:
-                motor[TIRE_FR].pwm = fast;
+                motor[TIRE_FR].pwm = fast+15;
                 motor[TIRE_FR].dir = BACK;
-                motor[TIRE_FL].pwm = fast;
+                motor[TIRE_FL].pwm = fast+15;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = fast;
+                motor[TIRE_BR].pwm = fast+15;
                 motor[TIRE_BR].dir = FOR;
-                motor[TIRE_BL].pwm = fast;
+                motor[TIRE_BL].pwm = fast+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc2=true;
                 break;
             case 255:
-                motor[TIRE_FR].pwm = slow;
+                motor[TIRE_FR].pwm = slow+15;
                 motor[TIRE_FR].dir = BACK;
-                motor[TIRE_FL].pwm = fast;
+                motor[TIRE_FL].pwm = fast+15;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = fast;
+                motor[TIRE_BR].pwm = fast+15;
                 motor[TIRE_BR].dir = FOR;
-                motor[TIRE_BL].pwm = slow;
+                motor[TIRE_BL].pwm = slow+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc2=true;
                 break;
             case 253:
                 motor[TIRE_FR].pwm = 0;
                 motor[TIRE_FR].dir = FREE;
-                motor[TIRE_FL].pwm = slow;
+                motor[TIRE_FL].pwm = slow+15;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = slow;
+                motor[TIRE_BR].pwm = slow+15;
                 motor[TIRE_BR].dir = FOR;
                 motor[TIRE_BL].pwm = 0;
                 motor[TIRE_BL].dir = FREE;
@@ -1649,44 +1671,44 @@
             case 254:
                 motor[TIRE_FR].pwm = 0;
                 motor[TIRE_FR].dir = FREE;
-                motor[TIRE_FL].pwm = normal;
+                motor[TIRE_FL].pwm = normal+15;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = normal;
+                motor[TIRE_BR].pwm = normal+15;
                 motor[TIRE_BR].dir = FOR;
                 motor[TIRE_BL].pwm = 0;
                 motor[TIRE_BL].dir = FREE;
                 mtc2=true;
                 break;
             case 1:
-                motor[TIRE_FR].pwm = fast;
+                motor[TIRE_FR].pwm = fast+15;
                 motor[TIRE_FR].dir = BACK;
-                motor[TIRE_FL].pwm = slow;
+                motor[TIRE_FL].pwm = slow+15;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = slow;
+                motor[TIRE_BR].pwm = slow+15;
                 motor[TIRE_BR].dir = FOR;
-                motor[TIRE_BL].pwm = fast;
+                motor[TIRE_BL].pwm = fast+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc2=true;
                 break;
             case 3:
-                motor[TIRE_FR].pwm = slow;
+                motor[TIRE_FR].pwm = slow+15;
                 motor[TIRE_FR].dir = BACK;
                 motor[TIRE_FL].pwm = 0;
                 motor[TIRE_FL].dir = FREE;
                 motor[TIRE_BR].pwm = 0;
                 motor[TIRE_BR].dir = FREE;
-                motor[TIRE_BL].pwm = slow;
+                motor[TIRE_BL].pwm = slow+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc2=true;
                 break;
             case 2:
-                motor[TIRE_FR].pwm = normal;
+                motor[TIRE_FR].pwm = normal+15;
                 motor[TIRE_FR].dir = BACK;
                 motor[TIRE_FL].pwm = 0;
                 motor[TIRE_FL].dir = FREE;
                 motor[TIRE_BR].pwm = 0;
                 motor[TIRE_BR].dir = FREE;
-                motor[TIRE_BL].pwm = normal;
+                motor[TIRE_BL].pwm = normal+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc2=true;
                 break;
@@ -1744,13 +1766,13 @@
             slow=40;
         }
     } else if(mode==42) {
-        motor[TIRE_FR].pwm = 20;
+        motor[TIRE_FR].pwm = 40;
         motor[TIRE_FR].dir = FOR;
         motor[TIRE_FL].pwm = 0;
         motor[TIRE_FL].dir = FREE;
         motor[TIRE_BR].pwm = 0;
         motor[TIRE_BR].dir = FREE;
-        motor[TIRE_BL].pwm = 20;
+        motor[TIRE_BL].pwm = 40;
         motor[TIRE_BL].dir = BACK;
         if(g[1]==0) {
             countss=0;
@@ -1885,13 +1907,13 @@
             }
         }
     } else if(mode==100) {
-        motor[TIRE_FR].pwm = 40;
+        motor[TIRE_FR].pwm = 50;
         motor[TIRE_FR].dir = BACK;
-        motor[TIRE_FL].pwm = 40;
+        motor[TIRE_FL].pwm = 50;
         motor[TIRE_FL].dir = FOR;
-        motor[TIRE_BR].pwm = 43;
+        motor[TIRE_BR].pwm = 50;
         motor[TIRE_BR].dir = BACK;
-        motor[TIRE_BL].pwm = 40;
+        motor[TIRE_BL].pwm = 50;
         motor[TIRE_BL].dir = FOR;
     } else {
     }
@@ -2462,21 +2484,10 @@
                     motor[TIRE_BL].dir = BACK;
                     break;
             }
-            if(DOLS==true||UPLS==true) {
-                motor[MOTOR_0].pwm = 200;
-                motor[MOTOR_0].dir = BRAKE;
-            }
             if(g[1]==98) {
                 fast=20;
                 normal=15;
                 slow=10;
-                if(DOLS==true||UPLS==true) {
-                    motor[MOTOR_0].pwm = 200;
-                    motor[MOTOR_0].dir = BRAKE;
-                } else {
-                    motor[MOTOR_0].pwm = 100;
-                    motor[MOTOR_0].dir = BACK;
-                }
             }
             if(g[3]==254&&countss>=100000) {
                 mode=24;
@@ -2487,13 +2498,6 @@
                 slow=20;
             }
         } else if(mode==24) {
-            if(DOLS==true||UPLS==true) {
-                motor[MOTOR_0].pwm = 200;
-                motor[MOTOR_0].dir = BRAKE;
-            } else {
-                motor[MOTOR_0].pwm = 100;
-                motor[MOTOR_0].dir = BACK;
-            }
             if(g[4]==3||g[4]==2) {
                 motor[TIRE_FR].pwm = 30;
                 motor[TIRE_FR].dir = FOR;
@@ -2605,7 +2609,14 @@
                 mode=25;
             }
         } else if(mode==25) {
-
+            motor[TIRE_FR].pwm = 100;
+            motor[TIRE_FR].dir = BRAKE;
+            motor[TIRE_FL].pwm = 100;
+            motor[TIRE_FL].dir = BRAKE;
+            motor[TIRE_BR].pwm = 100;
+            motor[TIRE_BR].dir = BRAKE;
+            motor[TIRE_BL].pwm = 100;
+            motor[TIRE_BL].dir = BRAKE;
             if(UPLS==true||DOLS==true) {
                 motor[MOTOR_0].pwm = 200;
                 motor[MOTOR_0].dir = BRAKE;