Skip to content

Commit

Permalink
Made LEDs not keep sending commands if its a repeat color
Browse files Browse the repository at this point in the history
  • Loading branch information
BrodyKarr committed Mar 16, 2024
1 parent 3b193af commit 6772023
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ public class RobotContainer implements Logged {
int[] rotationColor;
int[] XTranslationColor;
int[] YTranslationColor;

int[] previousRotationColor;
int[] previousXTranslationColor;
int[] previousYTranslationColor;
// Poses
@Log.NT
static Pose3d currentRobotPose;
Expand Down Expand Up @@ -402,17 +404,24 @@ public void setAutoPlacementLEDs(Optional<Alliance> alliance) {
subLEDs.setAnimationChunk(8, constLEDs.LED_NUMBER - 8, constLEDs.AUTO_ALIGNED_COLOR);

} else {
subLEDs.setIndividualLED(rotationColor, 0);
subLEDs.setIndividualLED(rotationColor, 3);
subLEDs.setIndividualLED(rotationColor, 4);
subLEDs.setIndividualLED(rotationColor, 7);

subLEDs.setIndividualLED(XTranslationColor, 1);
subLEDs.setIndividualLED(XTranslationColor, 2);

subLEDs.setIndividualLED(YTranslationColor, 5);
subLEDs.setIndividualLED(YTranslationColor, 6);
subLEDs.clearAnimationChunk(8, constLEDs.LED_NUMBER - 8);
if (previousRotationColor != rotationColor) {
subLEDs.setIndividualLED(rotationColor, 0);
subLEDs.setIndividualLED(rotationColor, 3);
subLEDs.setIndividualLED(rotationColor, 4);
subLEDs.setIndividualLED(rotationColor, 7);
previousRotationColor = rotationColor;
}
if (previousXTranslationColor != XTranslationColor) {
subLEDs.setIndividualLED(XTranslationColor, 1);
subLEDs.setIndividualLED(XTranslationColor, 2);
previousXTranslationColor = XTranslationColor;
}
if (previousYTranslationColor != YTranslationColor) {
subLEDs.setIndividualLED(YTranslationColor, 5);
subLEDs.setIndividualLED(YTranslationColor, 6);
subLEDs.clearAnimationChunk(8, constLEDs.LED_NUMBER - 8);
previousYTranslationColor = YTranslationColor;
}
}
}

Expand Down

0 comments on commit 6772023

Please sign in to comment.