mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
SCRIPT namespace replacements
This commit is contained in:
committed by
Peter Johnson
parent
ae6c043632
commit
9aca8e0fd6
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/MathExtras.hpp"
|
||||
#include "wpi/util/timestamp.h"
|
||||
|
||||
namespace frc {
|
||||
namespace wpi {
|
||||
|
||||
static LEDPattern whiteYellowPurple{[](auto data, auto writer) {
|
||||
for (size_t led = 0; led < data.size(); led++) {
|
||||
@@ -187,7 +187,7 @@ TEST(LEDPatternTest, ScrollRelativeForward) {
|
||||
|
||||
// Scrolling at 1/256th of the buffer per second,
|
||||
// or 1 individual diode per second
|
||||
auto scroll = pattern.ScrollAtRelativeSpeed(units::hertz_t{1 / 256.0});
|
||||
auto scroll = pattern.ScrollAtRelativeSpeed(wpi::units::hertz_t{1 / 256.0});
|
||||
|
||||
static uint64_t now = 0ull;
|
||||
WPI_SetNowImpl([] { return now; });
|
||||
@@ -210,7 +210,7 @@ TEST(LEDPatternTest, ScrollRelativeForward) {
|
||||
// t=2, channel value = (254, 255, 0, ..., 252, 253)
|
||||
// t=255, channel value = (1, 2, 3, ..., 255, 0)
|
||||
// t=256, channel value = (0, 1, 2, ..., 254, 255)
|
||||
int ch = frc::FloorMod(static_cast<int>(led - time), 256);
|
||||
int ch = wpi::math::FloorMod(static_cast<int>(led - time), 256);
|
||||
AssertIndexColor(buffer, led, Color{ch, ch, ch});
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ TEST(LEDPatternTest, ScrollRelativeBackward) {
|
||||
|
||||
// Scrolling at 1/256th of the buffer per second,
|
||||
// or 1 individual diode per second
|
||||
auto scroll = pattern.ScrollAtRelativeSpeed(units::hertz_t{-1 / 256.0});
|
||||
auto scroll = pattern.ScrollAtRelativeSpeed(wpi::units::hertz_t{-1 / 256.0});
|
||||
|
||||
static uint64_t now = 0ull;
|
||||
WPI_SetNowImpl([] { return now; });
|
||||
@@ -253,7 +253,7 @@ TEST(LEDPatternTest, ScrollRelativeBackward) {
|
||||
// t=2, channel value = (254, 255, 0, ..., 252, 253)
|
||||
// t=255, channel value = (1, 2, 3, ..., 255, 0)
|
||||
// t=256, channel value = (0, 1, 2, ..., 254, 255)
|
||||
int ch = frc::FloorMod(static_cast<int>(led + time), 256);
|
||||
int ch = wpi::math::FloorMod(static_cast<int>(led + time), 256);
|
||||
AssertIndexColor(buffer, led, Color{ch, ch, ch});
|
||||
}
|
||||
}
|
||||
@@ -297,7 +297,7 @@ TEST(LEDPatternTest, ScrollAbsoluteForward) {
|
||||
// t=2, channel value = (254, 255, 0, ..., 252, 253)
|
||||
// t=255, channel value = (1, 2, 3, ..., 255, 0)
|
||||
// t=256, channel value = (0, 1, 2, ..., 254, 255)
|
||||
int ch = frc::FloorMod(static_cast<int>(led - time), 256);
|
||||
int ch = wpi::math::FloorMod(static_cast<int>(led - time), 256);
|
||||
AssertIndexColor(buffer, led, Color{ch, ch, ch});
|
||||
}
|
||||
}
|
||||
@@ -341,7 +341,7 @@ TEST(LEDPatternTest, ScrollAbsoluteBackward) {
|
||||
// t=2, channel value = (254, 255, 0, ..., 252, 253)
|
||||
// t=255, channel value = (1, 2, 3, ..., 255, 0)
|
||||
// t=256, channel value = (0, 1, 2, ..., 254, 255)
|
||||
int ch = frc::FloorMod(static_cast<int>(led + time), 256);
|
||||
int ch = wpi::math::FloorMod(static_cast<int>(led + time), 256);
|
||||
AssertIndexColor(buffer, led, Color{ch, ch, ch});
|
||||
}
|
||||
}
|
||||
@@ -874,7 +874,7 @@ TEST(LEDPatternTest, RelativeScrollingMask) {
|
||||
|
||||
auto pattern = LEDPattern::Steps(colorSteps)
|
||||
.Mask(LEDPattern::Steps(maskSteps))
|
||||
.ScrollAtRelativeSpeed(units::hertz_t{1e6 / 8.0});
|
||||
.ScrollAtRelativeSpeed(wpi::units::hertz_t{1e6 / 8.0});
|
||||
|
||||
pattern.ApplyTo(buffer);
|
||||
|
||||
@@ -1029,7 +1029,7 @@ TEST(LEDPatternTest, AbsoluteScrollingMask) {
|
||||
|
||||
void AssertIndexColor(std::span<AddressableLED::LEDData> data, int index,
|
||||
Color color) {
|
||||
frc::Color8Bit color8bit{color};
|
||||
wpi::Color8Bit color8bit{color};
|
||||
|
||||
EXPECT_EQ(color8bit.red, data[index].r & 0xFF);
|
||||
EXPECT_EQ(color8bit.green, data[index].g & 0xFF);
|
||||
@@ -1037,7 +1037,7 @@ void AssertIndexColor(std::span<AddressableLED::LEDData> data, int index,
|
||||
}
|
||||
|
||||
Color LerpColors(Color a, Color b, double t) {
|
||||
return Color{wpi::Lerp(a.red, b.red, t), wpi::Lerp(a.green, b.green, t),
|
||||
wpi::Lerp(a.blue, b.blue, t)};
|
||||
return Color{wpi::util::Lerp(a.red, b.red, t), wpi::util::Lerp(a.green, b.green, t),
|
||||
wpi::util::Lerp(a.blue, b.blue, t)};
|
||||
}
|
||||
} // namespace frc
|
||||
} // namespace wpi
|
||||
|
||||
Reference in New Issue
Block a user