2
0
mirror of https://github.com/team2059/Zaphod synced 2024-12-18 20:12:28 -05:00

Formatted code and started work on Test function

This commit is contained in:
Austen Adler 2014-03-31 22:40:15 -04:00
parent 554d8f7c9f
commit ab224b71f5

View File

@ -184,7 +184,7 @@ public:
//}}} //}}}
//setMotorValue{{{ //setMotorValue{{{
void setMotorValue(int motor,int subwayStation=1,int value=127){ void setMotorValue(int motor,int subwayStation=1,int value=127){
if(subwayStation == 1){ if(subwayStation==1){
//subwayStation1{{{ //subwayStation1{{{
switch(motor){ switch(motor){
case 1: case 1:
@ -215,7 +215,7 @@ public:
break; break;
} }
//}}} //}}}
}else if(subwayStation == 2){ }else if(subwayStation==2){
//subwayStation2{{{ //subwayStation2{{{
switch(motor){ switch(motor){
//Shooter motors //Shooter motors
@ -482,11 +482,11 @@ public:
SmartDashboard::PutNumber("Autonomous step", currentStep); SmartDashboard::PutNumber("Autonomous step", currentStep);
updateDashboard(); updateDashboard();
//Compressor{{{ //Compressor{{{
if(i % 100 == 0 && compressing && compressor.GetPressureSwitchValue() == 1){ if(i%100==0&&compressing&&compressor.GetPressureSwitchValue()==1){
compressor.Stop(); compressor.Stop();
compressing=false; compressing=false;
} }
if(i % 100 == 0 && !compressing && compressor.GetPressureSwitchValue() == 0){ if(i%100==0&&!compressing&&compressor.GetPressureSwitchValue()==0){
compressor.Start(); compressor.Start();
compressing=true; compressing=true;
} }
@ -509,7 +509,7 @@ public:
compressing=false; compressing=false;
SmartDashboard::PutBoolean("CollectorState",false); SmartDashboard::PutBoolean("CollectorState",false);
//}}} //}}}
while(IsEnabled() && IsOperatorControl()){ while(IsEnabled()&&IsOperatorControl()){
//Joystick{{{ //Joystick{{{
//Throttle values{{{ //Throttle values{{{
if(Lstick.GetRawButton(9)==1){ if(Lstick.GetRawButton(9)==1){
@ -541,10 +541,10 @@ public:
shooting=true; shooting=true;
shootRobot(throttle); shootRobot(throttle);
setMotorValue(6,1,1); setMotorValue(6,1,1);
if(collectorExtended == false){ if(collectorExtended==false){
shooting=false; shooting=false;
} }
if(collectorExtended == true&&(SmartDashboard::GetBoolean("Ignore Pot")||upLimit>=potToDegrees(armPot.GetAverageVoltage()))){ if(collectorExtended==true&&(SmartDashboard::GetBoolean("Ignore Pot")||upLimit>=potToDegrees(armPot.GetAverageVoltage()))){
shooting=true; shooting=true;
shootRobot(throttle); shootRobot(throttle);
setMotorValue(6,1,1); setMotorValue(6,1,1);
@ -558,7 +558,7 @@ public:
//Lower Shooter{{{ //Lower Shooter{{{
shooting=false; shooting=false;
shootRobot(-0.1f); shootRobot(-0.1f);
if(collectorExtended == true){ if(collectorExtended==true){
shootRobot(-0.1f); shootRobot(-0.1f);
} }
//}}} //}}}
@ -610,11 +610,11 @@ public:
//}}} //}}}
//Compressor{{{ //Compressor{{{
if(SmartDashboard::GetBoolean("Compressor Enabled")){ if(SmartDashboard::GetBoolean("Compressor Enabled")){
if(i % 100 == 0 && compressing && compressor.GetPressureSwitchValue() == 1){ if(i%100==0&&compressing&&compressor.GetPressureSwitchValue()==1){
compressor.Stop(); compressor.Stop();
compressing=false; compressing=false;
} }
if(i % 100 == 0 && !compressing && compressor.GetPressureSwitchValue() == 0){ if(i%100==0&&!compressing&&compressor.GetPressureSwitchValue()==0){
compressor.Start(); compressor.Start();
compressing=true; compressing=true;
} }
@ -630,6 +630,11 @@ public:
//}}} //}}}
//Test{{{ //Test{{{
void Test(){ void Test(){
int i=0;
while(IsEnabled()&&IsTest()){
i++;
Wait(0.005f);
}
} }
//}}} //}}}
}; };