From 13608baf790405d967418a6432ee08feb0be1429 Mon Sep 17 00:00:00 2001 From: mixxlto Date: Sun, 18 Jan 2026 10:08:15 -0800 Subject: [PATCH] fixed can bus objects --- src/main/java/frc/robot/constants/Constants.java | 6 ++++-- .../java/frc/robot/constants/swerve/DriveConstants.java | 9 +++++---- src/main/java/frc/robot/subsystems/LED/LED.java | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/frc/robot/constants/Constants.java b/src/main/java/frc/robot/constants/Constants.java index 6b99d88..649cbc5 100644 --- a/src/main/java/frc/robot/constants/Constants.java +++ b/src/main/java/frc/robot/constants/Constants.java @@ -1,5 +1,7 @@ package frc.robot.constants; +import com.ctre.phoenix6.CANBus; + import edu.wpi.first.wpilibj.RobotBase; public class Constants { @@ -11,8 +13,8 @@ public class Constants { public static final double LOOP_TIME = 0.02; // CAN bus names - public static final String CANIVORE_CAN = "CANivore"; - public static final String RIO_CAN = "rio"; + public static final CANBus CANIVORE_CAN = new CANBus("CANivore"); + public static final CANBus RIO_CAN = new CANBus("rio"); // Logging public static final boolean USE_TELEMETRY = true; diff --git a/src/main/java/frc/robot/constants/swerve/DriveConstants.java b/src/main/java/frc/robot/constants/swerve/DriveConstants.java index 3e57260..3168936 100644 --- a/src/main/java/frc/robot/constants/swerve/DriveConstants.java +++ b/src/main/java/frc/robot/constants/swerve/DriveConstants.java @@ -1,5 +1,6 @@ package frc.robot.constants.swerve; +import com.ctre.phoenix6.CANBus; import com.ctre.phoenix6.signals.InvertedValue; import com.ctre.phoenix6.signals.NeutralModeValue; @@ -110,10 +111,10 @@ public class DriveConstants { public static final double PATH_PLANNER_TRANSLATIONAL_D = 0; // CAN - public static String DRIVE_MOTOR_CAN = Constants.CANIVORE_CAN; - public static String STEER_MOTOR_CAN = Constants.CANIVORE_CAN; - public static String STEER_ENCODER_CAN = Constants.CANIVORE_CAN; - public static String PIGEON_CAN = Constants.CANIVORE_CAN; + public static CANBus DRIVE_MOTOR_CAN = Constants.CANIVORE_CAN; + public static CANBus STEER_MOTOR_CAN = Constants.CANIVORE_CAN; + public static CANBus STEER_ENCODER_CAN = Constants.CANIVORE_CAN; + public static CANBus PIGEON_CAN = Constants.CANIVORE_CAN; public static COTSFalconSwerveConstants MODULE_CONSTANTS = COTSFalconSwerveConstants.SDSMK4i(DRIVE_GEAR_RATIO); diff --git a/src/main/java/frc/robot/subsystems/LED/LED.java b/src/main/java/frc/robot/subsystems/LED/LED.java index a521639..8bceb40 100644 --- a/src/main/java/frc/robot/subsystems/LED/LED.java +++ b/src/main/java/frc/robot/subsystems/LED/LED.java @@ -1,6 +1,7 @@ package frc.robot.subsystems.LED; import edu.wpi.first.wpilibj2.command.SubsystemBase; +import frc.robot.constants.Constants; import frc.robot.constants.IdConstants; import com.ctre.phoenix.led.CANdle; @@ -15,7 +16,7 @@ public class LED extends SubsystemBase { // Constructor public LED() { - this.candle = new CANdle(IdConstants.CANDLE_ID, "rio"); + this.candle = new CANdle(IdConstants.CANDLE_ID); candle.configStatusLedState(false); candle.configLOSBehavior(false); -- 2.39.5