From b6fd346b7a2d5f2e3ef848d0dab0bbfd35c3f7be Mon Sep 17 00:00:00 2001 From: Ethan Mortensen Date: Wed, 1 Apr 2026 14:56:58 -0700 Subject: [PATCH] maybe make hub code better not tested --- .../commands/led_comm/LEDDefaultCommand.java | 57 +++++++++++-------- 1 file changed, 33 insertions(+), 24 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 f0504a8..33b6921 100644 --- a/src/main/java/frc/robot/commands/led_comm/LEDDefaultCommand.java +++ b/src/main/java/frc/robot/commands/led_comm/LEDDefaultCommand.java @@ -4,6 +4,7 @@ import edu.wpi.first.wpilibj.DriverStation; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.constants.Constants; import frc.robot.subsystems.LED.LED; +import frc.robot.util.HubActive; import lib.controllers.PS5Controller; import lib.controllers.PS5Controller.PS5Button; @@ -55,35 +56,43 @@ public class LEDDefaultCommand extends Command { // Dimmer light for auto in blue alliance led.setLEDs(0, 0, 50); counter = 0; - } else if (gameData != null && ((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); - counter = 0; - } else if (gameData != null && ((allianceIsRed && gameData.equals("R") && matchTime <= 130 && matchTime >= 105) - || (allianceIsRed && gameData.equals("R") && matchTime <= 80 && matchTime >= 55))) { - // turn light off for inactive hub if red alliance and red inactive first - led.setLEDs(0, 0, 0); - counter = 0; - } else if (gameData != null && ((!allianceIsRed && gameData.equals("B") && matchTime <= 130 && matchTime >= 105) - || (!allianceIsRed && gameData.equals("B") && matchTime <= 80 && matchTime >= 55))) { - // turn off lights for inactive hub if blue alliance and blue inactive first - led.setLEDs(0, 0, 0); - counter = 0; - } else if (gameData != null && ((!allianceIsRed && gameData.equals("R") && matchTime <= 105 && matchTime >= 80) - || (!allianceIsRed && 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); - counter = 0; - } else if (allianceIsRed) { - // Red alliance + } else if (allianceIsRed && HubActive.isHubActive()){ led.setTwoColorWave(255, 0, 0, 255, 255, 255); counter = 0; - } else { - // Blue alliance + } else if (!allianceIsRed && HubActive.isHubActive()) { led.setTwoColorWave(0, 0, 255, 255, 255, 255); counter = 0; + } else if (!HubActive.isHubActive()){ + led.setLEDs(0, 0, 0); + counter = 0; } + + // previous LED Hub code + + // } else if (gameData != null && ((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); + // counter = 0; + // } else if (gameData != null && ((allianceIsRed && gameData.equals("R") && matchTime <= 130 && matchTime >= 105) + // || (allianceIsRed && gameData.equals("R") && matchTime <= 80 && matchTime >= 55))) { + // // turn light off for inactive hub if red alliance and red inactive first + // led.setLEDs(0, 0, 0); + // counter = 0; + // } else if (gameData != null && ((!allianceIsRed && gameData.equals("B") && matchTime <= 130 && matchTime >= 105) + // || (!allianceIsRed && gameData.equals("B") && matchTime <= 80 && matchTime >= 55))) { + // // turn off lights for inactive hub if blue alliance and blue inactive first + // led.setLEDs(0, 0, 0); + // counter = 0; + // } else if (gameData != null && ((!allianceIsRed && gameData.equals("R") && matchTime <= 105 && matchTime >= 80) + // || (!allianceIsRed && 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); + // counter = 0; + // } else if (allianceIsRed) { + // // Red alliance + // led.setTwoColorWave(255, 0, 0, 255, 255, 255); + // counter = 0; } @Override -- 2.39.5