From: moo Date: Fri, 3 Apr 2026 19:08:39 +0000 (-0700) Subject: fast blinky one sec till flip X-Git-Url: https://git.taranathan.com/?a=commitdiff_plain;h=2dbc7941014056874725645390675eb9ff655763;p=FRC2026.git fast blinky one sec till flip --- diff --git a/src/main/java/frc/robot/subsystems/LED/LED2.java b/src/main/java/frc/robot/subsystems/LED/LED2.java index fa0b0cf..47ad452 100644 --- a/src/main/java/frc/robot/subsystems/LED/LED2.java +++ b/src/main/java/frc/robot/subsystems/LED/LED2.java @@ -52,16 +52,7 @@ public class LED2 extends SubsystemBase { configurator.apply(featureConf); configurator.apply(ledConf); - var alliance = DriverStation.getAlliance(); - if (alliance.isEmpty()) { - color = Color.kOrange; - } else if (alliance.get() == Alliance.Red) { - color = Color.kRed; - } else if (alliance.get() == Alliance.Blue) { - color = Color.kOrange; - } else { - color = Color.kWhite; - } + setColor(); candle.clearAllAnimations(); setStatic(); @@ -71,37 +62,35 @@ public class LED2 extends SubsystemBase { SmartDashboard.putData("LED Off", new InstantCommand(() -> lightsOff()).ignoringDisable(true)); SmartDashboard.putData("LED Strobe", new InstantCommand(() -> setStrobe()).ignoringDisable(true)); SmartDashboard.putData("LED Static", new InstantCommand(() -> setStatic()).ignoringDisable(true)); - 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; - } - }).ignoringDisable(true)); + SmartDashboard.putData("LED Color/Team Reset", new InstantCommand(() -> setColor()).ignoringDisable(true)); } - private boolean flippy = true; public void setColor() { var alliance = DriverStation.getAlliance(); if (alliance.isEmpty()) { - color = Color.kWhite; + color = Color.kOrangeRed; } else if (alliance.get() == Alliance.Red) { color = Color.kRed; } else if (alliance.get() == Alliance.Blue) { color = Color.kBlue; } else { - color = Color.kWhite; + color = Color.kOrangeRed; } } + private boolean flippy = true; + private boolean fastFlippy = true; + @Override public void periodic() { + if (underSecsToFlip(1.0) && fastFlippy) { + setFastStrobe(); + fastFlippy = false; + } else if (!underSecsToFlip(1.0) && !flippy) { + fastFlippy = true; + } + if (underSecsToFlip(5.0) && flippy) { setStrobe(); flippy = false; @@ -109,6 +98,7 @@ public class LED2 extends SubsystemBase { setStatic(); flippy = true; } + } public void setStrobe() { @@ -116,6 +106,11 @@ public class LED2 extends SubsystemBase { candle.setControl(new StrobeAnimation(8, 8 + stripLength).withFrameRate(FLASH_RATE).withColor(new RGBWColor(color))); } + public void setFastStrobe() { + candle.clearAllAnimations(); + candle.setControl(new StrobeAnimation(8, 8 + stripLength).withFrameRate(FLASH_RATE * 4).withColor(new RGBWColor(color))); + } + public void setStatic() { candle.clearAllAnimations(); candle.setControl(new SolidColor(8, 8 + stripLength).withColor(new RGBWColor(color)));