diff --git a/src/main/java/frc/robot/status/actions/PowerUpAction.java b/src/main/java/frc/robot/status/actions/PowerUpAction.java index 8b67d3a..d6ba70d 100644 --- a/src/main/java/frc/robot/status/actions/PowerUpAction.java +++ b/src/main/java/frc/robot/status/actions/PowerUpAction.java @@ -7,6 +7,9 @@ package frc.robot.status.actions; +import edu.wpi.first.wpilibj.util.Color; +import edu.wpi.first.wpilibj.util.Color8Bit; + public class PowerUpAction extends LedAction { // State @@ -17,7 +20,7 @@ public class PowerUpAction extends LedAction { private int blue = 0; private int brightness = 0; - // Default will run a rainbow pattern. + // Default will run a red pattern. public PowerUpAction() { super(); @@ -29,6 +32,33 @@ public PowerUpAction() { intervalTime = 0.010; } + /** + * PowerUp animation using a Color + * + * @param color + * @param brightness 0.0 to 1.0 + */ + public PowerUpAction(Color color, double brightness) { + int intBrightness = 0; + if (0.0 > brightness) { + intBrightness = 0; + } if (1.0 < brightness) { + intBrightness = 255; + } else { + intBrightness = (int) (255 * brightness); + } + Color8Bit intColor = new Color8Bit(color); + + this.brightness = intBrightness; + this.red = intColor.red; + this.green = intColor.green; + this.blue = intColor.blue; + + // Run forever, 10ms + intervalCount = -1; + intervalTime = 0.010; + } + public PowerUpAction(int red, int green, int blue, int brightness) { super(); diff --git a/src/main/java/frc/robot/status/actions/ScannerAction.java b/src/main/java/frc/robot/status/actions/ScannerAction.java index 03f08d7..6d4a2fc 100644 --- a/src/main/java/frc/robot/status/actions/ScannerAction.java +++ b/src/main/java/frc/robot/status/actions/ScannerAction.java @@ -19,7 +19,7 @@ public class ScannerAction extends LedAction { private int blue = 0; private int brightness = 0; - // Default will run a rainbow pattern. + // Default will run a red pattern. public ScannerAction() { super();