Skip to content

Commit

Permalink
Merge pull request #94 from kirbt/testing
Browse files Browse the repository at this point in the history
limit switch fix
  • Loading branch information
kirbt authored Mar 19, 2024
2 parents 5adceb9 + 273a757 commit bbd79f4
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/main/java/frc/team2412/robot/subsystems/IntakeSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,22 @@ public IntakeSubsystem() {
initShuffleboard();
}

private void configureMotor(CANSparkBase motor, int currentLimit, boolean invert) {
private void configureMotor(
CANSparkBase motor, int currentLimit, boolean invert, boolean enableLimitSwitch) {
motor.restoreFactoryDefaults();
motor.setIdleMode(IdleMode.kBrake);
motor.setSmartCurrentLimit(currentLimit);
motor.setInverted(invert);
motor
.getForwardLimitSwitch(com.revrobotics.SparkLimitSwitch.Type.kNormallyOpen)
.enableLimitSwitch(enableLimitSwitch);
motor.burnFlash();
}

private void configureMotor(CANSparkBase motor, int currentLimit, boolean invert) {
configureMotor(motor, currentLimit, invert, false);
}

private void configureMotor(CANSparkBase motor, boolean invert) {
configureMotor(motor, 20, invert);
}
Expand All @@ -122,10 +130,8 @@ private void resetMotors() {
configureMotor(ingestMotor, false);
configureMotor(indexMotorUpper, 40, false);

configureMotor(feederMotor, 40, false);
indexMotorUpper
.getForwardLimitSwitch(com.revrobotics.SparkLimitSwitch.Type.kNormallyOpen)
.enableLimitSwitch(false);
configureMotor(feederMotor, 40, true);

indexMotorUpper.burnFlash();
}

Expand Down

0 comments on commit bbd79f4

Please sign in to comment.