aa

Dependencies:   mbed

Revision:
46:68296caae1af
Parent:
45:0cf48a0605cd
Child:
47:a9cad8502999
--- a/System/Process/Process.cpp	Mon Nov 11 08:11:29 2019 +0000
+++ b/System/Process/Process.cpp	Tue Nov 12 07:12:03 2019 +0000
@@ -94,7 +94,7 @@
 
 int fast = 60;
 int normal = 40;
-int slow = 20;
+int slow = 25;
 
 #pragma endregion USER-DEFINED_VARIABLES_AND_PROTOTYPE
 
@@ -214,7 +214,7 @@
 
     while(1) {
         //pc.printf("4:%d\n\r",g[4]);
-        
+
         if(EMC==0) {
             fast=40;
             normal=30;
@@ -488,8 +488,7 @@
             cross=0;
             mode=3;
         }
-    } 
-    else if(mode==3) { //横ライントレースから縦ライントレースへ
+    } else if(mode==3) { //横ライントレースから縦ライントレースへ
         motor[TIRE_FR].pwm = 30;
         motor[TIRE_FR].dir = FOR;
         motor[TIRE_FL].pwm = 255;
@@ -502,8 +501,7 @@
             mode=10;
             countss=100000;
         }
-    } 
-    else if(mode==10) { //縦ライントレース
+    } else if(mode==10) { //縦ライントレース
         switch(g[1]) {
             case 98:
                 motor[TIRE_FR].pwm = normal+50;
@@ -519,13 +517,13 @@
                     cross++;
                     countss=0;
                 }
-                
-                if(cross==2){
-                    fast = 10;  
-                    normal = 10; 
+
+                if(cross==2) {
+                    fast = 10;
+                    normal = 10;
                     slow = 5;
                 }
-                
+
                 if(cross==3) {
                     fast=40;
                     normal=30;
@@ -660,8 +658,7 @@
             cross=0;
             mode=20;
         }
-    } 
-    else if(mode==20) {
+    } else if(mode==20) {
         solenoid.solenoid4= SOLENOID_ON;
         switch(g[2]) {
             case 98:
@@ -678,14 +675,13 @@
                     countss=0;
                 }
                 mtc2=true;
-                
+
                 if(YELLOW) {
                     if(cross==1) {
-                    fast=30;
-                    normal=20;
-                    slow=20;
-                    }
-                    else if(cross==2) {
+                        fast=30;
+                        normal=20;
+                        slow=20;
+                    } else if(cross==2) {
                         mode=21;
                         countss=0;
                         cross=0;
@@ -827,8 +823,7 @@
                 normal=40;
                 slow=20;
             }
-        } 
-        else if(mode==22) {
+        } else if(mode==22) {
             if(g[4]==3||g[4]==2) {
                 motor[TIRE_FR].pwm = 30;
                 motor[TIRE_FR].dir = FOR;
@@ -940,8 +935,7 @@
                 mode=23;
                 countss=0;
             }
-        } 
-        else if(mode==23) {
+        } else if(mode==23) {
             switch(g[4]) {
                 case 98:
                     motor[TIRE_FR].pwm = fast-5;
@@ -1034,22 +1028,6 @@
                     motor[TIRE_BL].dir = FOR;
                     break;
             }
-            if(DOLS==true||UPLS==true) {
-                motor[MOTOR_0].pwm = 200;
-                motor[MOTOR_0].dir = BRAKE;
-            }
-            if(g[0]==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[2]==254&&countss>=100000) {
                 mode=24;
                 solenoid.solenoid4 = SOLENOID_OFF;
@@ -1058,15 +1036,7 @@
                 normal=40;
                 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;
-            }
+        } else if(mode==24) {
             if(g[4]==3||g[4]==2) {
                 motor[TIRE_FR].pwm = 30;
                 motor[TIRE_FR].dir = FOR;
@@ -1175,17 +1145,29 @@
                     break;
             }
             if(g[3]==0&&g[2]==0) {
-                if(UPLS==true||DOLS==true) {
-                    motor[MOTOR_0].pwm = 200;
-                    motor[MOTOR_0].dir = BRAKE;
-                    mode=25;
-                } else {
-                    motor[MOTOR_0].pwm = 100;
-                    motor[MOTOR_0].dir = BACK;
-                }
+                mode=25;
             }
-        } 
-        else if(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(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;
+                motor[MOTOR_0].dir = BACK;
+            }
+        } else if(mode==26) {
             switch(g[4]) {
                 case 98:
                     motor[TIRE_FR].pwm = 60;
@@ -1282,8 +1264,7 @@
                 mode=31;
             }
         }
-    } 
-    else {
+    } else {
         if(mode==21) {
             motor[TIRE_FR].pwm = 0;
             motor[TIRE_FR].dir = FREE;
@@ -1430,6 +1411,14 @@
                 }
             }
         } 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;
@@ -1441,14 +1430,6 @@
             } else {
                 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) {
@@ -1941,8 +1922,7 @@
             cross=0;
             mode=3;
         }
-    } 
-    else if(mode==3) { //横ライントレースから縦ライントレースへ
+    } else if(mode==3) { //横ライントレースから縦ライントレースへ
         motor[TIRE_FR].pwm = 255;
         motor[TIRE_FR].dir = BRAKE;
         motor[TIRE_FL].pwm = 30;
@@ -1955,8 +1935,7 @@
             mode=10;
             countss=100000;
         }
-    } 
-    else if(mode==10) { //縦ライントレース
+    } else if(mode==10) { //縦ライントレース
         switch(g[0]) {
             case 98:
                 motor[TIRE_FR].pwm = normal+50;
@@ -1972,12 +1951,12 @@
                     cross++;
                     countss=0;
                 }
-                if(cross==2){
-                    fast = 10;  
-                    normal = 10; 
+                if(cross==2) {
+                    fast = 10;
+                    normal = 10;
                     slow = 5;
-                }    
-                
+                }
+
                 if(cross==3) {
                     fast=40;
                     normal=30;
@@ -1985,7 +1964,7 @@
                     mode=11;
                     countss=0;
                     cross=0;
-                    
+
                 }
                 break;
             case 0:
@@ -2099,8 +2078,7 @@
                     break;
             }
         }
-    } 
-    else if(mode==11) {
+    } else if(mode==11) {
         motor[TIRE_FR].pwm = 25;
         motor[TIRE_FR].dir = FOR;
         motor[TIRE_FL].pwm = normal;
@@ -2114,8 +2092,7 @@
             cross=0;
             mode=20;
         }
-    } 
-    else if(mode==20) {
+    } else if(mode==20) {
         solenoid.solenoid4= SOLENOID_ON;
         switch(g[2]) {
             case 98:
@@ -2132,14 +2109,13 @@
                     countss=0;
                 }
                 mtc2=true;
-                
+
                 if(YELLOW) {
                     if(cross==1) {
-                    fast=30;
-                    normal=20;
-                    slow=20;
-                    }
-                    else if(cross==2) {
+                        fast=20;
+                        normal=15;
+                        slow=15;
+                    } else if(cross==2) {
                         mode=21;
                         countss=0;
                         cross=0;
@@ -2281,8 +2257,7 @@
                 normal=40;
                 slow=20;
             }
-        } 
-        else if(mode==22) {
+        } else if(mode==22) {
             if(g[4]==3||g[4]==2) {
                 motor[TIRE_FR].pwm = 30;
                 motor[TIRE_FR].dir = FOR;
@@ -2394,8 +2369,7 @@
                 mode=23;
                 countss=0;
             }
-        } 
-        else if(mode==23) {
+        } else if(mode==23) {
             switch(g[4]) {
                 case 98:
                     motor[TIRE_FR].pwm = fast-5;
@@ -2438,23 +2412,23 @@
                     motor[TIRE_BL].dir = FREE;
                     break;
                 case 253:
-                    motor[TIRE_FR].pwm = slow-5;
+                    motor[TIRE_FR].pwm = slow+5;
                     motor[TIRE_FR].dir = FOR;
                     motor[TIRE_FL].pwm = fast-5;
                     motor[TIRE_FL].dir = BACK;
                     motor[TIRE_BR].pwm = fast-5;
                     motor[TIRE_BR].dir = FOR;
-                    motor[TIRE_BL].pwm = slow-5;
+                    motor[TIRE_BL].pwm = slow+5;
                     motor[TIRE_BL].dir = BACK;
                     break;
                 case 254:
-                    motor[TIRE_FR].pwm = normal-5;
+                    motor[TIRE_FR].pwm = normal+5;
                     motor[TIRE_FR].dir = FOR;
                     motor[TIRE_FL].pwm = fast-5;
                     motor[TIRE_FL].dir = BACK;
                     motor[TIRE_BR].pwm = fast-5;
                     motor[TIRE_BR].dir = FOR;
-                    motor[TIRE_BL].pwm = normal-5;
+                    motor[TIRE_BL].pwm = normal+5;
                     motor[TIRE_BL].dir = BACK;
                     break;
                 case 1:
@@ -2470,9 +2444,9 @@
                 case 3:
                     motor[TIRE_FR].pwm = fast-5;
                     motor[TIRE_FR].dir = FOR;
-                    motor[TIRE_FL].pwm = slow-5;
+                    motor[TIRE_FL].pwm = slow+5;
                     motor[TIRE_FL].dir = BACK;
-                    motor[TIRE_BR].pwm = slow-5;
+                    motor[TIRE_BR].pwm = slow+5;
                     motor[TIRE_BR].dir = FOR;
                     motor[TIRE_BL].pwm = fast-5;
                     motor[TIRE_BL].dir = BACK;
@@ -2480,9 +2454,9 @@
                 case 2:
                     motor[TIRE_FR].pwm = fast-5;
                     motor[TIRE_FR].dir = FOR;
-                    motor[TIRE_FL].pwm = normal-5;
+                    motor[TIRE_FL].pwm = normal+5;
                     motor[TIRE_FL].dir = BACK;
-                    motor[TIRE_BR].pwm = normal-5;
+                    motor[TIRE_BR].pwm = normal+5;
                     motor[TIRE_BR].dir = FOR;
                     motor[TIRE_BL].pwm = fast-5;
                     motor[TIRE_BL].dir = BACK;
@@ -2512,13 +2486,11 @@
                 normal=40;
                 slow=20;
             }
-        } 
-        else if(mode==24) {
+        } else if(mode==24) {
             if(DOLS==true||UPLS==true) {
                 motor[MOTOR_0].pwm = 200;
                 motor[MOTOR_0].dir = BRAKE;
-            } 
-            else {
+            } else {
                 motor[MOTOR_0].pwm = 100;
                 motor[MOTOR_0].dir = BACK;
             }
@@ -2544,21 +2516,21 @@
             }
             switch(g[2]) {
                 case 0:
-                    motor[TIRE_FR].pwm = 20;
+                    motor[TIRE_FR].pwm = 25;
                     motor[TIRE_FR].dir = FREE;
-                    motor[TIRE_BR].pwm = 20;
+                    motor[TIRE_BR].pwm = 25;
                     motor[TIRE_BR].dir = FREE;
                     break;
                 case 255:
                     motor[TIRE_FR].pwm = 30;
                     motor[TIRE_FR].dir = BACK;
-                    motor[TIRE_BR].pwm = 20;
+                    motor[TIRE_BR].pwm = 25;
                     motor[TIRE_BR].dir = FREE;
                     break;
                 case 253:
                     motor[TIRE_FR].pwm = 40;
                     motor[TIRE_FR].dir = BACK;
-                    motor[TIRE_BR].pwm = 20;
+                    motor[TIRE_BR].pwm = 25;
                     motor[TIRE_BR].dir = FREE;
                     break;
                 case 254:
@@ -2568,13 +2540,13 @@
                     motor[TIRE_BR].dir = BACK;
                     break;
                 case 1:
-                    motor[TIRE_FR].pwm = 20;
+                    motor[TIRE_FR].pwm = 25;
                     motor[TIRE_FR].dir = FREE;
                     motor[TIRE_BR].pwm = 30;
                     motor[TIRE_BR].dir = FOR;
                     break;
                 case 3:
-                    motor[TIRE_FR].pwm = 20;
+                    motor[TIRE_FR].pwm = 25;
                     motor[TIRE_FR].dir = FREE;
                     motor[TIRE_BR].pwm = 40;
                     motor[TIRE_BR].dir = FOR;
@@ -2588,18 +2560,18 @@
             }
             switch(g[3]) {
                 case 0:
-                    motor[TIRE_FL].pwm = 20;
+                    motor[TIRE_FL].pwm = 25;
                     motor[TIRE_FL].dir = FREE;
-                    motor[TIRE_BL].pwm = 20;
+                    motor[TIRE_BL].pwm = 25;
                     motor[TIRE_BL].dir = FREE;
                     break;
                 case 255:
-                    motor[TIRE_FL].pwm = 20;
+                    motor[TIRE_FL].pwm = 25;
                     motor[TIRE_FL].dir = FREE;
                     motor[TIRE_BL].pwm = 30;
                     motor[TIRE_BL].dir = BACK;
                 case 253:
-                    motor[TIRE_FL].pwm = 20;
+                    motor[TIRE_FL].pwm = 25;
                     motor[TIRE_FL].dir = FREE;
                     motor[TIRE_BL].pwm = 40;
                     motor[TIRE_BL].dir = BACK;
@@ -2613,13 +2585,13 @@
                 case 1:
                     motor[TIRE_FL].pwm = 30;
                     motor[TIRE_FL].dir = FOR;
-                    motor[TIRE_BL].pwm = 20;
+                    motor[TIRE_BL].pwm = 25;
                     motor[TIRE_BL].dir = FREE;
                     break;
                 case 3:
                     motor[TIRE_FL].pwm = 40;
                     motor[TIRE_FL].dir = FOR;
-                    motor[TIRE_BL].pwm = 20;
+                    motor[TIRE_BL].pwm = 25;
                     motor[TIRE_BL].dir = FREE;
                     break;
                 case 2:
@@ -2630,17 +2602,19 @@
                     break;
             }
             if(g[3]==0&&g[2]==0) {
-                if(UPLS==true||DOLS==true) {
-                    motor[MOTOR_0].pwm = 200;
-                    motor[MOTOR_0].dir = BRAKE;
-                    mode=25;
-                } else {
-                    motor[MOTOR_0].pwm = 100;
-                    motor[MOTOR_0].dir = BACK;
-                }
+                mode=25;
             }
-        } 
-        else if(mode==25) {
+        } else if(mode==25) {
+
+            if(UPLS==true||DOLS==true) {
+                motor[MOTOR_0].pwm = 200;
+                motor[MOTOR_0].dir = BRAKE;
+                mode=26;
+            } else {
+                motor[MOTOR_0].pwm = 100;
+                motor[MOTOR_0].dir = BACK;
+            }
+        } else if(mode==26) {
             switch(g[4]) {
                 case 98:
                     motor[TIRE_FR].pwm = 60;
@@ -2683,13 +2657,13 @@
                     motor[TIRE_BL].dir = FREE;
                     break;
                 case 253:
-                    motor[TIRE_FR].pwm = 20;
+                    motor[TIRE_FR].pwm = 25;
                     motor[TIRE_FR].dir = FOR;
                     motor[TIRE_FL].pwm = 60;
                     motor[TIRE_FL].dir = BACK;
                     motor[TIRE_BR].pwm = 60;
                     motor[TIRE_BR].dir = FOR;
-                    motor[TIRE_BL].pwm = 20;
+                    motor[TIRE_BL].pwm = 25;
                     motor[TIRE_BL].dir = BACK;
                     break;
                 case 254:
@@ -2715,9 +2689,9 @@
                 case 3:
                     motor[TIRE_FR].pwm = 60;
                     motor[TIRE_FR].dir = FOR;
-                    motor[TIRE_FL].pwm = 20;
+                    motor[TIRE_FL].pwm = 25;
                     motor[TIRE_FL].dir = BACK;
-                    motor[TIRE_BR].pwm = 20;
+                    motor[TIRE_BR].pwm = 25;
                     motor[TIRE_BR].dir = FOR;
                     motor[TIRE_BL].pwm = 60;
                     motor[TIRE_BL].dir = BACK;
@@ -2737,8 +2711,7 @@
                 mode=31;
             }
         }
-    } 
-    else {
+    } else {
         if(mode==21) {
             motor[TIRE_FR].pwm = 30;
             motor[TIRE_FR].dir = FOR;
@@ -2752,27 +2725,26 @@
                 mode=22;
                 fast=60;
                 normal=40;
-                slow=20;
+                slow=25;
             }
-        } 
-        else if(mode==22) {
+        } else if(mode==22) {
             if(g[1]==98) {
-                slow=20;
+                slow=25;
                 normal=30;
                 fast=40;
             }
-            if(g[3]==0){
-                slow=20;
+            if(g[3]==0) {
+                slow=25;
                 normal=40;
                 fast=60;
                 mode=23;
-                }
+            }
             switch(g[1]) {
                 case 98:
                     solenoid.solenoid4 = SOLENOID_OFF;
                     fast=40;
                     normal=30;
-                    slow=20;
+                    slow=25;
                     motor[TIRE_FR].pwm = normal;
                     motor[TIRE_FR].dir = FOR;
                     motor[TIRE_FL].pwm = normal;
@@ -2893,18 +2865,18 @@
                         break;
                 }
             }
-        }
-        else if(mode==23) {
-            if(UPLS==true||DOLS==true) {
-                motor[MOTOR_0].pwm = 200;
-                motor[MOTOR_0].dir = BRAKE;
-                fast=60;
-                normal=40;
-                slow=20;
-                countss=0;
-                mode=24;
-            } 
-            else {
+        } else if(mode==23) {
+            if(UPLS||DOLS) {
+                if(UPLS||DOLS) {
+                    motor[MOTOR_0].pwm = 200;
+                    motor[MOTOR_0].dir = BRAKE;
+                    fast=60;
+                    normal=40;
+                    slow=25;
+                    countss=0;
+                    mode=24;
+                }
+            } else {
                 motor[MOTOR_0].pwm = 100;
                 motor[MOTOR_0].dir = BACK;
             }
@@ -2916,8 +2888,7 @@
             motor[TIRE_BR].dir = BRAKE;
             motor[TIRE_BL].pwm = 100;
             motor[TIRE_BL].dir = BRAKE;
-        } 
-        else if(mode==24) {
+        } else if(mode==24) {
             if(g[1]==98&&countss>=40000) {
                 mode=31;
                 countss=0;
@@ -2926,7 +2897,7 @@
                 case 98:
                     fast=40;
                     normal=30;
-                    slow=20;
+                    slow=25;
                     motor[TIRE_FR].pwm = normal;
                     motor[TIRE_FR].dir = FOR;
                     motor[TIRE_FL].pwm = normal;
@@ -3049,7 +3020,7 @@
             }
         }
     }
-    
+
     /*
     if(mode==31) {
         motor[TIRE_FR].pwm = 0;
@@ -3077,7 +3048,7 @@
             mode=33;
             countss=0;
         }
-    } 
+    }
     */
     if(mode==31) {
         motor[TIRE_FR].pwm = 255;
@@ -3093,17 +3064,16 @@
             countss=0;
             mode=40;
         }
-    } 
-    else if(mode==40) {
+    } else if(mode==40) {
         switch(g[3]) {
             case 98:
-                motor[TIRE_FR].pwm = normal+30;
+                motor[TIRE_FR].pwm = normal+15;
                 motor[TIRE_FR].dir = BACK;
-                motor[TIRE_FL].pwm = normal+30;
+                motor[TIRE_FL].pwm = normal+15;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = normal+30;
+                motor[TIRE_BR].pwm = normal+15;
                 motor[TIRE_BR].dir = FOR;
-                motor[TIRE_BL].pwm = normal+30;
+                motor[TIRE_BL].pwm = normal+15;
                 motor[TIRE_BL].dir = FOR;
                 if(countss>30000) {
                     cross++;
@@ -3112,33 +3082,33 @@
                 mtc2=true;
                 break;
             case 0:
-                motor[TIRE_FR].pwm = fast+30;
+                motor[TIRE_FR].pwm = fast+15;
                 motor[TIRE_FR].dir = BACK;
-                motor[TIRE_FL].pwm = fast+30;
+                motor[TIRE_FL].pwm = fast+15;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = fast+30;
+                motor[TIRE_BR].pwm = fast+15;
                 motor[TIRE_BR].dir = FOR;
-                motor[TIRE_BL].pwm = fast+30;
+                motor[TIRE_BL].pwm = fast+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc2=true;
                 break;
             case 255:
-                motor[TIRE_FR].pwm = slow+30;
+                motor[TIRE_FR].pwm = slow+15;
                 motor[TIRE_FR].dir = BACK;
-                motor[TIRE_FL].pwm = fast+30;
+                motor[TIRE_FL].pwm = fast+15;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = fast+30;
+                motor[TIRE_BR].pwm = fast+15;
                 motor[TIRE_BR].dir = FOR;
-                motor[TIRE_BL].pwm = slow+30;
+                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+30;
+                motor[TIRE_FL].pwm = slow+15;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = slow+30;
+                motor[TIRE_BR].pwm = slow+15;
                 motor[TIRE_BR].dir = FOR;
                 motor[TIRE_BL].pwm = 0;
                 motor[TIRE_BL].dir = FREE;
@@ -3147,44 +3117,44 @@
             case 254:
                 motor[TIRE_FR].pwm = 0;
                 motor[TIRE_FR].dir = FREE;
-                motor[TIRE_FL].pwm = normal+30;
+                motor[TIRE_FL].pwm = normal+15;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = normal+30;
+                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+30;
+                motor[TIRE_FR].pwm = fast+15;
                 motor[TIRE_FR].dir = BACK;
-                motor[TIRE_FL].pwm = slow+30;
+                motor[TIRE_FL].pwm = slow+15;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = slow+30;
+                motor[TIRE_BR].pwm = slow+15;
                 motor[TIRE_BR].dir = FOR;
-                motor[TIRE_BL].pwm = fast+30;
+                motor[TIRE_BL].pwm = fast+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc2=true;
                 break;
             case 3:
-                motor[TIRE_FR].pwm = slow+30;
+                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+30;
+                motor[TIRE_BL].pwm = slow+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc2=true;
                 break;
             case 2:
-                motor[TIRE_FR].pwm = normal+30;
+                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+30;
+                motor[TIRE_BL].pwm = normal+15;
                 motor[TIRE_BL].dir = FOR;
                 mtc2=true;
                 break;
@@ -3222,24 +3192,25 @@
                     break;
             }
         }
-        
+
         if(YELLOW) {
             if(cross==1) {
                 mode=41;
                 countss=0;
                 cross=0;
             }
-        } 
-        else {
+        } else {
             if(cross==3) {
                 mode=41;
                 countss=0;
                 cross=0;
             }
         }
-        
-    } 
-    else if(mode==41) {
+        if(LIF||LIB) {
+            mode=42;
+        }
+
+    } else if(mode==41) {
         if(LIF||LIB) {
             mode=42;
         }
@@ -3258,8 +3229,7 @@
             fast=100;
             slow=60;
         }
-    } 
-    else if(mode==42) {
+    } else if(mode==42) {
         motor[TIRE_FR].pwm = 40;
         motor[TIRE_FR].dir = FOR;
         motor[TIRE_FL].pwm = 0;
@@ -3272,8 +3242,7 @@
             countss=0;
             mode=70;
         }
-    } 
-    else if(mode==70) {
+    } else if(mode==70) {
         switch(g[1]) {
             case 99:
                 if(countss>=100000) {
@@ -3285,7 +3254,7 @@
                 motor[TIRE_FR].dir = FOR;
                 motor[TIRE_FL].pwm = normal;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = normal;
+                motor[TIRE_BR].pwm = normal+5;
                 motor[TIRE_BR].dir = FOR;
                 motor[TIRE_BL].pwm = normal;
                 motor[TIRE_BL].dir = BACK;
@@ -3295,7 +3264,7 @@
                 motor[TIRE_FR].dir = FOR;
                 motor[TIRE_FL].pwm = 100;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = 100;
+                motor[TIRE_BR].pwm = 105;
                 motor[TIRE_BR].dir = FOR;
                 motor[TIRE_BL].pwm = 100;
                 motor[TIRE_BL].dir = BACK;
@@ -3306,7 +3275,7 @@
                 motor[TIRE_FR].dir = FOR;
                 motor[TIRE_FL].pwm = slow;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = slow;
+                motor[TIRE_BR].pwm = slow+5;
                 motor[TIRE_BR].dir = FOR;
                 motor[TIRE_BL].pwm = fast;
                 motor[TIRE_BL].dir = BACK;
@@ -3339,7 +3308,7 @@
                 motor[TIRE_FR].dir = FOR;
                 motor[TIRE_FL].pwm = fast;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = fast;
+                motor[TIRE_BR].pwm = fast+5;
                 motor[TIRE_BR].dir = FOR;
                 motor[TIRE_BL].pwm = slow;
                 motor[TIRE_BL].dir = BACK;
@@ -3350,7 +3319,7 @@
                 motor[TIRE_FR].dir = FREE;
                 motor[TIRE_FL].pwm = slow;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = slow;
+                motor[TIRE_BR].pwm = slow+5;
                 motor[TIRE_BR].dir = FOR;
                 motor[TIRE_BL].pwm = 0;
                 motor[TIRE_BL].dir = FREE;
@@ -3361,7 +3330,7 @@
                 motor[TIRE_FR].dir = FREE;
                 motor[TIRE_FL].pwm = normal;
                 motor[TIRE_FL].dir = BACK;
-                motor[TIRE_BR].pwm = normal;
+                motor[TIRE_BR].pwm = normal+5;
                 motor[TIRE_BR].dir = FOR;
                 motor[TIRE_BL].pwm = 0;
                 motor[TIRE_BL].dir = FREE;
@@ -3401,18 +3370,17 @@
                     break;
             }
         }
-    } 
-    else if(mode==100) {
+    } else if(mode==100) {
         motor[TIRE_FR].pwm = 50;
         motor[TIRE_FR].dir = FOR;
-        motor[TIRE_FL].pwm = 50;
+        motor[TIRE_FL].pwm = 55;
         motor[TIRE_FL].dir = BACK;
-        motor[TIRE_BR].pwm = 50;
+        motor[TIRE_BR].pwm = 60;
         motor[TIRE_BR].dir = FOR;
         motor[TIRE_BL].pwm = 50;
         motor[TIRE_BL].dir = BACK;
-    } 
-    
+    }
+
 }
 #endif
 
@@ -3426,7 +3394,7 @@
 #if USE_PROCESS_NUM>5
 static void Process5()
 {
-    
+
 }
 #endif