Skip to content

Commit

Permalink
Added idle mode to TalonSRX and VictorSPX
Browse files Browse the repository at this point in the history
  • Loading branch information
woopers6 committed Nov 19, 2024
1 parent 657ddc3 commit dacc252
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/org/lasarobotics/hardware/ctre/TalonSRX.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.ctre.phoenix.motorcontrol.FeedbackDevice;
import com.ctre.phoenix.motorcontrol.LimitSwitchNormal;
import com.ctre.phoenix.motorcontrol.LimitSwitchSource;
import com.ctre.phoenix.motorcontrol.NeutralMode;

/** TalonSRX */
public class TalonSRX extends LoggableHardware {
Expand Down Expand Up @@ -277,6 +278,14 @@ public void enableCurrentLimit(boolean enable) {
m_talon.enableCurrentLimit(enable);
}

/**
* Sets the idle mode setting for the TalonSRX
* @param mode Idle mode (coast or brake)
*/
public void setIdleMode(NeutralMode mode) {
m_talon.setNeutralMode(mode);
}

/**
* Configure the peak allowable current (when current limit is enabled).
*
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/org/lasarobotics/hardware/ctre/VictorSPX.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.littletonrobotics.junction.inputs.LoggableInputs;

import com.ctre.phoenix.motorcontrol.ControlMode;
import com.ctre.phoenix.motorcontrol.NeutralMode;

/** VictorSPX */
public class VictorSPX extends LoggableHardware {
Expand Down Expand Up @@ -133,6 +134,14 @@ public void setVoltage(double outputVolts) {
m_victor.setVoltage(outputVolts);
}

/**
* Sets the idle mode setting for the VictorSPX
* @param mode Idle mode (coast or brake)
*/
public void setIdleMode(NeutralMode mode) {
m_victor.setNeutralMode(mode);
}

/**
* Common interface to stop the motor until Set is called again.
*/
Expand Down

0 comments on commit dacc252

Please sign in to comment.