Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
led changes
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalSkylake committed Mar 6, 2024
1 parent d1801ba commit 24b18e9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 277 deletions.
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import frc.robot.hid.OperatorStick;
import frc.robot.subsystems.Arm;
import frc.robot.subsystems.Intake;
import frc.robot.subsystems.OldLEDStrip;
import frc.robot.subsystems.LEDStrip;
import frc.robot.subsystems.Shooter;
import frc.robot.subsystems.Arm.ArmState;
import frc.robot.subsystems.Intake.IntakeState;
Expand Down Expand Up @@ -112,7 +112,7 @@ public static double getRobotRoll() {
public static final Shooter shooter = new Shooter();
public static final Arm arm = new Arm();
// public static final NewLEDStrip ledStrip = new NewLEDStrip();
public static final OldLEDStrip leds = new OldLEDStrip();
public static final LEDStrip leds = new LEDStrip();

// Cameras
public static final NoteDetectorCamera intakeCamera = new NoteDetectorCamera("NoteCamera",
Expand Down
81 changes: 0 additions & 81 deletions src/main/java/frc/robot/commands/leds/LEDDisabled.java

This file was deleted.

75 changes: 0 additions & 75 deletions src/main/java/frc/robot/commands/leds/LEDShoot.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import frc.robot.RobotMap;
import frc.robot.subsystems.Arm.ArmState;

public class OldLEDStrip {
public class LEDStrip {
Thread t;
AddressableLED strip;
AddressableLED strip2;
Expand All @@ -31,7 +31,7 @@ public class OldLEDStrip {
float currentPosition = 0f;
Color[] pixelArray;

public OldLEDStrip() {
public LEDStrip() {
pixelArray = new Color[Constants.LED_LENGTH];
for (int i = 0; i < pixelArray.length; i++) {
pixelArray[i] = new Color(0);
Expand Down Expand Up @@ -213,7 +213,8 @@ public void runDisabled() {
}
}

// if there is a note flash on and off really fast, if there's not a note run disabled pattern
// if there is a note flash on and off really fast, if there's not a note run
// disabled pattern
public void runIntake() {
ticksPerSecond = 50;
var alliance = DriverStation.getAlliance();
Expand All @@ -228,23 +229,20 @@ public void runIntake() {
}
}
} else {
if (alliance.isPresent()) {
if (alliance.get() == Alliance.Blue) {
runSquareWave(Color.BLUE, -1f, 10f);
} else {
runSquareWave(Color.RED, -1f, 10f);
}
}
runSquareWave(new Color(255, 50, 0), -1f, 16f);
}
}

// if there's a note, run square wave really fast, when the note leaves flash on and off really fast
// if there's a note, just show orange, when the note leaves flash white on
// and off really fast
public void runShoot() {
var atSetpoint = RobotContainer.shooter.isShooterRampedUp(1);
var goodTrajectory = RobotContainer.shooter.goodTrajectory;

if (RobotContainer.shooter.hasNote()) {
runSquareWave(new Color(255, 50, 0), 1f, 8f);
for (int i = 0; i < Constants.LED_LENGTH; i++) {
setRGB(i, 255, 50, 0);
}
} else {
if ((counter / 5) % 2 == 0) {
for (int i = 0; i < Constants.LED_LENGTH; i++) {
Expand All @@ -257,15 +255,16 @@ public void runShoot() {
}
}


}

public void runStowed() {
runDisabled();
for (int i = 0; i < Constants.LED_LENGTH; i++) {
setRGB(i, 255, 50, 0);
}
}

public void runAmp() {
runDisabled();
runShoot();
}

public void runSquareWave(Color c, float speed, float sections) {
Expand All @@ -289,7 +288,6 @@ public void runSquareWave(Color c, float speed, float sections) {
j = 0;
}


setPixelColorHSB(i, hsb[0], hsb[1], j);
}
}
Expand Down Expand Up @@ -335,15 +333,15 @@ private void updateState() {
var isScoringAmp = Math.abs(RobotContainer.arm.getPosition() - ArmState.kAmp.rotations) < 0.02;
var hasIntakeDeployed = RobotContainer.intake.isIntakeDown();

if (isDisabled)
state = LEDState.kDisabled;
else if(isScoringSpeaker)
if (isScoringSpeaker)
state = LEDState.kShoot;
else if(isScoringAmp)
else if (isScoringAmp)
state = LEDState.kAmp;
else if(hasIntakeDeployed)
else if (hasIntakeDeployed)
state = LEDState.kIntake;
else
else if (isDisabled)
state = LEDState.kDisabled;
else
state = LEDState.kStowed;

SmartDashboard.putString("LED State", state.toString());
Expand Down
97 changes: 0 additions & 97 deletions src/main/java/frc/robot/subsystems/NewLEDStrip.java

This file was deleted.

0 comments on commit 24b18e9

Please sign in to comment.