From 0c99ec8ab3922bc1025187bfee9e8f02696751d5 Mon Sep 17 00:00:00 2001 From: David Tian Date: Sun, 22 Sep 2024 14:53:09 -0700 Subject: [PATCH] better solution --- src/main/java/com/team841/calliope/RobotContainer.java | 2 +- .../team841/calliope/superstructure/lights/LED.java | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/team841/calliope/RobotContainer.java b/src/main/java/com/team841/calliope/RobotContainer.java index 20ef2fa..b5c478a 100644 --- a/src/main/java/com/team841/calliope/RobotContainer.java +++ b/src/main/java/com/team841/calliope/RobotContainer.java @@ -94,7 +94,7 @@ public RobotContainer() { this.hanger = new Hanger(this.hangerIO); this.ledIO = new LEDIOSpark(); - this.led = new LED(this.ledIO); + this.led = new LED(this.ledIO, this.indexer, this.intake); } } diff --git a/src/main/java/com/team841/calliope/superstructure/lights/LED.java b/src/main/java/com/team841/calliope/superstructure/lights/LED.java index b7f1405..fb7dd6d 100644 --- a/src/main/java/com/team841/calliope/superstructure/lights/LED.java +++ b/src/main/java/com/team841/calliope/superstructure/lights/LED.java @@ -19,8 +19,10 @@ public class LED extends SubsystemBase { private int count = 0; /** Creates a new LED. */ - public LED(LEDIO io) { + public LED(LEDIO io, Indexer indexer, Intake intake) { this.io = io; + this.indexer = indexer; + this.intake = intake; } @Override @@ -28,12 +30,6 @@ public void periodic() { io.updateInputs(inputs); Logger.processInputs("LED", inputs); - if (this.indexer == null) - this.indexer = Robot.m_robotContainer.indexer; - if (this.intake == null) - this.intake = Robot.m_robotContainer.intake; - - // if (intake.) if (indexer.getRightIndexerSensor() && indexer.getLeftIndexerSensor()) { io.setColor("Green"); if (count == 0) count += 1;