Skip to content

Commit

Permalink
Add Texas mode 🤠 (#260)
Browse files Browse the repository at this point in the history
* Fix stripe loop logic

* Formatting

* Disable pride by default

---------

Co-authored-by: Jonah <47046556+jwbonner@users.noreply.github.com>
  • Loading branch information
harnwalN and jwbonner authored Apr 13, 2024
1 parent 42758bc commit e129597
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -263,11 +261,12 @@ private void wave(Color c1, Color c2, double cycleLength, double duration) {
}
}

private void stripes(List<Color> colors, int length, double duration) {
int offset = (int) (Timer.getFPGATimestamp() % duration / duration * length * colors.size());
private void stripes(List<Color> 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));
}
Expand Down

0 comments on commit e129597

Please sign in to comment.