diff --git a/wpilibc/src/main/native/cpp/LEDPattern.cpp b/wpilibc/src/main/native/cpp/LEDPattern.cpp index 363bd545fe..7f1dd6c6b1 100644 --- a/wpilibc/src/main/native/cpp/LEDPattern.cpp +++ b/wpilibc/src/main/native/cpp/LEDPattern.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -21,7 +22,9 @@ using namespace frc; LEDPattern::LEDPattern(std::function)> impl) - : m_impl(std::move(impl)) {} + : m_impl(std::move(impl)) { + HAL_Report(HALUsageReporting::kResourceType_LEDPattern, 1); +} void LEDPattern::ApplyTo(LEDPattern::LEDReader reader, std::function writer) const { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/LEDPattern.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/LEDPattern.java index 902a54c031..67f135319e 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/LEDPattern.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/LEDPattern.java @@ -9,6 +9,8 @@ import static edu.wpi.first.units.Units.Microsecond; import static edu.wpi.first.units.Units.Microseconds; import static edu.wpi.first.units.Units.Value; +import edu.wpi.first.hal.FRCNetComm.tResourceType; +import edu.wpi.first.hal.HAL; import edu.wpi.first.math.MathUtil; import edu.wpi.first.units.collections.LongToObjectHashMap; import edu.wpi.first.units.measure.Dimensionless; @@ -149,6 +151,7 @@ public interface LEDPattern { * @return the mapped pattern */ default LEDPattern mapIndex(IndexMapper indexMapper) { + HAL.report(tResourceType.kResourceType_LEDPattern, 1); return (reader, writer) -> { int bufLen = reader.getLength(); applyTo( @@ -294,6 +297,7 @@ public interface LEDPattern { final long totalTimeMicros = (long) (onTime.in(Microseconds) + offTime.in(Microseconds)); final long onTimeMicros = (long) onTime.in(Microseconds); + HAL.report(tResourceType.kResourceType_LEDPattern, 1); return (reader, writer) -> { if (RobotController.getTime() % totalTimeMicros < onTimeMicros) { applyTo(reader, writer); @@ -323,6 +327,7 @@ public interface LEDPattern { * @return the blinking pattern */ default LEDPattern synchronizedBlink(BooleanSupplier signal) { + HAL.report(tResourceType.kResourceType_LEDPattern, 1); return (reader, writer) -> { if (signal.getAsBoolean()) { applyTo(reader, writer); @@ -342,6 +347,7 @@ public interface LEDPattern { default LEDPattern breathe(Time period) { final long periodMicros = (long) period.in(Microseconds); + HAL.report(tResourceType.kResourceType_LEDPattern, 1); return (reader, writer) -> { applyTo( reader, @@ -373,6 +379,7 @@ public interface LEDPattern { * @return the combined overlay pattern */ default LEDPattern overlayOn(LEDPattern base) { + HAL.report(tResourceType.kResourceType_LEDPattern, 1); return (reader, writer) -> { // write the base pattern down first... base.applyTo(reader, writer); @@ -400,6 +407,7 @@ public interface LEDPattern { * @return the blended pattern */ default LEDPattern blend(LEDPattern other) { + HAL.report(tResourceType.kResourceType_LEDPattern, 1); return (reader, writer) -> { applyTo(reader, writer); @@ -431,6 +439,7 @@ public interface LEDPattern { * @return the masked pattern */ default LEDPattern mask(LEDPattern mask) { + HAL.report(tResourceType.kResourceType_LEDPattern, 1); return (reader, writer) -> { // Apply the current pattern down as normal... applyTo(reader, writer); @@ -470,6 +479,7 @@ public interface LEDPattern { default LEDPattern atBrightness(Dimensionless relativeBrightness) { double multiplier = relativeBrightness.in(Value); + HAL.report(tResourceType.kResourceType_LEDPattern, 1); return (reader, writer) -> { applyTo( reader, @@ -496,6 +506,7 @@ public interface LEDPattern { * @return the pattern */ static LEDPattern solid(Color color) { + HAL.report(tResourceType.kResourceType_LEDPattern, 1); return (reader, writer) -> { int bufLen = reader.getLength(); for (int led = 0; led < bufLen; led++) { @@ -525,6 +536,7 @@ public interface LEDPattern { * @return the mask pattern */ static LEDPattern progressMaskLayer(DoubleSupplier progressSupplier) { + HAL.report(tResourceType.kResourceType_LEDPattern, 1); return (reader, writer) -> { double progress = MathUtil.clamp(progressSupplier.getAsDouble(), 0, 1); @@ -561,6 +573,7 @@ public interface LEDPattern { * @return a motionless step pattern */ static LEDPattern steps(Map steps) { + HAL.report(tResourceType.kResourceType_LEDPattern, 1); if (steps.isEmpty()) { // no colors specified DriverStation.reportWarning("Creating LED steps with no colors!", false); @@ -622,6 +635,7 @@ public interface LEDPattern { * @return a motionless gradient pattern */ static LEDPattern gradient(GradientType type, Color... colors) { + HAL.report(tResourceType.kResourceType_LEDPattern, 1); if (colors.length == 0) { // Nothing to display DriverStation.reportWarning("Creating a gradient with no colors!", false); @@ -679,6 +693,7 @@ public interface LEDPattern { * @return the rainbow pattern */ static LEDPattern rainbow(int saturation, int value) { + HAL.report(tResourceType.kResourceType_LEDPattern, 1); return (reader, writer) -> { int bufLen = reader.getLength(); for (int i = 0; i < bufLen; i++) {