Watchdog: use units::second_t instead of double (#1863)

Fixes #1827.
This commit is contained in:
Tyler Veness
2019-09-03 15:58:31 -07:00
committed by Peter Johnson
parent 761bc3ef85
commit 7112add67f
7 changed files with 63 additions and 25 deletions

View File

@@ -27,8 +27,8 @@ IterativeRobotBase::IterativeRobotBase(double period)
: IterativeRobotBase(units::second_t(period)) {}
IterativeRobotBase::IterativeRobotBase(units::second_t period)
: m_period(period.to<double>()),
m_watchdog(period.to<double>(), [this] { PrintLoopOverrunMessage(); }) {}
: m_period(period),
m_watchdog(period, [this] { PrintLoopOverrunMessage(); }) {}
void IterativeRobotBase::RobotInit() {
wpi::outs() << "Default " << __FUNCTION__ << "() method... Override me!\n";
@@ -174,7 +174,8 @@ void IterativeRobotBase::PrintLoopOverrunMessage() {
wpi::SmallString<128> str;
wpi::raw_svector_ostream buf(str);
buf << "Loop time of " << wpi::format("%.6f", m_period) << "s overrun\n";
buf << "Loop time of " << wpi::format("%.6f", m_period.to<double>())
<< "s overrun\n";
DriverStation::ReportWarning(str);
}