From: moo Date: Fri, 6 Mar 2026 20:38:43 +0000 (-0800) Subject: Revert "changed to robot.getalliance" X-Git-Url: https://git.taranathan.com/?a=commitdiff_plain;h=d78aeab0c8468a1e81892439e23efe266f8e9bd1;p=FRC2026.git Revert "changed to robot.getalliance" This reverts commit eb577a64115a39b84b7234a3d56333b165ed7ea1. robot.getalliance doesn't actually better or worse than driverstation.getalliance, it only doesn't return an optional, robot.getalliance defaults to red --- diff --git a/src/main/java/frc/robot/util/HubActive.java b/src/main/java/frc/robot/util/HubActive.java index 05e0b43..dd5b762 100644 --- a/src/main/java/frc/robot/util/HubActive.java +++ b/src/main/java/frc/robot/util/HubActive.java @@ -4,16 +4,15 @@ import java.util.Optional; import edu.wpi.first.wpilibj.DriverStation; import edu.wpi.first.wpilibj.DriverStation.Alliance; -import frc.robot.Robot; public class HubActive { static public boolean isHubActive() { - Alliance alliance = Robot.getAlliance(); + Optional alliance = DriverStation.getAlliance(); // If we have no alliance, we cannot be enabled, therefore no hub. - // if (alliance.isEmpty()) { - // return false; - // } + if (alliance.isEmpty()) { + return false; + } // Hub is always enabled in autonomous. if (DriverStation.isAutonomousEnabled()) { return true; @@ -42,7 +41,7 @@ public class HubActive { } // Shift was is active for blue if red won auto, or red if blue won auto. - boolean shift1Active = switch (alliance) { + boolean shift1Active = switch (alliance.get()) { case Red -> !redInactiveFirst; case Blue -> redInactiveFirst; }; @@ -70,11 +69,11 @@ public class HubActive { static public Optional timeToActive() { - Alliance alliance = Robot.getAlliance(); + Optional alliance = DriverStation.getAlliance(); // If we have no alliance, we cannot be enabled, therefore no hub. - // if (alliance.isEmpty()) { - // return Optional.empty(); - // } + if (alliance.isEmpty()) { + return Optional.empty(); + } // Hub is always enabled in autonomous. if (DriverStation.isAutonomousEnabled()) { return Optional.of(0.0); @@ -103,7 +102,7 @@ public class HubActive { } // Shift was is active for blue if red won auto, or red if blue won auto. - boolean shift1Active = switch (alliance) { + boolean shift1Active = switch (alliance.get()) { case Red -> !redInactiveFirst; case Blue -> redInactiveFirst; };