Skip to content

Commit

Permalink
Reformatted Input Detections
Browse files Browse the repository at this point in the history
Reformatted to make the if (true)'s less lengthy and messy. Additionally, the fly wheels now reverse from button 11 AND 7 (pulled it closer). One more thing, the conveyor can now be controlled separately from other parts of the intake by using button 9 to reverse it and button 10 to advance it.
  • Loading branch information
EuphoniumPlayer committed Mar 12, 2024
1 parent 29661e5 commit 9be43bc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 22 deletions.
5 changes: 2 additions & 3 deletions src/main/java/frc/robot/commands/ConveyorCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ public void initialize() {}

@Override
public void execute() {
if (ConveyorJoystick.getRawButton(5) == true | ConveyorJoystick.getRawButton(3) == true) {
if (ConveyorJoystick.getRawButton(5 | 3 | 10)) {
m_ConveyorSubsystem.intakeConveyor();
} else if (ConveyorJoystick.getRawButton(6) == true
| ConveyorJoystick.getRawButton(4) == true) {
} else if (ConveyorJoystick.getRawButton(6 | 4 | 9)) {
m_ConveyorSubsystem.reverseConveyor();
System.out.println("Conveyor Moving in Reverse");
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/frc/robot/commands/ElevatorControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public void initialize() {}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
if (ElevatorJoystick.getThrottle() <= -0.85) {
if (ElevatorJoystick.getThrottle() <= -0.75) {
ElevatorSubsystem.up();
} else if (ElevatorJoystick.getThrottle() >= 0.85) {
} else if (ElevatorJoystick.getThrottle() >= 0.75) {
ElevatorSubsystem.down();
}
}
Expand All @@ -45,4 +45,4 @@ public void end(boolean interrupted) {}
public boolean isFinished() {
return false;
}
}
}
10 changes: 4 additions & 6 deletions src/main/java/frc/robot/commands/FlyWCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ public void initialize() {}

@Override
public void execute() {
if (FlyWJoystick.getPOV() == 315 | FlyWJoystick.getPOV() == 0 | FlyWJoystick.getPOV() == 45) {
if (FlyWJoystick.getPOV() == (315 | 0 | 45)) {

Check warning on line 28 in src/main/java/frc/robot/commands/FlyWCommand.java

View workflow job for this annotation

GitHub Actions / qodana

Pointless bitwise expression

`315 | 0 | 45` can be replaced with '315 \| 45'
m_FlyWSubsystem.enableflywheelfull();
} else if (FlyWJoystick.getPOV() == 225
| FlyWJoystick.getPOV() == 180
| FlyWJoystick.getPOV() == 135) {
} else if (FlyWJoystick.getPOV() == (225 | 180 | 135)) {
m_FlyWSubsystem.enableflywheellow();
} else if (FlyWJoystick.getRawButton(12) == true) {
} else if (FlyWJoystick.getRawButton(12)) {
m_FlyWSubsystem.enableflywheelreduced();
} else if (FlyWJoystick.getRawButton(7) == true) {
} else if (FlyWJoystick.getRawButton(11 | 7)) {
m_FlyWSubsystem.reverseflywheel();
System.out.println("Flywheels Moving in Reverse");
} else {
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/frc/robot/commands/IntakeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ public void initialize() {}

@Override
public void execute() {
if (IntakeJoystick.getRawButton(5) == true) {
// sushi in
if (IntakeJoystick.getRawButton(5)) {
// sushi + Conveyor in
m_intakeSubsystem.enableIntakeSushi();
} else if (IntakeJoystick.getRawButton(3) == true) {
// front in
} else if (IntakeJoystick.getRawButton(3)) {
// front + Conveyor in
m_intakeSubsystem.enableIntakeFront();
} else if (IntakeJoystick.getRawButton(4) == true) {
// front out
} else if (IntakeJoystick.getRawButton(4)) {
// front + Conveyor out
m_intakeSubsystem.reverseIntakeFront();
System.out.println("Front Rollers Moving in Reverse");
} else if (IntakeJoystick.getRawButton(6) == true) {
// sushi out
} else if (IntakeJoystick.getRawButton(6)) {
// sushi + Conveyor out
m_intakeSubsystem.reverseIntakeSushi();
System.out.println("Sushi Rollers Moving in Reverse");
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/subsystems/Intake.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ public void enableIntakeFront() {
intakeFront.set(MechanismConstants.INTAKE_MOTOR_SPEED_FRONT);
}

/** Sets the intake motors to 0% power. */
/** Sets both intake motors to 0% power. */
public void disableIntake() {
intakeSushi.set(0);
intakeFront.set(0);
}

/** Sets the intake motors to -100% power. (Reverse direction) */
/** Sets the sushi motors to -100% power. (Reverse direction) */
public void reverseIntakeSushi() {
intakeSushi.set(-MechanismConstants.INTAKE_MOTOR_SPEED_SUSHI);
}
Expand Down

0 comments on commit 9be43bc

Please sign in to comment.