Skip to content

Commit 70c3247

Browse files
committed
Use a variable to track Limelight LED state to avoid repeatedly enabling or disabling it.
1 parent ebfe679 commit 70c3247

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main/java/frc/robot/RobotContainer.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ public class RobotContainer {
115115
private HelixJoysticks joysticks;
116116
private HelixJoysticks op_joysticks;
117117

118+
private boolean limelightEnabled; // Whether the Limelight LEDs have been turned on.
119+
118120
/**
119121
* The container for the robot. Contains subsystems, OI devices, and commands.
120122
*/
@@ -206,11 +208,17 @@ public void moveHoodToHardStop() {
206208
}
207209

208210
public void enableLights() {
209-
mLimelight.turnOnLEDs();
211+
if (!limelightEnabled) {
212+
mLimelight.turnOnLEDs();
213+
limelightEnabled = true;
214+
}
210215
}
211216

212217
public void disableLights() {
213-
mLimelight.turnOffLEDs();
218+
if (limelightEnabled) {
219+
mLimelight.turnOffLEDs();
220+
limelightEnabled = false;
221+
}
214222
}
215223

216224
public void configureButtonBindings() {

0 commit comments

Comments
 (0)