
aa
Diff: System/Process/Process.cpp
- Revision:
- 56:61ebd4b759b4
- Parent:
- 55:844ac0974740
- Child:
- 57:ccfd26b94d8a
--- a/System/Process/Process.cpp Mon Nov 18 04:18:06 2019 +0000 +++ b/System/Process/Process.cpp Tue Nov 19 08:35:12 2019 +0000 @@ -102,8 +102,8 @@ Ticker bunzin; */ -//Timer time; -//int value; +Timer aime; +int value; #pragma endregion USER-DEFINED_VARIABLES_AND_PROTOTYPE @@ -220,7 +220,7 @@ int point1; void SystemProcess() { - + SystemProcessInitialize(); while(1) { @@ -277,16 +277,15 @@ if(StertSW && start_flag == true) { start_flag = false; lock = false; - //time.start(); if(ZoneSW) { countss=0; mode=1; - current = 3;//10GATU30変更した + current = 5;//1119変更した } else { countss = 0; mode=1; - current = 2;//11ガツ13ニチヘンコウ + current = 2; } } if(DWSW||DOSW) { @@ -1999,9 +1998,9 @@ if(g[0]==0) { mode=10; countss=100000; - fast = 60; - normal = 40; - slow = 30; + fast = 80; + normal = 60; + slow = 40; } break; case 10: @@ -2039,22 +2038,22 @@ case 0: motor[TIRE_FR].pwm = fast+50; motor[TIRE_FR].dir = BACK; - motor[TIRE_FL].pwm = fast+50; + motor[TIRE_FL].pwm = fast+60; motor[TIRE_FL].dir = FOR; motor[TIRE_BR].pwm = fast+50; motor[TIRE_BR].dir = BACK; - motor[TIRE_BL].pwm = fast+50; + motor[TIRE_BL].pwm = fast+45; motor[TIRE_BL].dir = FOR; mtc=true; break; case 255: motor[TIRE_FR].pwm = fast+50; motor[TIRE_FR].dir = BACK; - motor[TIRE_FL].pwm = slow+50; + motor[TIRE_FL].pwm = slow+60; motor[TIRE_FL].dir = FOR; motor[TIRE_BR].pwm = slow+50; motor[TIRE_BR].dir = BACK; - motor[TIRE_BL].pwm = fast+50; + motor[TIRE_BL].pwm = fast+45; motor[TIRE_BL].dir = FOR; mtc=true; break; @@ -2065,7 +2064,7 @@ motor[TIRE_FL].dir = FREE; motor[TIRE_BR].pwm = 0; motor[TIRE_BR].dir = FREE; - motor[TIRE_BL].pwm = slow+50; + motor[TIRE_BL].pwm = slow+45; motor[TIRE_BL].dir = FOR; mtc=true; break; @@ -2076,25 +2075,25 @@ motor[TIRE_FL].dir = FREE; motor[TIRE_BR].pwm = 0; motor[TIRE_BR].dir = FREE; - motor[TIRE_BL].pwm = normal+50; + motor[TIRE_BL].pwm = normal+45; motor[TIRE_BL].dir = FOR; mtc=true; break; case 1: motor[TIRE_FR].pwm = slow+50; motor[TIRE_FR].dir = BACK; - motor[TIRE_FL].pwm = fast+50; + motor[TIRE_FL].pwm = fast+60; motor[TIRE_FL].dir = FOR; motor[TIRE_BR].pwm = fast+50; motor[TIRE_BR].dir = BACK; - motor[TIRE_BL].pwm = slow+50; + motor[TIRE_BL].pwm = slow+45; motor[TIRE_BL].dir = FOR; mtc=true; break; case 3: motor[TIRE_FR].pwm = 0; motor[TIRE_FR].dir = FREE; - motor[TIRE_FL].pwm = slow+50; + motor[TIRE_FL].pwm = slow+60; motor[TIRE_FL].dir = FOR; motor[TIRE_BR].pwm = slow+50; motor[TIRE_BR].dir = BACK; @@ -2105,7 +2104,7 @@ case 2: motor[TIRE_FR].pwm = 0; motor[TIRE_FR].dir = FREE; - motor[TIRE_FL].pwm = normal+50; + motor[TIRE_FL].pwm = normal+60; motor[TIRE_FL].dir = FOR; motor[TIRE_BR].pwm = normal+50; motor[TIRE_BR].dir = BACK; @@ -2457,8 +2456,8 @@ if(g[3]==0&&g[2]==0) { mode=23; countss=0; - fast = 80; - normal = 60; + fast = 60; + normal = 40; slow = 30; } } else { @@ -2695,14 +2694,16 @@ motor[TIRE_BL].dir = BACK; break; } - if(g[1]==98) { - fast=20; - normal=15; + if(g[1]==98||g[1]==0||g[1]==1||g[1]==2||g[1]==3||g[1]==254||g[1]==253||g[1]==255) { + fast=10; + normal=10; slow=10; } if(g[3]==254&&countss>=100000) { mode=24; solenoid.solenoid4 = SOLENOID_OFF; + aime.start(); + aime.reset(); countss=0; fast=80; normal=60; @@ -2735,6 +2736,10 @@ break; case 24: if(YELLOW) { + value=aime.read_ms(); + if(value>=4000) { + mode=25; + } if(g[4]==3||g[4]==2) { motor[TIRE_FR].pwm = 30; motor[TIRE_FR].dir = FOR; @@ -3002,7 +3007,12 @@ } break; case 26: - if (g[1] == 98) { + /* + if (g[3] == 0&&countss>=30000) { + mode = 40; + } + */ + if (g[1] != 99) { mode = 31; } switch(g[4]) { @@ -3107,12 +3117,12 @@ motor[TIRE_BR].dir = FOR; motor[TIRE_BL].pwm = 255; motor[TIRE_BL].dir = BRAKE; - if(g[2]==0) { + if(g[3]==0) { cross=0; countss=0; mode=40; - fast = 60; - normal = 40; + fast = 70; + normal = 50; slow = 30; } break; @@ -3283,9 +3293,9 @@ if(g[1]==0) { countss=0; mode=70; - normal = 60; - fast = 70; - slow = 40; + normal = 120; + fast = 140; + slow = 100; } break; case 42: @@ -4688,6 +4698,524 @@ #if USE_PROCESS_NUM>5 static void Process5() { + countss++; + switch(mode) { + case 1: + mode=2; + countss=0; + fast = 60; + normal = 40; + slow = 30; + break; + case 2: + if(YELLOW) { + switch(g[4]) { + case 98: + motor[TIRE_FR].pwm = fast-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 = fast-5; + motor[TIRE_BL].dir = BACK; + break; + case 99: + motor[TIRE_FR].pwm = 0; + motor[TIRE_FR].dir = FREE; + motor[TIRE_FL].pwm = 0; + motor[TIRE_FL].dir = FREE; + motor[TIRE_BR].pwm = 0; + motor[TIRE_BR].dir = FREE; + motor[TIRE_BL].pwm = 0; + motor[TIRE_BL].dir = FREE; + break; + case 0: + motor[TIRE_FR].pwm = fast-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 = fast-5; + motor[TIRE_BL].dir = BACK; + break; + case 255: + motor[TIRE_FR].pwm = 0; + motor[TIRE_FR].dir = FREE; + motor[TIRE_FL].pwm = 0; + motor[TIRE_FL].dir = FREE; + motor[TIRE_BR].pwm = 0; + motor[TIRE_BR].dir = FREE; + motor[TIRE_BL].pwm = 0; + motor[TIRE_BL].dir = FREE; + break; + case 253: + 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].dir = BACK; + break; + case 254: + 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].dir = BACK; + break; + case 1: + motor[TIRE_FR].pwm = 0; + motor[TIRE_FR].dir = FREE; + motor[TIRE_FL].pwm = 0; + motor[TIRE_FL].dir = FREE; + motor[TIRE_BR].pwm = 0; + motor[TIRE_BR].dir = FREE; + motor[TIRE_BL].pwm = 0; + motor[TIRE_BL].dir = FREE; + break; + case 3: + motor[TIRE_FR].pwm = fast-5; + motor[TIRE_FR].dir = FOR; + motor[TIRE_FL].pwm = slow+5; + motor[TIRE_FL].dir = BACK; + motor[TIRE_BR].pwm = slow+5; + motor[TIRE_BR].dir = FOR; + motor[TIRE_BL].pwm = fast-5; + motor[TIRE_BL].dir = BACK; + break; + case 2: + motor[TIRE_FR].pwm = fast-5; + motor[TIRE_FR].dir = FOR; + motor[TIRE_FL].pwm = normal+5; + motor[TIRE_FL].dir = BACK; + motor[TIRE_BR].pwm = normal+5; + motor[TIRE_BR].dir = FOR; + motor[TIRE_BL].pwm = fast-5; + motor[TIRE_BL].dir = BACK; + break; + } + if(g[1]==98||g[1]==0||g[1]==1||g[1]==2||g[1]==3||g[1]==254||g[1]==253||g[1]==255) { + fast=10; + normal=10; + slow=10; + } + if(g[3]==254&&countss>=100000) { + mode=3; + solenoid.solenoid4 = SOLENOID_OFF; + aime.start(); + aime.reset(); + countss=0; + fast=80; + normal=60; + slow=30; + } + } else { + if(UPLS||DOLS) { + if(UPLS||DOLS) { + motor[MOTOR_0].pwm = 200; + motor[MOTOR_0].dir = BRAKE; + fast=60; + normal=40; + slow=30; + countss=0; + mode=24; + } + } 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; + } + break; + case 3: + if(YELLOW) { + value=aime.read_ms(); + if(value>=5000) { + mode=4; + } + if(g[4]==3||g[4]==2) { + motor[TIRE_FR].pwm = 20; + motor[TIRE_FR].dir = FOR; + motor[TIRE_FL].pwm = 30; + motor[TIRE_FL].dir = FOR; + motor[TIRE_BR].pwm = 30; + motor[TIRE_BR].dir = BACK; + motor[TIRE_BL].pwm = 20; + motor[TIRE_BL].dir = BACK; + } + if(g[4]==253||g[4]==254) { + motor[TIRE_FR].pwm = 30; + motor[TIRE_FR].dir = BACK; + motor[TIRE_FL].pwm = 20; + motor[TIRE_FL].dir = BACK; + motor[TIRE_BR].pwm = 20; + motor[TIRE_BR].dir = FOR; + motor[TIRE_BL].pwm = 30; + motor[TIRE_BL].dir = FOR; + } + switch(g[2]) { + case 0: + motor[TIRE_FR].pwm = 25; + motor[TIRE_FR].dir = FREE; + 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 = 25; + motor[TIRE_BR].dir = FREE; + break; + case 253: + motor[TIRE_FR].pwm = 40; + motor[TIRE_FR].dir = BACK; + motor[TIRE_BR].pwm = 25; + motor[TIRE_BR].dir = FREE; + break; + case 254: + motor[TIRE_FR].pwm = 30; + motor[TIRE_FR].dir = BACK; + motor[TIRE_BR].pwm = 30; + motor[TIRE_BR].dir = BACK; + break; + case 1: + 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 = 25; + motor[TIRE_FR].dir = FREE; + motor[TIRE_BR].pwm = 40; + motor[TIRE_BR].dir = FOR; + break; + case 2: + motor[TIRE_FR].pwm = 30; + motor[TIRE_FR].dir = FOR; + motor[TIRE_BR].pwm = 30; + motor[TIRE_BR].dir = FOR; + break; + } + switch(g[3]) { + case 0: + motor[TIRE_FL].pwm = 25; + motor[TIRE_FL].dir = FREE; + motor[TIRE_BL].pwm = 25; + motor[TIRE_BL].dir = FREE; + break; + case 255: + 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 = 25; + motor[TIRE_FL].dir = FREE; + motor[TIRE_BL].pwm = 40; + motor[TIRE_BL].dir = BACK; + break; + case 254: + motor[TIRE_FL].pwm = 30; + motor[TIRE_FL].dir = BACK; + motor[TIRE_BL].pwm = 30; + motor[TIRE_BL].dir = BACK; + break; + case 1: + motor[TIRE_FL].pwm = 30; + motor[TIRE_FL].dir = FOR; + 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 = 25; + motor[TIRE_BL].dir = FREE; + break; + case 2: + motor[TIRE_FL].pwm = 30; + motor[TIRE_FL].dir = FOR; + motor[TIRE_BL].pwm = 30; + motor[TIRE_BL].dir = FOR; + break; + } + if(g[3]==0&&g[2]==0) { + mode=25; + } + } else { + if(g[1]==98&&countss>=40000) { + mode=31; + fast = 60; + normal = 40; + slow = 30; + countss=0; + } + switch(g[1]) { + case 98: + fast=40; + normal=30; + slow=25; + motor[TIRE_FR].pwm = normal; + motor[TIRE_FR].dir = FOR; + motor[TIRE_FL].pwm = normal; + motor[TIRE_FL].dir = BACK; + motor[TIRE_BR].pwm = normal; + motor[TIRE_BR].dir = FOR; + motor[TIRE_BL].pwm = normal; + motor[TIRE_BL].dir = BACK; + break; + case 0: + motor[TIRE_FR].pwm = fast; + motor[TIRE_FR].dir = FOR; + motor[TIRE_FL].pwm = fast; + motor[TIRE_FL].dir = BACK; + motor[TIRE_BR].pwm = fast; + motor[TIRE_BR].dir = FOR; + motor[TIRE_BL].pwm = fast; + motor[TIRE_BL].dir = BACK; + mtc=true; + break; + case 255: + motor[TIRE_FR].pwm = fast; + motor[TIRE_FR].dir = FOR; + motor[TIRE_FL].pwm = slow; + motor[TIRE_FL].dir = BACK; + motor[TIRE_BR].pwm = slow; + motor[TIRE_BR].dir = FOR; + motor[TIRE_BL].pwm = fast; + motor[TIRE_BL].dir = BACK; + mtc=true; + break; + case 253: + motor[TIRE_FR].pwm = slow; + 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 = slow; + motor[TIRE_BL].dir = BACK; + mtc=true; + break; + case 254: + motor[TIRE_FR].pwm = normal; + 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 = normal; + motor[TIRE_BL].dir = BACK; + mtc=true; + break; + case 1: + motor[TIRE_FR].pwm = slow; + motor[TIRE_FR].dir = FOR; + motor[TIRE_FL].pwm = fast; + motor[TIRE_FL].dir = BACK; + motor[TIRE_BR].pwm = fast; + motor[TIRE_BR].dir = FOR; + motor[TIRE_BL].pwm = slow; + motor[TIRE_BL].dir = BACK; + mtc=true; + break; + case 3: + motor[TIRE_FR].pwm = 0; + motor[TIRE_FR].dir = FREE; + motor[TIRE_FL].pwm = slow; + motor[TIRE_FL].dir = BACK; + motor[TIRE_BR].pwm = slow; + motor[TIRE_BR].dir = FOR; + motor[TIRE_BL].pwm = 0; + motor[TIRE_BL].dir = FREE; + mtc=true; + break; + case 2: + motor[TIRE_FR].pwm = 0; + motor[TIRE_FR].dir = FREE; + motor[TIRE_FL].pwm = normal; + motor[TIRE_FL].dir = BACK; + motor[TIRE_BR].pwm = normal; + motor[TIRE_BR].dir = FOR; + motor[TIRE_BL].pwm = 0; + motor[TIRE_BL].dir = FREE; + mtc=true; + break; + } + if(g[1]!=98&&mtc==true) { + switch(g[0]) { + case 0: + mtc=false; + break; + case 255: + motor[TIRE_FL].pwm += 3; + mtc=false; + break; + case 253: + motor[TIRE_FL].pwm += 6; + mtc=false; + break; + case 254: + motor[TIRE_FL].pwm += 9; + motor[TIRE_FR].pwm = 0; + mtc=false; + break; + case 1: + motor[TIRE_FR].pwm += 3; + mtc=false; + break; + case 3: + motor[TIRE_FR].pwm += 6; + mtc=false; + break; + case 2: + motor[TIRE_FR].pwm += 9; + motor[TIRE_FL].pwm = 0; + mtc=false; + break; + } + } + } + break; + case 4: + 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) { + if(UPLS==true||DOLS==true) { + motor[MOTOR_0].pwm = 200; + motor[MOTOR_0].dir = BRAKE; + countss = 0; + mode=26; + } + } else { + motor[MOTOR_0].pwm = 100; + motor[MOTOR_0].dir = BACK; + } + break; + case 5: + /* + if (g[3] == 0&&countss>=30000) { + mode = 40; + } + */ + if (g[1] != 99) { + mode = 31; + } + switch(g[4]) { + case 98: + motor[TIRE_FR].pwm = 60; + 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 = 60; + motor[TIRE_BL].dir = BACK; + break; + case 99: + motor[TIRE_FR].pwm = 0; + motor[TIRE_FR].dir = FREE; + motor[TIRE_FL].pwm = 0; + motor[TIRE_FL].dir = FREE; + motor[TIRE_BR].pwm = 0; + motor[TIRE_BR].dir = FREE; + motor[TIRE_BL].pwm = 0; + motor[TIRE_BL].dir = FREE; + break; + case 0: + motor[TIRE_FR].pwm = 60; + 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 = 60; + motor[TIRE_BL].dir = BACK; + break; + case 255: + motor[TIRE_FR].pwm = 0; + motor[TIRE_FR].dir = FREE; + motor[TIRE_FL].pwm = 0; + motor[TIRE_FL].dir = FREE; + motor[TIRE_BR].pwm = 0; + motor[TIRE_BR].dir = FREE; + motor[TIRE_BL].pwm = 0; + motor[TIRE_BL].dir = FREE; + break; + case 253: + 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 = 25; + motor[TIRE_BL].dir = BACK; + break; + case 254: + motor[TIRE_FR].pwm = 40; + 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 = 40; + motor[TIRE_BL].dir = BACK; + break; + case 1: + motor[TIRE_FR].pwm = 0; + motor[TIRE_FR].dir = FREE; + motor[TIRE_FL].pwm = 0; + motor[TIRE_FL].dir = FREE; + motor[TIRE_BR].pwm = 0; + motor[TIRE_BR].dir = FREE; + motor[TIRE_BL].pwm = 0; + motor[TIRE_BL].dir = FREE; + break; + case 3: + motor[TIRE_FR].pwm = 60; + motor[TIRE_FR].dir = FOR; + motor[TIRE_FL].pwm = 25; + motor[TIRE_FL].dir = BACK; + motor[TIRE_BR].pwm = 25; + motor[TIRE_BR].dir = FOR; + motor[TIRE_BL].pwm = 60; + motor[TIRE_BL].dir = BACK; + break; + case 2: + motor[TIRE_FR].pwm = 60; + motor[TIRE_FR].dir = FOR; + motor[TIRE_FL].pwm = 40; + motor[TIRE_FL].dir = BACK; + motor[TIRE_BR].pwm = 40; + motor[TIRE_BR].dir = FOR; + motor[TIRE_BL].pwm = 60; + motor[TIRE_BL].dir = BACK; + break; + } + break; + } } #endif