Fix Watchdog incorrectly resetting expiration flag upon disable (#1580)

Resetting the flag should only occur in Enable() and Reset().
IterativeRobotBase needs the flag to remain set to print epochs after
disabling the Watchdog.
This commit is contained in:
Tyler Veness
2019-02-02 00:22:07 -08:00
committed by Peter Johnson
parent ae3fd5adac
commit 43696956d2
4 changed files with 14 additions and 4 deletions

View File

@@ -83,11 +83,18 @@ TEST(WatchdogTest, SetTimeout) {
TEST(WatchdogTest, IsExpired) {
Watchdog watchdog(0.2, [] {});
EXPECT_FALSE(watchdog.IsExpired());
watchdog.Enable();
EXPECT_FALSE(watchdog.IsExpired());
std::this_thread::sleep_for(std::chrono::milliseconds(300));
EXPECT_TRUE(watchdog.IsExpired());
watchdog.Disable();
EXPECT_TRUE(watchdog.IsExpired());
watchdog.Reset();
EXPECT_FALSE(watchdog.IsExpired());
}
TEST(WatchdogTest, Epochs) {