[commands] Refactor lambda-based commands to inherit FunctionalCommand (#4451)

This commit is contained in:
Starlight220
2022-10-07 01:49:27 +03:00
committed by GitHub
parent b2276e47de
commit 5cf961edb9
9 changed files with 44 additions and 119 deletions

View File

@@ -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 {
/**
@@ -20,7 +20,7 @@ namespace frc2 {
*
* This class is provided by the NewCommands VendorDep
*/
class InstantCommand : public CommandHelper<CommandBase, InstantCommand> {
class InstantCommand : public CommandHelper<FunctionalCommand, InstantCommand> {
public:
/**
* Creates a new InstantCommand that runs the given Runnable with the given
@@ -51,12 +51,5 @@ class InstantCommand : public CommandHelper<CommandBase, InstantCommand> {
* only as a no-arg constructor to call implicitly from subclass constructors.
*/
InstantCommand();
void Initialize() override;
bool IsFinished() final;
private:
std::function<void()> m_toRun;
};
} // namespace frc2