diff --git a/wpilibc/src/main/native/cpp/Watchdog.cpp b/wpilibc/src/main/native/cpp/Watchdog.cpp index 1db1cf866d..69bdf71cb6 100644 --- a/wpilibc/src/main/native/cpp/Watchdog.cpp +++ b/wpilibc/src/main/native/cpp/Watchdog.cpp @@ -9,8 +9,11 @@ #include #include +#include #include +#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()); } } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Watchdog.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Watchdog.java index fe5d0b98c9..afb6cbe1f8 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Watchdog.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Watchdog.java @@ -227,7 +227,9 @@ public class Watchdog implements Closeable, Comparable { if (now - watchdog.m_lastTimeoutPrintTime > kMinPrintPeriod) { watchdog.m_lastTimeoutPrintTime = now; if (!watchdog.m_suppressTimeoutMessage) { - System.out.format("Watchdog not fed within %.6fs\n", watchdog.m_timeout / 1.0e6); + DriverStation.reportWarning( + String.format("Watchdog not fed within %.6fs\n", watchdog.m_timeout / 1.0e6), + false); } }