Skip to content

Commit

Permalink
led fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
davidchen20 committed Jul 9, 2024
1 parent b1b6e32 commit 4b93dd0
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/main/java/frc/robot/BuildConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ public final class BuildConstants {
public static final String MAVEN_GROUP = "";
public static final String MAVEN_NAME = "2024RobotCode";
public static final String VERSION = "unspecified";
public static final int GIT_REVISION = 283;
public static final String GIT_SHA = "1bbe432c459d5a47ba7632f4ecd21b430021a73d";
public static final String GIT_DATE = "2024-07-08 19:55:42 EDT";
public static final int GIT_REVISION = 284;
public static final String GIT_SHA = "b1b6e3205d31d1312f8405f3bbea5539a3c4c823";
public static final String GIT_DATE = "2024-07-08 23:36:46 EDT";
public static final String GIT_BRANCH = "vision-subsytem";
public static final String BUILD_DATE = "2024-07-08 20:00:53 EDT";
public static final long BUILD_UNIX_TIME = 1720483253403L;
public static final String BUILD_DATE = "2024-07-09 12:42:08 EDT";
public static final long BUILD_UNIX_TIME = 1720543328895L;
public static final int DIRTY = 1;

private BuildConstants() {}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static Mode getMode() {
};
}

public static final Mode currentMode = Mode.REAL;
public static final Mode currentMode = Mode.SIM;
public static final boolean tuningMode = true;
public static final String CANBUS = "CAN Bus 2";
public static final double LOOP_PERIOD_SECS = 0.02;
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import frc.robot.subsystems.led.LED;
import frc.robot.subsystems.led.LED_IO;
import frc.robot.subsystems.led.LED_IOCANdle;
import frc.robot.subsystems.led.LED_IOSim;
import frc.robot.subsystems.pivot.Pivot;
import frc.robot.subsystems.pivot.PivotIO;
import frc.robot.subsystems.pivot.PivotIOSim;
Expand Down Expand Up @@ -223,7 +224,7 @@ public RobotContainer() {
new LeafBlowerIO() {});
elevator = new Elevator(new ElevatorIOSim());
pivot = new Pivot(new PivotIOSim());
led = new LED(new LED_IO() {});
led = new LED(new LED_IOSim());
break;

default:
Expand Down Expand Up @@ -725,7 +726,7 @@ private void driverControls() {
() -> -driveController.getLeftX(),
() -> -driveController.getRightX(),
() -> false,
() -> false)));
manipLeftBumper)));

driveRightBumper.onFalse(
new InstantCommand(() -> led.setState(LED_STATE.BLUE))
Expand Down Expand Up @@ -766,7 +767,7 @@ private void driverControls() {
() -> -driveController.getLeftY(),
() -> -driveController.getLeftX(),
() -> -driveController.getRightX(),
driveLeftBumper,
() -> true,
manipLeftBumper)));
driveLeftBumper.onFalse(
new InstantCommand(() -> led.setState(LED_STATE.BLUE))
Expand Down
37 changes: 37 additions & 0 deletions src/main/java/frc/robot/subsystems/LED/LED_IOSim.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package frc.robot.subsystems.led;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import frc.robot.Constants;
import frc.robot.Constants.LED_STATE;

public class LED_IOSim implements LED_IO {
LED_STATE ledState;

public LED_IOSim() {
ledState = Constants.LED_STATE.BLUE;
setLEDState(ledState);
}

@Override
public void updateInputs(LED_IOInputs inputs) {
inputs.ledState = ledState;
}

@Override
public void noBumpersPressed() {
if (DriverStation.getAlliance().get() == Alliance.Blue) {
setLEDState(LED_STATE.BLUE);
// led.set(Constants.LEDConstants.COLOR_BLUE);

} else {
setLEDState(LED_STATE.RED);
// led.set(Constants.LEDConstants.COLOR_RED);
}
}

@Override
public void setLEDState(LED_STATE state) {
ledState = state;
}
}

0 comments on commit 4b93dd0

Please sign in to comment.