From ff34cf196ef16d5c06278e45567015e0e06a8c48 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Thu, 23 Feb 2023 21:34:06 +0200 Subject: [PATCH] watchdog: Replace WatchdogView with const Watchdog --- src/displayapp/DisplayApp.cpp | 2 +- src/displayapp/DisplayApp.h | 6 +++--- src/displayapp/DisplayAppRecovery.cpp | 2 +- src/displayapp/DisplayAppRecovery.h | 4 ++-- src/displayapp/screens/SystemInfo.cpp | 2 +- src/displayapp/screens/SystemInfo.h | 6 +++--- src/drivers/Watchdog.h | 13 ------------- src/main.cpp | 3 +-- 8 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 7b824ff2..bf1d0e64 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -65,7 +65,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, const Controllers::Battery& batteryController, const Controllers::Ble& bleController, Controllers::DateTime& dateTimeController, - Drivers::WatchdogView& watchdog, + const Drivers::Watchdog& watchdog, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::HeartRateController& heartRateController, Controllers::Settings& settingsController, diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index b246dd63..980a4306 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -27,7 +27,7 @@ namespace Pinetime { namespace Drivers { class St7789; class Cst816S; - class WatchdogView; + class Watchdog; } namespace Controllers { @@ -57,7 +57,7 @@ namespace Pinetime { const Controllers::Battery& batteryController, const Controllers::Ble& bleController, Controllers::DateTime& dateTimeController, - Drivers::WatchdogView& watchdog, + const Drivers::Watchdog& watchdog, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::HeartRateController& heartRateController, Controllers::Settings& settingsController, @@ -84,7 +84,7 @@ namespace Pinetime { const Pinetime::Controllers::Battery& batteryController; const Pinetime::Controllers::Ble& bleController; Pinetime::Controllers::DateTime& dateTimeController; - Pinetime::Drivers::WatchdogView& watchdog; + const Pinetime::Drivers::Watchdog& watchdog; Pinetime::System::SystemTask* systemTask = nullptr; Pinetime::Controllers::NotificationManager& notificationManager; Pinetime::Controllers::HeartRateController& heartRateController; diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp index f6e86864..b9685595 100644 --- a/src/displayapp/DisplayAppRecovery.cpp +++ b/src/displayapp/DisplayAppRecovery.cpp @@ -16,7 +16,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, const Controllers::Battery& /*batteryController*/, const Controllers::Ble& bleController, Controllers::DateTime& /*dateTimeController*/, - Drivers::WatchdogView& /*watchdog*/, + const Drivers::Watchdog& /*watchdog*/, Pinetime::Controllers::NotificationManager& /*notificationManager*/, Pinetime::Controllers::HeartRateController& /*heartRateController*/, Controllers::Settings& /*settingsController*/, diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h index 6778003f..22bad9f9 100644 --- a/src/displayapp/DisplayAppRecovery.h +++ b/src/displayapp/DisplayAppRecovery.h @@ -20,7 +20,7 @@ namespace Pinetime { namespace Drivers { class St7789; class Cst816S; - class WatchdogView; + class Watchdog; } namespace Controllers { @@ -52,7 +52,7 @@ namespace Pinetime { const Controllers::Battery& batteryController, const Controllers::Ble& bleController, Controllers::DateTime& dateTimeController, - Drivers::WatchdogView& watchdog, + const Drivers::Watchdog& watchdog, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::HeartRateController& heartRateController, Controllers::Settings& settingsController, diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index a63fc287..9e05af51 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -35,7 +35,7 @@ SystemInfo::SystemInfo(Pinetime::Applications::DisplayApp* app, const Pinetime::Controllers::Battery& batteryController, Pinetime::Controllers::BrightnessController& brightnessController, const Pinetime::Controllers::Ble& bleController, - Pinetime::Drivers::WatchdogView& watchdog, + const Pinetime::Drivers::Watchdog& watchdog, Pinetime::Controllers::MotionController& motionController, const Pinetime::Drivers::Cst816S& touchPanel) : app {app}, diff --git a/src/displayapp/screens/SystemInfo.h b/src/displayapp/screens/SystemInfo.h index 7624afbc..199af51e 100644 --- a/src/displayapp/screens/SystemInfo.h +++ b/src/displayapp/screens/SystemInfo.h @@ -13,7 +13,7 @@ namespace Pinetime { } namespace Drivers { - class WatchdogView; + class Watchdog; } namespace Applications { @@ -27,7 +27,7 @@ namespace Pinetime { const Pinetime::Controllers::Battery& batteryController, Pinetime::Controllers::BrightnessController& brightnessController, const Pinetime::Controllers::Ble& bleController, - Pinetime::Drivers::WatchdogView& watchdog, + const Pinetime::Drivers::Watchdog& watchdog, Pinetime::Controllers::MotionController& motionController, const Pinetime::Drivers::Cst816S& touchPanel); ~SystemInfo() override; @@ -39,7 +39,7 @@ namespace Pinetime { const Pinetime::Controllers::Battery& batteryController; Pinetime::Controllers::BrightnessController& brightnessController; const Pinetime::Controllers::Ble& bleController; - Pinetime::Drivers::WatchdogView& watchdog; + const Pinetime::Drivers::Watchdog& watchdog; Pinetime::Controllers::MotionController& motionController; const Pinetime::Drivers::Cst816S& touchPanel; diff --git a/src/drivers/Watchdog.h b/src/drivers/Watchdog.h index 22aa9df6..65a505cb 100644 --- a/src/drivers/Watchdog.h +++ b/src/drivers/Watchdog.h @@ -20,18 +20,5 @@ namespace Pinetime { ResetReasons resetReason; ResetReasons ActualResetReason() const; }; - - class WatchdogView { - public: - WatchdogView(const Watchdog& watchdog) : watchdog {watchdog} { - } - - Watchdog::ResetReasons ResetReason() const { - return watchdog.ResetReason(); - } - - private: - const Watchdog& watchdog; - }; } } diff --git a/src/main.cpp b/src/main.cpp index 6cb52a81..df8425ca 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -106,7 +106,6 @@ Pinetime::Controllers::MotorController motorController {}; Pinetime::Controllers::DateTime dateTimeController {settingsController}; Pinetime::Drivers::Watchdog watchdog; -Pinetime::Drivers::WatchdogView watchdogView(watchdog); Pinetime::Controllers::NotificationManager notificationManager; Pinetime::Controllers::MotionController motionController; Pinetime::Controllers::TimerController timerController; @@ -121,7 +120,7 @@ Pinetime::Applications::DisplayApp displayApp(lcd, batteryController, bleController, dateTimeController, - watchdogView, + watchdog, notificationManager, heartRateController, settingsController,