mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
wpilibc: Add overloads for units (#1815)
Add unit-taking overloads to the following classes: - IterativeRobotBase - LinearFilter - Notifier - TimedRobot - Timer (HasPeriodPassed only) - frc2::PIDController The corresponding non-units-taking functions have been deprecated. The return value of TimedRobot::GetPeriod() was updated. This is a breaking change, users should use to<double> to get the value in seconds. Other return values, e.g. Timer::Get(), have NOT been updated due to much wider use.
This commit is contained in:
committed by
Peter Johnson
parent
f1d71da8a9
commit
c07ac23532
@@ -96,17 +96,25 @@ void Notifier::SetHandler(std::function<void()> handler) {
|
||||
}
|
||||
|
||||
void Notifier::StartSingle(double delay) {
|
||||
StartSingle(units::second_t(delay));
|
||||
}
|
||||
|
||||
void Notifier::StartSingle(units::second_t delay) {
|
||||
std::scoped_lock lock(m_processMutex);
|
||||
m_periodic = false;
|
||||
m_period = delay;
|
||||
m_period = delay.to<double>();
|
||||
m_expirationTime = Timer::GetFPGATimestamp() + m_period;
|
||||
UpdateAlarm();
|
||||
}
|
||||
|
||||
void Notifier::StartPeriodic(double period) {
|
||||
StartPeriodic(units::second_t(period));
|
||||
}
|
||||
|
||||
void Notifier::StartPeriodic(units::second_t period) {
|
||||
std::scoped_lock lock(m_processMutex);
|
||||
m_periodic = true;
|
||||
m_period = period;
|
||||
m_period = period.to<double>();
|
||||
m_expirationTime = Timer::GetFPGATimestamp() + m_period;
|
||||
UpdateAlarm();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user