Skip to content

Commit

Permalink
Add FOLLOWS field to CANSparkMaxConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
anivanchen committed Jan 26, 2024
1 parent ee184a4 commit 492e18b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/com/stuypulse/robot/constants/Motors.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,23 @@ public static class CANSparkMaxConfig {
public final IdleMode IDLE_MODE;
public final int CURRENT_LIMIT_AMPS;
public final double OPEN_LOOP_RAMP_RATE;
public final CANSparkMax FOLLOWS;

public CANSparkMaxConfig(
boolean inverted,
IdleMode idleMode,
int currentLimitAmps,
double openLoopRampRate) {
double openLoopRampRate,
CANSparkMax follows) {
this.INVERTED = inverted;
this.IDLE_MODE = idleMode;
this.CURRENT_LIMIT_AMPS = currentLimitAmps;
this.OPEN_LOOP_RAMP_RATE = openLoopRampRate;
this.FOLLOWS = follows;
}

public CANSparkMaxConfig(boolean inverted, IdleMode idleMode, int currentLimitAmps) {
this(inverted, idleMode, currentLimitAmps, 0.0);
this(inverted, idleMode, currentLimitAmps, 0.0, null);
}

public CANSparkMaxConfig(boolean inverted, IdleMode idleMode) {
Expand All @@ -115,6 +118,7 @@ public void configure(CANSparkMax motor) {
motor.setIdleMode(IDLE_MODE);
motor.setSmartCurrentLimit(CURRENT_LIMIT_AMPS);
motor.setOpenLoopRampRate(OPEN_LOOP_RAMP_RATE);
if (FOLLOWS != null) motor.follow(FOLLOWS);
motor.burnFlash();
}

Expand Down

0 comments on commit 492e18b

Please sign in to comment.