From 7ce73bf753bcab81a8a4ce61917a63b09f33bc56 Mon Sep 17 00:00:00 2001 From: Ethan Mortensen Date: Fri, 20 Feb 2026 11:00:08 -0800 Subject: [PATCH] hopefully made inactive hub stuff hopefully it works --- .../commands/led_comm/LEDDefaultCommand.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/main/java/frc/robot/commands/led_comm/LEDDefaultCommand.java b/src/main/java/frc/robot/commands/led_comm/LEDDefaultCommand.java index 21d2840..47e4ca5 100644 --- a/src/main/java/frc/robot/commands/led_comm/LEDDefaultCommand.java +++ b/src/main/java/frc/robot/commands/led_comm/LEDDefaultCommand.java @@ -17,17 +17,19 @@ public class LEDDefaultCommand extends Command { private double climbYCoordinate = 1.08; private boolean allianceIsRed = DriverStation.getAlliance().get() == DriverStation.Alliance.Red; + private String gameData = DriverStation.getGameSpecificMessage(); + public LEDDefaultCommand(LED led, Drivetrain drivetrain, Vision vision) { this.led = led; // this.outtake = outtake; this.drivetrain = drivetrain; this.vision = vision; - addRequirements(led); } @Override public void execute() { + double matchTime = DriverStation.getMatchTime(); if (vision.oneCameraDisconnected()) { // flash if camera disconnected led.setStrobeLights(255, 100, 0); @@ -40,6 +42,18 @@ public class LEDDefaultCommand extends Command { } else if (DriverStation.isAutonomous()){ // Dimmer light for auto in blue alliance led.setLEDs(0, 0, 100); + } else if ((allianceIsRed && gameData.equals("B") && matchTime <= 105 && matchTime >= 80) || (allianceIsRed && gameData.equals("B") && matchTime <= 55 && matchTime >= 30)) { + // turn light off for inactive hub if red alliance and blue inactive first + led.setLEDs(0, 0, 0); + } else if ((allianceIsRed && gameData.equals("B") && matchTime <= 130 && matchTime >= 105) || (allianceIsRed && gameData.equals("B") && matchTime <= 80 && matchTime >= 55)) { + // turn light off for inactive hub if red alliance and red inactive first + led.setLEDs(0, 0, 0); + } else if ((gameData.equals("R") && matchTime <= 130 && matchTime >= 105) || (gameData.equals("R") && matchTime <= 80 && matchTime >= 55)) { + // turn off lights for inactive hub if blue alliance and blue inactive first + led.setLEDs(0, 0, 0); + } else if ((gameData.equals("R") && matchTime <= 105 && matchTime >= 80) || (gameData.equals("R") && matchTime <= 55 && matchTime >= 30)) { + // turn light off for inactive hub if blue alliance and red inactive first + led.setLEDs(0, 0, 0); } else if (allianceIsRed) { // Red alliance led.setTwoColorWave(255, 0, 0, 255, 255, 255); @@ -49,10 +63,10 @@ public class LEDDefaultCommand extends Command { } } - private boolean climbAligned() { - double yCoordinate = drivetrain.getPose().getY(); - return Math.abs(yCoordinate - climbYCoordinate) < 0.03; - } + // private boolean climbAligned() { + // double yCoordinate = drivetrain.getPose().getY(); + // return Math.abs(yCoordinate - climbYCoordinate) < 0.03; + // } private boolean playingDefense() { double xCoordinate = drivetrain.getPose().getX(); -- 2.39.5