mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpilibc] Transition C++ classes to units::second_t (#3396)
A lot of these are breaking changes. frc::Timer was replaced with the contents of frc2::Timer. The others were in-place argument changes or removing deprecated non-unit overloads.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
#include <wpi/priority_queue.h>
|
||||
|
||||
#include "frc/IterativeRobotBase.h"
|
||||
#include "frc2/Timer.h"
|
||||
#include "frc/Timer.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace frc {
|
||||
*/
|
||||
class TimedRobot : public IterativeRobotBase {
|
||||
public:
|
||||
static constexpr units::second_t kDefaultPeriod = 20_ms;
|
||||
static constexpr auto kDefaultPeriod = 20_ms;
|
||||
|
||||
/**
|
||||
* Provide an alternate "main loop" via StartCompetition().
|
||||
@@ -99,12 +99,11 @@ class TimedRobot : public IterativeRobotBase {
|
||||
units::second_t period, units::second_t offset)
|
||||
: func{std::move(func)},
|
||||
period{period},
|
||||
expirationTime{
|
||||
startTime + offset +
|
||||
units::math::floor((frc2::Timer::GetFPGATimestamp() - startTime) /
|
||||
period) *
|
||||
period +
|
||||
period} {}
|
||||
expirationTime{startTime + offset +
|
||||
units::math::floor(
|
||||
(Timer::GetFPGATimestamp() - startTime) / period) *
|
||||
period +
|
||||
period} {}
|
||||
|
||||
bool operator>(const Callback& rhs) const {
|
||||
return expirationTime > rhs.expirationTime;
|
||||
|
||||
Reference in New Issue
Block a user