Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/frc/robot/subsystems/elevator/Elevator.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ public void setCurrentMode(GamepieceMode mode) {
_currentMode = mode;
}

public double getElevatorMaxHeight() {
return ELEVATOR_MAX_INCHES;
}

public void populateLog(SysIdRoutineLog log) {
log.motor("elevator_primary")
.voltage(Voltage.ofBaseUnits(_inputs._elevatorMotorVoltage, Volt))
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/frc/robot/subsystems/leds/LEDs.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableInstance;
import edu.wpi.first.wpilibj.util.Color;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.HardwareConstants;
import frc.robot.HardwareConstants.CAN;
import frc.robot.subsystems.elevator.Elevator;

import com.ctre.phoenix.led.RainbowAnimation;
import com.ctre.phoenix.led.StrobeAnimation;
Expand All @@ -20,10 +22,12 @@
public class LEDs extends SubsystemBase {

CANdle _candle = new CANdle(CAN.CANDLE_ID);
static int _numLEDs = 8;
static int _numLEDs = 60; //leds/height * currentheight
boolean _alreadyRunning = false;
LEDAnimation _currentAnimation = LEDAnimation.None;

Elevator _elevator;

public enum LEDAnimation {
None(null, null, 0),

Expand All @@ -43,7 +47,9 @@ public enum LEDAnimation {

SolidTeal(new LEDColor(0, 225, 174), null, 0),

SolidCoral(new LEDColor(255, 80, 15), null, 0);
SolidCoral(new LEDColor(255, 80, 15), null, 0),

SolidRed(new LEDColor(255, 0, 0), null, 0);

LEDColor _color;
Animation _animation;
Expand Down Expand Up @@ -81,6 +87,11 @@ public void runAnimation(LEDAnimation animation) {
_candle.clearAnimation(0);
_candle.setLEDs(0, 0, 0);
_candle.animate(animation.getAnimation());
} else if (animation == LEDAnimation.SolidRed) {
_candle.clearAnimation(0);
LEDColor color = animation.getColor();
_candle.setLEDs(color.getR(), color.getG(), color.getB(),0, 0,
(int) Math.round(_numLEDs/_elevator.getElevatorMaxHeight() * _elevator.getCurrentPosInches()));
} else if (animation.getAnimation() == null) {
LEDColor color = animation.getColor();
_candle.clearAnimation(0);
Expand Down