]> git.taranathan.com Git - FRC2026.git/commitdiff
more led
authormaxwtan <100314265+MaxwellTTan20@users.noreply.github.com>
Fri, 3 Apr 2026 19:35:33 +0000 (12:35 -0700)
committermaxwtan <100314265+MaxwellTTan20@users.noreply.github.com>
Fri, 3 Apr 2026 19:35:33 +0000 (12:35 -0700)
src/main/java/frc/robot/subsystems/LED/LED2.java

index 47ad4529b822b274a5441f2938029c7c2542bf2b..2052e50cdf661fc5b8d850f6e7c2c22a009379f0 100644 (file)
@@ -5,6 +5,8 @@ import java.util.Optional;
 import com.ctre.phoenix6.configs.CANdleConfigurator;
 import com.ctre.phoenix6.configs.CANdleFeaturesConfigs;
 import com.ctre.phoenix6.configs.LEDConfigs;
+import com.ctre.phoenix6.controls.FireAnimation;
+import com.ctre.phoenix6.controls.LarsonAnimation;
 import com.ctre.phoenix6.controls.SolidColor;
 import com.ctre.phoenix6.controls.StrobeAnimation;
 import com.ctre.phoenix6.hardware.CANdle;
@@ -21,6 +23,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
 import edu.wpi.first.wpilibj.util.Color;
 import edu.wpi.first.wpilibj2.command.InstantCommand;
 import edu.wpi.first.wpilibj2.command.SubsystemBase;
+import frc.robot.Robot;
 import frc.robot.constants.Constants;
 import frc.robot.constants.IdConstants;
 import frc.robot.util.HubActive;
@@ -62,7 +65,8 @@ 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(() -> setColor()).ignoringDisable(true));
+               SmartDashboard.putData("LED Fire", new InstantCommand(() -> setFire()).ignoringDisable(true));
+               SmartDashboard.putData("LED Color Team Reset", new InstantCommand(() -> setColor()).ignoringDisable(true));
        }
 
 
@@ -81,12 +85,24 @@ public class LED2 extends SubsystemBase {
 
        private boolean flippy = true;
        private boolean fastFlippy = true;
+       private boolean autoFlippy = true;
 
        @Override
        public void periodic() {
+
+               if (DriverStation.isAutonomous() && autoFlippy) {
+                       setFire();
+                       autoFlippy = false;
+                       return;
+               } else if (!DriverStation.isAutonomous() && !autoFlippy) {
+                       setStatic();
+                       autoFlippy = true;
+               }
+
                if (underSecsToFlip(1.0) && fastFlippy) {
                        setFastStrobe();
                        fastFlippy = false;
+                       return;
                } else if (!underSecsToFlip(1.0) && !flippy) {
                        fastFlippy = true;
                }
@@ -101,6 +117,11 @@ public class LED2 extends SubsystemBase {
 
        }
 
+       public void setFire() {
+               candle.clearAllAnimations();
+               candle.setControl(new FireAnimation(8, 8 + stripLength));
+       }
+
        public void setStrobe() {
                candle.clearAllAnimations();
                candle.setControl(new StrobeAnimation(8, 8 + stripLength).withFrameRate(FLASH_RATE).withColor(new RGBWColor(color)));
@@ -137,4 +158,5 @@ public class LED2 extends SubsystemBase {
                        return false;
                }
        }
+
 }