mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[commands] Refactor lambda-based commands to inherit FunctionalCommand (#4451)
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
|
||||
#include <wpi/span.h>
|
||||
|
||||
#include "frc2/command/CommandBase.h"
|
||||
#include "frc2/command/CommandHelper.h"
|
||||
#include "frc2/command/FunctionalCommand.h"
|
||||
|
||||
namespace frc2 {
|
||||
/**
|
||||
@@ -22,7 +22,8 @@ namespace frc2 {
|
||||
*
|
||||
* This class is provided by the NewCommands VendorDep
|
||||
*/
|
||||
class StartEndCommand : public CommandHelper<CommandBase, StartEndCommand> {
|
||||
class StartEndCommand
|
||||
: public CommandHelper<FunctionalCommand, StartEndCommand> {
|
||||
public:
|
||||
/**
|
||||
* Creates a new StartEndCommand. Will run the given runnables when the
|
||||
@@ -48,14 +49,6 @@ class StartEndCommand : public CommandHelper<CommandBase, StartEndCommand> {
|
||||
|
||||
StartEndCommand(StartEndCommand&& other) = default;
|
||||
|
||||
StartEndCommand(const StartEndCommand& other);
|
||||
|
||||
void Initialize() override;
|
||||
|
||||
void End(bool interrupted) override;
|
||||
|
||||
protected:
|
||||
std::function<void()> m_onInit;
|
||||
std::function<void()> m_onEnd;
|
||||
StartEndCommand(const StartEndCommand& other) = default;
|
||||
};
|
||||
} // namespace frc2
|
||||
|
||||
Reference in New Issue
Block a user