From c14844b0f13f5c23c7b7a1484f9f807f15fa2e59 Mon Sep 17 00:00:00 2001 From: IanTapply22 Date: Tue, 9 Jan 2024 20:49:21 -0800 Subject: [PATCH] Move when we initialize ledBuffer for LEDs --- src/main/java/frc/robot/subsystems/led/LEDSubsystem.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/subsystems/led/LEDSubsystem.java b/src/main/java/frc/robot/subsystems/led/LEDSubsystem.java index e0242d8..2ca83e4 100644 --- a/src/main/java/frc/robot/subsystems/led/LEDSubsystem.java +++ b/src/main/java/frc/robot/subsystems/led/LEDSubsystem.java @@ -14,9 +14,7 @@ public class LEDSubsystem extends SubsystemBase { public static AddressableLED leds = new AddressableLED(0); // The PWM port the LEDs are plugged into - public static AddressableLEDBuffer ledBuffer = - new AddressableLEDBuffer( - (ledSegments.size() * LEDConstants.ledsPerSegment)); // The buffer that holds the LED data + public static AddressableLEDBuffer ledBuffer; // The buffer that holds the LED data @Override public void periodic() { @@ -34,6 +32,9 @@ public void initialize() { ledSegments.add(LEDSegment.BackRight); ledSegments.add(LEDSegment.FrontRight); + ledBuffer = new AddressableLEDBuffer( + (ledSegments.size() * LEDConstants.ledsPerSegment)); // Set the buffer size after we know how many segments there are + leds.setLength( (ledSegments.size() * LEDConstants.ledsPerSegment)); // Set the length of the LED strip