Skip to content

Commit 9470efa

Browse files
committed
Instantiate ImageAction at start up rather than at use. Attempt to eliminate odd pause at 20 seconds.
1 parent 8b6bb38 commit 9470efa

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/main/java/frc/robot/Robot.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class Robot extends TimedRobot {
3939

4040
private static final int NUM_LOOPS = 40;
4141
private int delay = NUM_LOOPS;
42+
private IdleCommand idleCommand = new IdleCommand();
4243

4344
/**
4445
* This function is run when the robot is first started up and should be used
@@ -153,7 +154,7 @@ public void autonomousPeriodic() {
153154
public void teleopInit() {
154155

155156
Status.getInstance().setTeleopStartTime();
156-
new SetColor(Status.getInstance(), Color.kBlack).andThen(new IdleCommand()).schedule();
157+
new SetColor(Status.getInstance(), Color.kBlack).andThen(idleCommand).schedule();
157158

158159
// new SetColor(Status.getInstance(), Color.kDarkOrchid).schedule();
159160
// new ActionCommand(new ScannerAction(245, 0, 255, 200)).schedule();

src/main/java/frc/robot/status/commands/IdleCommand.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public class IdleCommand extends CommandBase {
2828
private Status status;
2929
private boolean actionSet;
3030
private int phase = 0;
31+
private Action twentySecondsAction = new ImageAction("yellow_stripes.png",0.05);
32+
private Action tenSecondsAction = new ImageAction("noise.png",0.15);
3133

3234
public IdleCommand() {
3335
this.status = Status.getInstance();
@@ -63,13 +65,13 @@ Do some gymnastics to try to generate an elapsed time from getMatchTime().
6365
Action action = scannerAction;
6466
// new PrintCommand("Time Left = " + String.valueOf(timeElapsed)).schedule();
6567
if ( 115.0 < timeElapsed && (0 == phase)) { // 20 Seconds left
66-
action = new ImageAction("yellow_stripes.png",0.05);
68+
action = twentySecondsAction;
6769
phase = 1;
6870
actionSet = false;
6971
}
7072

7173
if (125.0 < timeElapsed && 1 == phase) { // Last 10 seconds
72-
action = new ImageAction("noise.png",0.15);
74+
action = tenSecondsAction;
7375
phase = 2;
7476
actionSet = false;
7577
}

0 commit comments

Comments
 (0)