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
18 changes: 12 additions & 6 deletions template-project/src/subsystems/led/led_command.cpp
Original file line number Diff line number Diff line change
@@ -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;}
void LedCommand::end(bool) {}

bool LedCommand::isFinished() const { return false; }
21 changes: 11 additions & 10 deletions template-project/src/subsystems/led/led_command.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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