[wpilib] Moved Watchdog output to reportWarning() (#2413)

This commit is contained in:
Starlight220
2020-05-21 06:57:06 +03:00
committed by GitHub
parent cf7088a462
commit 27f9a21a2c
2 changed files with 12 additions and 5 deletions

View File

@@ -9,8 +9,11 @@
#include <wpi/Format.h>
#include <wpi/PriorityQueue.h>
#include <wpi/SmallString.h>
#include <wpi/raw_ostream.h>
#include "frc/DriverStation.h"
using namespace frc;
constexpr std::chrono::milliseconds Watchdog::kMinPrintPeriod;
@@ -52,10 +55,12 @@ void Watchdog::Thread::Main() {
if (now - watchdog->m_lastTimeoutPrintTime > kMinPrintPeriod) {
watchdog->m_lastTimeoutPrintTime = now;
if (!watchdog->m_suppressTimeoutMessage) {
wpi::outs() << "Watchdog not fed within "
<< wpi::format("%.6f",
watchdog->m_timeout.count() / 1.0e9)
<< "s\n";
wpi::SmallString<128> buf;
wpi::raw_svector_ostream err(buf);
err << "Watchdog not fed within "
<< wpi::format("%.6f", watchdog->m_timeout.count() / 1.0e9)
<< "s\n";
frc::DriverStation::ReportWarning(err.str());
}
}