diff --git a/wpilibc/src/main/native/cpp/frc2/command/NotifierCommand.cpp b/wpilibc/src/main/native/cpp/frc2/command/NotifierCommand.cpp index 086a2a1d0e..c4eac81265 100644 --- a/wpilibc/src/main/native/cpp/frc2/command/NotifierCommand.cpp +++ b/wpilibc/src/main/native/cpp/frc2/command/NotifierCommand.cpp @@ -9,7 +9,8 @@ using namespace frc2; -NotifierCommand::NotifierCommand(std::function toRun, double period, +NotifierCommand::NotifierCommand(std::function toRun, + units::second_t period, std::initializer_list requirements) : m_toRun(toRun), m_notifier{std::move(toRun)}, m_period{period} { AddRequirements(requirements); diff --git a/wpilibc/src/main/native/include/frc2/command/NotifierCommand.h b/wpilibc/src/main/native/include/frc2/command/NotifierCommand.h index 037e5c3d71..320ac2d233 100644 --- a/wpilibc/src/main/native/include/frc2/command/NotifierCommand.h +++ b/wpilibc/src/main/native/include/frc2/command/NotifierCommand.h @@ -9,6 +9,8 @@ #include +#include + #include "CommandBase.h" #include "CommandHelper.h" @@ -29,10 +31,10 @@ class NotifierCommand : public CommandHelper { * Creates a new NotifierCommand. * * @param toRun the runnable for the notifier to run - * @param period the period at which the notifier should run, in seconds + * @param period the period at which the notifier should run * @param requirements the subsystems required by this command */ - NotifierCommand(std::function toRun, double period, + NotifierCommand(std::function toRun, units::second_t period, std::initializer_list requirements); NotifierCommand(NotifierCommand&& other); @@ -46,6 +48,6 @@ class NotifierCommand : public CommandHelper { private: std::function m_toRun; frc::Notifier m_notifier; - double m_period; + units::second_t m_period; }; } // namespace frc2 diff --git a/wpilibc/src/test/native/cpp/frc2/command/NotifierCommandTest.cpp b/wpilibc/src/test/native/cpp/frc2/command/NotifierCommandTest.cpp index 9f2aefc7d1..695ccc3a63 100644 --- a/wpilibc/src/test/native/cpp/frc2/command/NotifierCommandTest.cpp +++ b/wpilibc/src/test/native/cpp/frc2/command/NotifierCommandTest.cpp @@ -20,7 +20,7 @@ TEST_F(NotifierCommandTest, NotifierCommandScheduleTest) { int counter = 0; - NotifierCommand command([&counter] { counter++; }, 0.01, {}); + NotifierCommand command([&counter] { counter++; }, 0.01_s, {}); scheduler.Schedule(&command); std::this_thread::sleep_for(std::chrono::milliseconds(250));