Skip to content

Commit

Permalink
Move when we initialize ledBuffer for LEDs
Browse files Browse the repository at this point in the history
  • Loading branch information
IanTapply22 committed Jan 10, 2024
1 parent 1c1156b commit c14844b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/frc/robot/subsystems/led/LEDSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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

Expand Down

0 comments on commit c14844b

Please sign in to comment.