mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib] Rename LEDPattern constants to all caps
This commit is contained in:
@@ -297,10 +297,10 @@ LEDPattern LEDPattern::Gradient(GradientType type,
|
||||
auto bufLen = data.size();
|
||||
int ledsPerSegment = 0;
|
||||
switch (type) {
|
||||
case kContinuous:
|
||||
case GradientType::CONTINUOUS:
|
||||
ledsPerSegment = bufLen / numSegments;
|
||||
break;
|
||||
case kDiscontinuous:
|
||||
case GradientType::DISCONTINUOUS:
|
||||
ledsPerSegment = (bufLen - 1) / (numSegments - 1);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -341,19 +341,19 @@ class LEDPattern {
|
||||
std::initializer_list<std::pair<double, wpi::util::Color>> steps);
|
||||
|
||||
/** Types of gradients. */
|
||||
enum GradientType {
|
||||
enum class GradientType {
|
||||
/**
|
||||
* 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
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,7 +50,7 @@ TEST(LEDPatternTest, SolidColor) {
|
||||
TEST(LEDPatternTest, EmptyGradientSetsToBlack) {
|
||||
std::array<wpi::util::Color, 0> colors;
|
||||
LEDPattern pattern =
|
||||
LEDPattern::Gradient(LEDPattern::GradientType::kContinuous, colors);
|
||||
LEDPattern::Gradient(LEDPattern::GradientType::CONTINUOUS, colors);
|
||||
std::array<AddressableLED::LEDData, 5> buffer;
|
||||
pattern.ApplyTo(buffer);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
@@ -61,7 +61,7 @@ TEST(LEDPatternTest, EmptyGradientSetsToBlack) {
|
||||
TEST(LEDPatternTest, SingleColorGradientSetsSolid) {
|
||||
std::array<wpi::util::Color, 1> colors{wpi::util::Color::YELLOW};
|
||||
LEDPattern pattern =
|
||||
LEDPattern::Gradient(LEDPattern::GradientType::kContinuous, colors);
|
||||
LEDPattern::Gradient(LEDPattern::GradientType::CONTINUOUS, colors);
|
||||
std::array<AddressableLED::LEDData, 5> buffer;
|
||||
pattern.ApplyTo(buffer);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
@@ -73,7 +73,7 @@ TEST(LEDPatternTest, Gradient2Colors) {
|
||||
std::array<wpi::util::Color, 2> colors{wpi::util::Color::YELLOW,
|
||||
wpi::util::Color::PURPLE};
|
||||
LEDPattern pattern =
|
||||
LEDPattern::Gradient(LEDPattern::GradientType::kContinuous, colors);
|
||||
LEDPattern::Gradient(LEDPattern::GradientType::CONTINUOUS, colors);
|
||||
std::array<AddressableLED::LEDData, 99> buffer;
|
||||
pattern.ApplyTo(buffer);
|
||||
AssertIndexColor(buffer, 0, wpi::util::Color::YELLOW);
|
||||
@@ -91,7 +91,7 @@ TEST(LEDPatternTest, DiscontinuousGradient2Colors) {
|
||||
std::array<wpi::util::Color, 2> colors{wpi::util::Color::YELLOW,
|
||||
wpi::util::Color::PURPLE};
|
||||
LEDPattern pattern =
|
||||
LEDPattern::Gradient(LEDPattern::GradientType::kDiscontinuous, colors);
|
||||
LEDPattern::Gradient(LEDPattern::GradientType::DISCONTINUOUS, colors);
|
||||
std::array<AddressableLED::LEDData, 99> buffer;
|
||||
pattern.ApplyTo(buffer);
|
||||
AssertIndexColor(buffer, 0, wpi::util::Color::YELLOW);
|
||||
@@ -106,7 +106,7 @@ TEST(LEDPatternTest, Gradient3Colors) {
|
||||
wpi::util::Color::PURPLE,
|
||||
wpi::util::Color::WHITE};
|
||||
LEDPattern pattern =
|
||||
LEDPattern::Gradient(LEDPattern::GradientType::kContinuous, colors);
|
||||
LEDPattern::Gradient(LEDPattern::GradientType::CONTINUOUS, colors);
|
||||
std::array<AddressableLED::LEDData, 99> buffer;
|
||||
pattern.ApplyTo(buffer);
|
||||
|
||||
@@ -132,7 +132,7 @@ TEST(LEDPatternTest, DiscontinuousGradient3Colors) {
|
||||
wpi::util::Color::PURPLE,
|
||||
wpi::util::Color::WHITE};
|
||||
LEDPattern pattern =
|
||||
LEDPattern::Gradient(LEDPattern::GradientType::kDiscontinuous, colors);
|
||||
LEDPattern::Gradient(LEDPattern::GradientType::DISCONTINUOUS, colors);
|
||||
std::array<AddressableLED::LEDData, 101> buffer;
|
||||
pattern.ApplyTo(buffer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user