mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
[wpilib] Rename LEDPattern constants to all caps
This commit is contained in:
@@ -612,14 +612,14 @@ public interface LEDPattern {
|
||||
* A continuous gradient, where the gradient wraps around to allow for seamless scrolling
|
||||
* effects.
|
||||
*/
|
||||
kContinuous,
|
||||
CONTINUOUS,
|
||||
|
||||
/**
|
||||
* A discontinuous gradient, where the first pixel is set to the first color of the gradient and
|
||||
* the final pixel is set to the last color of the gradient. There is no wrapping effect, so
|
||||
* scrolling effects will display an obvious seam.
|
||||
*/
|
||||
kDiscontinuous
|
||||
DISCONTINUOUS
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -654,8 +654,8 @@ public interface LEDPattern {
|
||||
int bufLen = reader.getLength();
|
||||
int ledsPerSegment =
|
||||
switch (type) {
|
||||
case kContinuous -> bufLen / numSegments;
|
||||
case kDiscontinuous -> (bufLen - 1) / (numSegments - 1);
|
||||
case CONTINUOUS -> bufLen / numSegments;
|
||||
case DISCONTINUOUS -> (bufLen - 1) / (numSegments - 1);
|
||||
};
|
||||
|
||||
for (int led = 0; led < bufLen; led++) {
|
||||
|
||||
@@ -6,8 +6,8 @@ package org.wpilib.hardware.led;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
import static org.wpilib.hardware.led.LEDPattern.GradientType.kContinuous;
|
||||
import static org.wpilib.hardware.led.LEDPattern.GradientType.kDiscontinuous;
|
||||
import static org.wpilib.hardware.led.LEDPattern.GradientType.CONTINUOUS;
|
||||
import static org.wpilib.hardware.led.LEDPattern.GradientType.DISCONTINUOUS;
|
||||
import static org.wpilib.units.Units.Centimeters;
|
||||
import static org.wpilib.units.Units.Meters;
|
||||
import static org.wpilib.units.Units.MetersPerSecond;
|
||||
@@ -86,7 +86,7 @@ class LEDPatternTest {
|
||||
|
||||
@Test
|
||||
void gradient0SetsToBlack() {
|
||||
LEDPattern pattern = LEDPattern.gradient(kContinuous);
|
||||
LEDPattern pattern = LEDPattern.gradient(CONTINUOUS);
|
||||
AddressableLEDBuffer buffer = new AddressableLEDBuffer(99);
|
||||
for (int i = 0; i < buffer.getLength(); i++) {
|
||||
buffer.setRGB(i, 127, 128, 129);
|
||||
@@ -101,7 +101,7 @@ class LEDPatternTest {
|
||||
|
||||
@Test
|
||||
void gradient1SetsToSolid() {
|
||||
LEDPattern pattern = LEDPattern.gradient(kContinuous, YELLOW);
|
||||
LEDPattern pattern = LEDPattern.gradient(CONTINUOUS, YELLOW);
|
||||
|
||||
AddressableLEDBuffer buffer = new AddressableLEDBuffer(99);
|
||||
pattern.applyTo(buffer);
|
||||
@@ -113,7 +113,7 @@ class LEDPatternTest {
|
||||
|
||||
@Test
|
||||
void continuousGradient2Colors() {
|
||||
LEDPattern pattern = LEDPattern.gradient(kContinuous, YELLOW, PURPLE);
|
||||
LEDPattern pattern = LEDPattern.gradient(CONTINUOUS, YELLOW, PURPLE);
|
||||
|
||||
AddressableLEDBuffer buffer = new AddressableLEDBuffer(99);
|
||||
pattern.applyTo(buffer);
|
||||
@@ -127,7 +127,7 @@ class LEDPatternTest {
|
||||
|
||||
@Test
|
||||
void discontinuousGradient2Colors() {
|
||||
LEDPattern pattern = LEDPattern.gradient(kDiscontinuous, YELLOW, PURPLE);
|
||||
LEDPattern pattern = LEDPattern.gradient(DISCONTINUOUS, YELLOW, PURPLE);
|
||||
|
||||
AddressableLEDBuffer buffer = new AddressableLEDBuffer(99);
|
||||
pattern.applyTo(buffer);
|
||||
@@ -139,7 +139,7 @@ class LEDPatternTest {
|
||||
|
||||
@Test
|
||||
void gradient3Colors() {
|
||||
LEDPattern pattern = LEDPattern.gradient(kContinuous, YELLOW, PURPLE, WHITE);
|
||||
LEDPattern pattern = LEDPattern.gradient(CONTINUOUS, YELLOW, PURPLE, WHITE);
|
||||
AddressableLEDBuffer buffer = new AddressableLEDBuffer(99);
|
||||
pattern.applyTo(buffer);
|
||||
|
||||
@@ -154,7 +154,7 @@ class LEDPatternTest {
|
||||
|
||||
@Test
|
||||
void discontinuousGradient3Colors() {
|
||||
LEDPattern pattern = LEDPattern.gradient(kDiscontinuous, YELLOW, PURPLE, WHITE);
|
||||
LEDPattern pattern = LEDPattern.gradient(DISCONTINUOUS, YELLOW, PURPLE, WHITE);
|
||||
AddressableLEDBuffer buffer = new AddressableLEDBuffer(101);
|
||||
pattern.applyTo(buffer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user