From: moo Date: Fri, 3 Apr 2026 16:09:20 +0000 (-0700) Subject: add lights off button and reset team colors button X-Git-Url: https://git.taranathan.com/?a=commitdiff_plain;h=615305b5b82a7b2ddf9079092071614673d70940;p=FRC2026.git add lights off button and reset team colors button --- diff --git a/src/main/java/frc/robot/subsystems/LED/LED2.java b/src/main/java/frc/robot/subsystems/LED/LED2.java index 415268b..17f6c23 100644 --- a/src/main/java/frc/robot/subsystems/LED/LED2.java +++ b/src/main/java/frc/robot/subsystems/LED/LED2.java @@ -66,8 +66,21 @@ public class LED2 extends SubsystemBase { System.out.println("CANdle features: " + featureConf + ", LED config: " + ledConf); + SmartDashboard.putData("LED Off", new InstantCommand(() -> lightsOff())); SmartDashboard.putData("LED Strobe", new InstantCommand(() -> setStrobe())); SmartDashboard.putData("LED Static", new InstantCommand(() -> setStatic())); + SmartDashboard.putData("LED Color/Team Reset", new InstantCommand(() -> { + var allianceeee = DriverStation.getAlliance(); + if (allianceeee.isEmpty()) { + color = Color.kWhite; + } else if (allianceeee.get() == Alliance.Red) { + color = Color.kRed; + } else if (allianceeee.get() == Alliance.Blue) { + color = Color.kBlue; + } else { + color = Color.kWhite; + } + })); } private boolean flippy = true; @@ -83,14 +96,19 @@ public class LED2 extends SubsystemBase { } } - private void setStrobe() { + public void setStrobe() { candle.setControl(new StrobeAnimation(8, 8 + stripLength).withFrameRate(FLASH_RATE).withColor(new RGBWColor(color))); } - private void setStatic() { + public void setStatic() { candle.setControl(new SolidColor(8, 8 + stripLength).withColor(new RGBWColor(color))); } + public void lightsOff() { + candle.setControl(new SolidColor(8 , 8 + stripLength).withColor(new RGBWColor(0, 0, 0, 0))); + } + + private boolean underSecsToFlip(double secs) { Optional timeToActive = HubActive.timeToActive(); Optional timeToInactive = HubActive.timeToInactive();