Skip to content

Commit

Permalink
A few tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasenj1 committed Feb 22, 2022
1 parent 5ed16ca commit 9f3deac
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
32 changes: 31 additions & 1 deletion src/main/java/frc/robot/status/actions/PowerUpAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();

Expand All @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/status/actions/ScannerAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 9f3deac

Please sign in to comment.