From 5f19f689f9ebe1b00f3f7da22b20fb2700811375 Mon Sep 17 00:00:00 2001 From: JF Date: Sun, 30 Apr 2023 15:56:13 +0200 Subject: Refactor, document and fix the Watchdog driver (#1710) * Refactor and document the Watchdog driver to make it more readable. Fix the configuration of the behaviours configuration that was not properly implemented (but it didn't cause any side effect since the correct value was eventually set in NRF_WDT->CONFIG). Fix the wrong interpretation of the reset reasons caused by implicit conversions of int to bool. --- src/displayapp/screens/SystemInfo.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/displayapp/screens/SystemInfo.cpp') diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index 511ecf50..d6fa7365 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -101,24 +101,24 @@ std::unique_ptr SystemInfo::CreateScreen1() { std::unique_ptr SystemInfo::CreateScreen2() { auto batteryPercent = batteryController.PercentRemaining(); const auto* resetReason = [this]() { - switch (watchdog.ResetReason()) { - case Drivers::Watchdog::ResetReasons::Watchdog: + switch (watchdog.GetResetReason()) { + case Drivers::Watchdog::ResetReason::Watchdog: return "wtdg"; - case Drivers::Watchdog::ResetReasons::HardReset: + case Drivers::Watchdog::ResetReason::HardReset: return "hardr"; - case Drivers::Watchdog::ResetReasons::NFC: + case Drivers::Watchdog::ResetReason::NFC: return "nfc"; - case Drivers::Watchdog::ResetReasons::SoftReset: + case Drivers::Watchdog::ResetReason::SoftReset: return "softr"; - case Drivers::Watchdog::ResetReasons::CpuLockup: + case Drivers::Watchdog::ResetReason::CpuLockup: return "cpulock"; - case Drivers::Watchdog::ResetReasons::SystemOff: + case Drivers::Watchdog::ResetReason::SystemOff: return "off"; - case Drivers::Watchdog::ResetReasons::LpComp: + case Drivers::Watchdog::ResetReason::LpComp: return "lpcomp"; - case Drivers::Watchdog::ResetReasons::DebugInterface: + case Drivers::Watchdog::ResetReason::DebugInterface: return "dbg"; - case Drivers::Watchdog::ResetReasons::ResetPin: + case Drivers::Watchdog::ResetReason::ResetPin: return "rst"; default: return "?"; -- cgit v1.2.3-70-g09d2