diff --git a/template-project/src/subsystems/led/led_command.cpp b/template-project/src/subsystems/led/led_command.cpp index ee1d5ad..4e47122 100644 --- a/template-project/src/subsystems/led/led_command.cpp +++ b/template-project/src/subsystems/led/led_command.cpp @@ -1,13 +1,19 @@ #include "led_command.hpp" -LedCommand::LedCommand(src::Drivers * drivers) : drivers(drivers) {} +LedCommand::LedCommand(src::Drivers *drivers) : drivers(drivers) {} -const char *LedCommand::getName() const {return "ledCommand";} +const char *LedCommand::getName() const { return "ledCommand"; } -void LedCommand::initialize(){} +void LedCommand::initialize() {} -void LedCommand::execute(){} +void LedCommand::execute() { + float rightX = drivers->control_interface.chassisXInput(); + float rightY = drivers->control_interface.chassisYInput(); -void LedCommand::end(bool){} + bool turnLEDOn = rightX != 0 || rightY != 0; + drivers->leds.set(drivers->leds.Green, turnLEDOn); +} -bool LedCommand::isFinished() const {return false;} \ No newline at end of file +void LedCommand::end(bool) {} + +bool LedCommand::isFinished() const { return false; } diff --git a/template-project/src/subsystems/led/led_command.hpp b/template-project/src/subsystems/led/led_command.hpp index aed85ba..a2fcb36 100644 --- a/template-project/src/subsystems/led/led_command.hpp +++ b/template-project/src/subsystems/led/led_command.hpp @@ -2,33 +2,34 @@ #define LED_COMMAND_HPP_ #include "tap/control/command.hpp" -#include "drivers.hpp" + #include "controls/standard/control_interface.hpp" + +#include "drivers.hpp" #include "led_subsystem.hpp" -class LedCommand : public tap::control::Command{ +class LedCommand : public tap::control::Command +{ public: - LedCommand(src::Drivers * drivers); + LedCommand(src::Drivers* drivers); ~LedCommand() = default; - const char *getName() const; + const char* getName() const; - //this is called when the Command starts + // this is called when the Command starts void initialize() override; - //this is called continously as long as the Command is running + // this is called continously as long as the Command is running void execute() override; - //this is called when the subsystem ends + // this is called when the subsystem ends void end(bool) override; bool isFinished() const override; - - private: src::Drivers* drivers; -}; //LedCommand +}; // LedCommand #endif \ No newline at end of file