From e129597fa3e40bbe830515b18c6504b0ffd85715 Mon Sep 17 00:00:00 2001 From: Neel <87990699+harnwalN@users.noreply.github.com> Date: Sat, 13 Apr 2024 16:23:54 -0400 Subject: [PATCH] =?UTF-8?q?Add=20Texas=20mode=20=F0=9F=A4=A0=20(#260)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix stripe loop logic * Formatting * Disable pride by default --------- Co-authored-by: Jonah <47046556+jwbonner@users.noreply.github.com> --- .../littletonrobotics/frc2024/subsystems/leds/Leds.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/leds/Leds.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/leds/Leds.java index ed6f36d1..452a9238 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/leds/Leds.java +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/leds/Leds.java @@ -63,7 +63,6 @@ public static Leds getInstance() { private static final boolean prideLeds = false; private static final int minLoopCycleCount = 10; private static final int length = 12; - private static final int staticSectionLength = 3; private static final double strobeDuration = 0.1; private static final double breathDuration = 1.0; private static final double rainbowCycleLength = 25.0; @@ -159,7 +158,6 @@ public synchronized void periodic() { new Color(0.15, 0.3, 1.0)), 3, 5.0); - buffer.setLED(staticSectionLength, allianceColor); } else { // Default pattern wave(allianceColor, secondaryDisabledColor, waveAllianceCycleLength, waveAllianceDuration); @@ -263,11 +261,12 @@ private void wave(Color c1, Color c2, double cycleLength, double duration) { } } - private void stripes(List colors, int length, double duration) { - int offset = (int) (Timer.getFPGATimestamp() % duration / duration * length * colors.size()); + private void stripes(List colors, int stripeLength, double duration) { + int offset = + (int) (Timer.getFPGATimestamp() % duration / duration * stripeLength * colors.size()); for (int i = 0; i < length; i++) { int colorIndex = - (int) (Math.floor((double) (i - offset) / length) + colors.size()) % colors.size(); + (int) (Math.floor((double) (i - offset) / stripeLength) + colors.size()) % colors.size(); colorIndex = colors.size() - 1 - colorIndex; buffer.setLED(i, colors.get(colorIndex)); }