mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
Merge branch 'main' into 2027
This commit is contained in:
@@ -14,6 +14,7 @@ import java.util.Objects;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.DoubleSupplier;
|
||||
import org.wpilib.driverstation.DriverStation;
|
||||
import org.wpilib.hardware.hal.HAL;
|
||||
import org.wpilib.system.RobotController;
|
||||
import org.wpilib.units.collections.LongToObjectHashMap;
|
||||
import org.wpilib.units.measure.Dimensionless;
|
||||
@@ -150,6 +151,7 @@ public interface LEDPattern {
|
||||
* @return the mapped pattern
|
||||
*/
|
||||
default LEDPattern mapIndex(IndexMapper indexMapper) {
|
||||
HAL.reportUsage("LEDPattern", "");
|
||||
return (reader, writer) -> {
|
||||
int bufLen = reader.getLength();
|
||||
applyTo(
|
||||
@@ -295,6 +297,7 @@ public interface LEDPattern {
|
||||
final long totalTimeMicros = (long) (onTime.in(Microseconds) + offTime.in(Microseconds));
|
||||
final long onTimeMicros = (long) onTime.in(Microseconds);
|
||||
|
||||
HAL.reportUsage("LEDPattern", "");
|
||||
return (reader, writer) -> {
|
||||
if (RobotController.getTime() % totalTimeMicros < onTimeMicros) {
|
||||
applyTo(reader, writer);
|
||||
@@ -324,6 +327,7 @@ public interface LEDPattern {
|
||||
* @return the blinking pattern
|
||||
*/
|
||||
default LEDPattern synchronizedBlink(BooleanSupplier signal) {
|
||||
HAL.reportUsage("LEDPattern", "");
|
||||
return (reader, writer) -> {
|
||||
if (signal.getAsBoolean()) {
|
||||
applyTo(reader, writer);
|
||||
@@ -343,6 +347,7 @@ public interface LEDPattern {
|
||||
default LEDPattern breathe(Time period) {
|
||||
final long periodMicros = (long) period.in(Microseconds);
|
||||
|
||||
HAL.reportUsage("LEDPattern", "");
|
||||
return (reader, writer) -> {
|
||||
applyTo(
|
||||
reader,
|
||||
@@ -374,6 +379,7 @@ public interface LEDPattern {
|
||||
* @return the combined overlay pattern
|
||||
*/
|
||||
default LEDPattern overlayOn(LEDPattern base) {
|
||||
HAL.reportUsage("LEDPattern", "");
|
||||
return (reader, writer) -> {
|
||||
// write the base pattern down first...
|
||||
base.applyTo(reader, writer);
|
||||
@@ -401,6 +407,7 @@ public interface LEDPattern {
|
||||
* @return the blended pattern
|
||||
*/
|
||||
default LEDPattern blend(LEDPattern other) {
|
||||
HAL.reportUsage("LEDPattern", "");
|
||||
return (reader, writer) -> {
|
||||
applyTo(reader, writer);
|
||||
|
||||
@@ -432,6 +439,7 @@ public interface LEDPattern {
|
||||
* @return the masked pattern
|
||||
*/
|
||||
default LEDPattern mask(LEDPattern mask) {
|
||||
HAL.reportUsage("LEDPattern", "");
|
||||
return (reader, writer) -> {
|
||||
// Apply the current pattern down as normal...
|
||||
applyTo(reader, writer);
|
||||
@@ -471,6 +479,7 @@ public interface LEDPattern {
|
||||
default LEDPattern atBrightness(Dimensionless relativeBrightness) {
|
||||
double multiplier = relativeBrightness.in(Value);
|
||||
|
||||
HAL.reportUsage("LEDPattern", "");
|
||||
return (reader, writer) -> {
|
||||
applyTo(
|
||||
reader,
|
||||
@@ -497,6 +506,7 @@ public interface LEDPattern {
|
||||
* @return the pattern
|
||||
*/
|
||||
static LEDPattern solid(Color color) {
|
||||
HAL.reportUsage("LEDPattern", "");
|
||||
return (reader, writer) -> {
|
||||
int bufLen = reader.getLength();
|
||||
for (int led = 0; led < bufLen; led++) {
|
||||
@@ -526,6 +536,7 @@ public interface LEDPattern {
|
||||
* @return the mask pattern
|
||||
*/
|
||||
static LEDPattern progressMaskLayer(DoubleSupplier progressSupplier) {
|
||||
HAL.reportUsage("LEDPattern", "");
|
||||
return (reader, writer) -> {
|
||||
double progress = Math.clamp(progressSupplier.getAsDouble(), 0, 1);
|
||||
|
||||
@@ -562,6 +573,7 @@ public interface LEDPattern {
|
||||
* @return a motionless step pattern
|
||||
*/
|
||||
static LEDPattern steps(Map<? extends Number, Color> steps) {
|
||||
HAL.reportUsage("LEDPattern", "");
|
||||
if (steps.isEmpty()) {
|
||||
// no colors specified
|
||||
DriverStation.reportWarning("Creating LED steps with no colors!", false);
|
||||
@@ -623,6 +635,7 @@ public interface LEDPattern {
|
||||
* @return a motionless gradient pattern
|
||||
*/
|
||||
static LEDPattern gradient(GradientType type, Color... colors) {
|
||||
HAL.reportUsage("LEDPattern", "");
|
||||
if (colors.length == 0) {
|
||||
// Nothing to display
|
||||
DriverStation.reportWarning("Creating a gradient with no colors!", false);
|
||||
@@ -680,6 +693,7 @@ public interface LEDPattern {
|
||||
* @return the rainbow pattern
|
||||
*/
|
||||
static LEDPattern rainbow(int saturation, int value) {
|
||||
HAL.reportUsage("LEDPattern", "");
|
||||
return (reader, writer) -> {
|
||||
int bufLen = reader.getLength();
|
||||
for (int i = 0; i < bufLen; i++) {
|
||||
|
||||
Reference in New Issue
Block a user