Skip to content

Commit

Permalink
Move constants and make the disable lights run
Browse files Browse the repository at this point in the history
  • Loading branch information
quackitsquinn committed Mar 22, 2024
1 parent d8a707a commit 4446c25
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
13 changes: 7 additions & 6 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,14 @@ public static class Camera {
/** The constants for the light strips */
public static class LightStrips {
/** The PWM ID for the underglow light strip */
public static final int UNDERGLOW_PWM_ID = 0;
public static final int UNDERGLOW_PWM_ID = 8;

/** The count of leds for the underglow light strip. */
public static final int UNDERGLOW_LED_COUNT = 60;
/** The count of LEDs for the underglow light strip. */
public static final int UNDERGLOW_LED_COUNT = 66;

/** The color for the lights when the robot is disabled. */
public static final Color DISABLED_COLOR =
new Color(255, 225, 0); // TODO: start using Color.fromHSV so tweaking is easier
public static final class Colors {
/** The color for the lights when the robot is disabled. */
public static final Color DISABLED_COLOR = Color.fromHSV(30, 255, 200);
}
}
}
10 changes: 7 additions & 3 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,19 @@ public void robotPeriodic() {

@Override
public void disabledInit() {
CommandScheduler.getInstance().schedule(RobotContainer.disabledLights);
// HACK: Because the command scheduler doesn't run in disabled, we have to manually schedule
// disabledLights.
RobotContainer.disabledLights.initialize();
}

@Override
public void disabledPeriodic() {}
public void disabledPeriodic() {
RobotContainer.disabledLights.execute();
}

@Override
public void disabledExit() {
CommandScheduler.getInstance().cancel(RobotContainer.disabledLights);
RobotContainer.disabledLights.end(true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ public RobotDisabledLights() {
// Called when the command is initially scheduled.
@Override
public void initialize() {
robotLights.setStripColor(Constants.LightStrips.DISABLED_COLOR);
robotLights.setStripColor(Constants.LightStrips.Colors.DISABLED_COLOR);
robotLights.flush();
robotLights.startLights();
}

// Called every time the scheduler runs while the command is scheduled.
Expand All @@ -45,6 +46,7 @@ public void end(boolean interrupted) {
// Signal that the next run of this command should not to the fancy start animation
robotLights.setStripColor(Color.kBlack);
robotLights.flush();
robotLights.stopLights();
isInitial = false;
}

Expand Down

0 comments on commit 4446c25

Please sign in to comment.