diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e59c0d814b..b53cdf0d3e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -472,6 +472,7 @@ list(APPEND SOURCE_FILES components/motor/MotorController.cpp components/settings/Settings.cpp components/timer/TimerController.cpp + components/stopwatch/StopWatchController.cpp components/alarm/AlarmController.cpp components/fs/FS.cpp drivers/Cst816s.cpp @@ -539,6 +540,7 @@ list(APPEND RECOVERY_SOURCE_FILES components/settings/Settings.cpp components/timer/TimerController.cpp components/alarm/AlarmController.cpp + components/stopwatch/StopWatchController.cpp drivers/Cst816s.cpp FreeRTOS/port.c FreeRTOS/port_cmsis_systick.c @@ -655,6 +657,7 @@ set(INCLUDE_FILES components/settings/Settings.h components/timer/TimerController.h components/alarm/AlarmController.h + components/stopwatch/StopWatchController.h drivers/Cst816s.h FreeRTOS/portmacro.h FreeRTOS/portmacro_cmsis.h diff --git a/src/components/stopwatch/StopWatchController.cpp b/src/components/stopwatch/StopWatchController.cpp new file mode 100644 index 0000000000..200919f4dc --- /dev/null +++ b/src/components/stopwatch/StopWatchController.cpp @@ -0,0 +1,101 @@ +#include "components/stopwatch/StopWatchController.h" + +using namespace Pinetime::Controllers; + +namespace { + TickType_t CalculateDelta(const TickType_t startTime, const TickType_t currentTime) { + TickType_t delta = 0; + // Take care of overflow + if (startTime > currentTime) { + delta = 0xffffffff - startTime; + delta += (currentTime + 1); + } else { + delta = currentTime - startTime; + } + return delta; + } +} + +StopWatchController::StopWatchController() { + Clear(); +} + +// State Change + +void StopWatchController::Start() { + currentState = StopWatchStates::Running; + startTime = xTaskGetTickCount(); +} + +void StopWatchController::Pause() { + currentState = StopWatchStates::Paused; + timeElapsedPreviously += CalculateDelta(startTime, xTaskGetTickCount()); +} + +void StopWatchController::Clear() { + currentState = StopWatchStates::Cleared; + timeElapsedPreviously = 0; + + for (int i = 0; i < LAP_CAPACITY; i++) { + laps[i].count = 0; + laps[i].time = 0; + } + lapCount = 0; + lapHead = 0; +} + +// Lap + +void StopWatchController::PushLap() { + TickType_t lapEnd = GetElapsedTime(); + laps[lapHead].time = lapEnd; + laps[lapHead].count = lapCount + 1; + lapCount += 1; + lapHead = lapCount % LAP_CAPACITY; +} + +int StopWatchController::GetLapNum() { + if (lapCount < LAP_CAPACITY) + return lapCount; + else + return LAP_CAPACITY; +} + +int StopWatchController::GetLapCount() { + return lapCount; +} + +int Wrap(int index) { + return ((index % LAP_CAPACITY) + LAP_CAPACITY) % LAP_CAPACITY; +} + +LapInfo* StopWatchController::LastLap(int lap) { + if (lap >= LAP_CAPACITY || lap > lapCount || lapCount == 0) { + // Return "empty" LapInfo_t + return &emptyLapInfo; + } + // Index backwards + int index = Wrap(lapHead - lap); + return &laps[index]; +} + +// Data / State acess + +TickType_t StopWatchController::GetElapsedTime() { + if (!IsRunning()) { + return timeElapsedPreviously; + } + return timeElapsedPreviously + CalculateDelta(startTime, xTaskGetTickCount()); +} + +bool StopWatchController::IsRunning() { + return currentState == StopWatchStates::Running; +} + +bool StopWatchController::IsCleared() { + return currentState == StopWatchStates::Cleared; +} + +bool StopWatchController::IsPaused() { + return currentState == StopWatchStates::Paused; +} diff --git a/src/components/stopwatch/StopWatchController.h b/src/components/stopwatch/StopWatchController.h new file mode 100644 index 0000000000..0aaeb5ca48 --- /dev/null +++ b/src/components/stopwatch/StopWatchController.h @@ -0,0 +1,66 @@ +#pragma once + +#include +#include + +#define LAP_CAPACITY 2 + +namespace Pinetime { + namespace System { + class SystemTask; + } + namespace Controllers { + + enum class StopWatchStates { Cleared, Running, Paused }; + + struct LapInfo { + int count = 0; // Used to label the lap + TickType_t time = 0; // Delta time from beginning of stopwatch + }; + + class StopWatchController { + public: + StopWatchController(); + + // StopWatch functionality and data + void Start(); + void Pause(); + void Clear(); + + TickType_t GetElapsedTime(); + + // Lap functionality + + /// Only the latest laps are stored, the lap count is saved until reset + void PushLap(); + + /// Returns actual count of stored laps + int GetLapNum(); + + /// Returns lapCount + int GetLapCount(); + + /// Indexes into lap history, with 0 being the latest lap. + /// If the lap is unavailable, count and time will be 0. If there is a + /// real value, count should be above 0 + LapInfo* LastLap(int lap = 0); + + bool IsRunning(); + bool IsCleared(); + bool IsPaused(); + + private: + // Current state of stopwatch + StopWatchStates currentState = StopWatchStates::Cleared; + // Start time of current duration + TickType_t startTime = 0; + // How much time was elapsed before current duration + TickType_t timeElapsedPreviously = 0; + // Stores lap times + LapInfo laps[LAP_CAPACITY]; + LapInfo emptyLapInfo = {.count = 0, .time = 0}; + int lapCount = 0; + int lapHead = 0; + }; + } +} diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 108e380d69..1173f3537e 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -74,6 +74,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, Pinetime::Controllers::MotionController& motionController, Pinetime::Controllers::TimerController& timerController, Pinetime::Controllers::AlarmController& alarmController, + Pinetime::Controllers::StopWatchController& stopWatchController, Pinetime::Controllers::BrightnessController& brightnessController, Pinetime::Controllers::TouchHandler& touchHandler, Pinetime::Controllers::FS& filesystem) @@ -91,6 +92,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, motionController {motionController}, timerController {timerController}, alarmController {alarmController}, + stopWatchController {stopWatchController}, brightnessController {brightnessController}, touchHandler {touchHandler}, filesystem {filesystem} { @@ -449,7 +451,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) ReturnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::StopWatch: - currentScreen = std::make_unique(this, *systemTask); + currentScreen = std::make_unique(this, *systemTask, stopWatchController); break; case Apps::Twos: currentScreen = std::make_unique(this); diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index 4c54e22739..abd837a0dc 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -16,6 +16,7 @@ #include "components/timer/TimerController.h" #include "components/alarm/AlarmController.h" #include "touchhandler/TouchHandler.h" +#include "components/stopwatch/StopWatchController.h" #include "displayapp/Messages.h" #include "BootErrors.h" @@ -61,6 +62,7 @@ namespace Pinetime { Pinetime::Controllers::MotionController& motionController, Pinetime::Controllers::TimerController& timerController, Pinetime::Controllers::AlarmController& alarmController, + Pinetime::Controllers::StopWatchController& stopWatchController, Pinetime::Controllers::BrightnessController& brightnessController, Pinetime::Controllers::TouchHandler& touchHandler, Pinetime::Controllers::FS& filesystem); @@ -89,6 +91,7 @@ namespace Pinetime { Pinetime::Controllers::MotionController& motionController; Pinetime::Controllers::TimerController& timerController; Pinetime::Controllers::AlarmController& alarmController; + Pinetime::Controllers::StopWatchController& stopWatchController; Pinetime::Controllers::BrightnessController& brightnessController; Pinetime::Controllers::TouchHandler& touchHandler; Pinetime::Controllers::FS& filesystem; diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp index e553aa8794..37e2ea8bf1 100644 --- a/src/displayapp/DisplayAppRecovery.cpp +++ b/src/displayapp/DisplayAppRecovery.cpp @@ -24,6 +24,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, Pinetime::Controllers::MotionController& motionController, Pinetime::Controllers::TimerController& timerController, Pinetime::Controllers::AlarmController& alarmController, + Pinetime::Controllers::StopWatchController& stopWatchController, Pinetime::Controllers::BrightnessController& brightnessController, Pinetime::Controllers::TouchHandler& touchHandler, Pinetime::Controllers::FS& filesystem) diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h index 7d4f0fd0c0..06585a05d2 100644 --- a/src/displayapp/DisplayAppRecovery.h +++ b/src/displayapp/DisplayAppRecovery.h @@ -34,6 +34,7 @@ namespace Pinetime { class MotorController; class TimerController; class AlarmController; + class StopWatchController; class BrightnessController; class FS; } @@ -59,6 +60,7 @@ namespace Pinetime { Pinetime::Controllers::MotionController& motionController, Pinetime::Controllers::TimerController& timerController, Pinetime::Controllers::AlarmController& alarmController, + Pinetime::Controllers::StopWatch& stopWatchController, Pinetime::Controllers::BrightnessController& brightnessController, Pinetime::Controllers::TouchHandler& touchHandler, Pinetime::Controllers::FS& filesystem); diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index c68cd85412..478c63658f 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -4,40 +4,41 @@ #include "displayapp/InfiniTimeTheme.h" using namespace Pinetime::Applications::Screens; +using namespace Pinetime::Controllers; namespace { - TimeSeparated_t convertTicksToTimeSegments(const TickType_t timeElapsed) { + TimeSeparated convertTicksToTimeSegments(const TickType_t timeElapsed) { // Centiseconds const int timeElapsedCentis = timeElapsed * 100 / configTICK_RATE_HZ; const int hundredths = (timeElapsedCentis % 100); const int secs = (timeElapsedCentis / 100) % 60; const int mins = (timeElapsedCentis / 100) / 60; - return TimeSeparated_t {mins, secs, hundredths}; + return TimeSeparated {mins, secs, hundredths}; } void play_pause_event_handler(lv_obj_t* obj, lv_event_t event) { auto* stopWatch = static_cast(obj->user_data); - stopWatch->playPauseBtnEventHandler(event); + stopWatch->PlayPauseBtnEventHandler(event); } void stop_lap_event_handler(lv_obj_t* obj, lv_event_t event) { auto* stopWatch = static_cast(obj->user_data); - stopWatch->stopLapBtnEventHandler(event); + stopWatch->StopLapBtnEventHandler(event); } } -StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask) : Screen(app), systemTask {systemTask} { +StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask, + StopWatchController& stopWatchController) + : Screen(app), systemTask {systemTask}, stopWatchController {stopWatchController} { time = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76); - lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); lv_label_set_text_static(time, "00:00"); lv_obj_align(time, lv_scr_act(), LV_ALIGN_CENTER, 0, -45); msecTime = lv_label_create(lv_scr_act(), nullptr); // lv_obj_set_style_local_text_font(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); - lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); lv_label_set_text_static(msecTime, "00"); lv_obj_align(msecTime, lv_scr_act(), LV_ALIGN_CENTER, 0, 3); @@ -56,8 +57,6 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask) : Screen(a lv_obj_align(btnStopLap, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); txtStopLap = lv_label_create(btnStopLap, nullptr); lv_label_set_text_static(txtStopLap, Symbols::stop); - lv_obj_set_state(btnStopLap, LV_STATE_DISABLED); - lv_obj_set_state(txtStopLap, LV_STATE_DISABLED); lapText = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(lapText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW); @@ -65,6 +64,26 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask) : Screen(a lv_label_set_text_static(lapText, ""); taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); + + // Figure out what the current state of the stopwatch is and select the correct display + if (stopWatchController.IsCleared()) { + DisplayCleared(); + } else { + if (stopWatchController.GetLapCount() > 0) { + UpdateLaps(); + } + UpdateTime(); + + if (stopWatchController.IsRunning()) { + lv_obj_set_state(btnStopLap, LV_STATE_DISABLED); + lv_obj_set_state(txtStopLap, LV_STATE_DISABLED); + DisplayStarted(); + } else if (stopWatchController.IsPaused()) { + lv_obj_set_state(btnStopLap, LV_STATE_DEFAULT); + lv_obj_set_state(txtStopLap, LV_STATE_DEFAULT); + DisplayPaused(); + } + } } StopWatch::~StopWatch() { @@ -73,9 +92,7 @@ StopWatch::~StopWatch() { lv_obj_clean(lv_scr_act()); } -void StopWatch::Reset() { - currentState = States::Init; - oldTimeElapsed = 0; +void StopWatch::DisplayCleared() { lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray); @@ -83,28 +100,22 @@ void StopWatch::Reset() { lv_label_set_text_static(msecTime, "00"); lv_label_set_text_static(lapText, ""); - lapsDone = 0; lv_obj_set_state(btnStopLap, LV_STATE_DISABLED); lv_obj_set_state(txtStopLap, LV_STATE_DISABLED); } -void StopWatch::Start() { +void StopWatch::DisplayStarted() { lv_obj_set_state(btnStopLap, LV_STATE_DEFAULT); lv_obj_set_state(txtStopLap, LV_STATE_DEFAULT); lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::highlight); lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::highlight); lv_label_set_text_static(txtPlayPause, Symbols::pause); lv_label_set_text_static(txtStopLap, Symbols::lapsFlag); - startTime = xTaskGetTickCount(); - currentState = States::Running; systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping); } -void StopWatch::Pause() { - startTime = 0; - // Store the current time elapsed in cache - oldTimeElapsed = laps[lapsDone]; - currentState = States::Halted; +void StopWatch::DisplayPaused() { + lv_obj_set_state(btnStopLap, LV_STATE_DEFAULT); lv_label_set_text_static(txtPlayPause, Symbols::play); lv_label_set_text_static(txtStopLap, Symbols::stop); lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW); @@ -112,55 +123,66 @@ void StopWatch::Pause() { systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping); } -void StopWatch::Refresh() { - if (currentState == States::Running) { - laps[lapsDone] = oldTimeElapsed + xTaskGetTickCount() - startTime; +void StopWatch::UpdateTime() { + TimeSeparated currentTimeSeparated = convertTicksToTimeSegments(stopWatchController.GetElapsedTime()); + + lv_label_set_text_fmt(time, "%02d:%02d", currentTimeSeparated.mins, currentTimeSeparated.secs); + lv_label_set_text_fmt(msecTime, "%02d", currentTimeSeparated.hundredths); +} + +void StopWatch::UpdateLaps() { + lv_label_set_text(lapText, ""); - TimeSeparated_t currentTimeSeparated = convertTicksToTimeSegments(laps[lapsDone]); - lv_label_set_text_fmt(time, "%02d:%02d", currentTimeSeparated.mins, currentTimeSeparated.secs); - lv_label_set_text_fmt(msecTime, "%02d", currentTimeSeparated.hundredths); + for (int i = 0; i < displayedLaps; i++) { + LapInfo* lap = stopWatchController.LastLap(i); + + if (lap->count != 0) { + TimeSeparated laptime = convertTicksToTimeSegments(lap->time); + char buffer[16]; + sprintf(buffer, "#%2d %2d:%02d.%02d\n", lap->count, laptime.mins, laptime.secs, laptime.hundredths); + lv_label_ins_text(lapText, LV_LABEL_POS_LAST, buffer); + } + } +} + +void StopWatch::Refresh() { + if (stopWatchController.IsRunning()) { + UpdateTime(); } } -void StopWatch::playPauseBtnEventHandler(lv_event_t event) { +void StopWatch::PlayPauseBtnEventHandler(lv_event_t event) { if (event != LV_EVENT_CLICKED) { return; } - if (currentState == States::Init) { - Start(); - } else if (currentState == States::Running) { - Pause(); - } else if (currentState == States::Halted) { - Start(); + if (stopWatchController.IsCleared() || stopWatchController.IsPaused()) { + stopWatchController.Start(); + DisplayStarted(); + } else if (stopWatchController.IsRunning()) { + stopWatchController.Pause(); + DisplayPaused(); } } -void StopWatch::stopLapBtnEventHandler(lv_event_t event) { +void StopWatch::StopLapBtnEventHandler(lv_event_t event) { if (event != LV_EVENT_CLICKED) { return; } // If running, then this button is used to save laps - if (currentState == States::Running) { - lv_label_set_text(lapText, ""); - lapsDone = std::min(lapsDone + 1, maxLapCount); - for (int i = lapsDone - displayedLaps; i < lapsDone; i++) { - if (i < 0) { - lv_label_ins_text(lapText, LV_LABEL_POS_LAST, "\n"); - continue; - } - TimeSeparated_t times = convertTicksToTimeSegments(laps[i]); - char buffer[16]; - sprintf(buffer, "#%2d %2d:%02d.%02d\n", i + 1, times.mins, times.secs, times.hundredths); - lv_label_ins_text(lapText, LV_LABEL_POS_LAST, buffer); - } - } else if (currentState == States::Halted) { - Reset(); + if (stopWatchController.IsRunning()) { + stopWatchController.PushLap(); + + UpdateLaps(); + } else if (stopWatchController.IsPaused()) { + stopWatchController.Clear(); + DisplayCleared(); } } bool StopWatch::OnButtonPushed() { - if (currentState == States::Running) { - Pause(); + if (stopWatchController.IsRunning()) { + stopWatchController.Pause(); + DisplayPaused(); return true; } return false; diff --git a/src/displayapp/screens/StopWatch.h b/src/displayapp/screens/StopWatch.h index f2f57110b0..b85fe3f12f 100644 --- a/src/displayapp/screens/StopWatch.h +++ b/src/displayapp/screens/StopWatch.h @@ -3,16 +3,12 @@ #include "displayapp/screens/Screen.h" #include -#include -#include "portmacro_cmsis.h" - +#include "components/stopwatch/StopWatchController.h" #include "systemtask/SystemTask.h" namespace Pinetime::Applications::Screens { - enum class States { Init, Running, Halted }; - - struct TimeSeparated_t { + struct TimeSeparated { int mins; int secs; int hundredths; @@ -20,30 +16,30 @@ namespace Pinetime::Applications::Screens { class StopWatch : public Screen { public: - StopWatch(DisplayApp* app, System::SystemTask& systemTask); + StopWatch(DisplayApp* app, System::SystemTask& systemTask, + Controllers::StopWatchController& stopWatchController); ~StopWatch() override; void Refresh() override; - void playPauseBtnEventHandler(lv_event_t event); - void stopLapBtnEventHandler(lv_event_t event); + void PlayPauseBtnEventHandler(lv_event_t event); + void StopLapBtnEventHandler(lv_event_t event); bool OnButtonPushed() override; - void Reset(); - void Start(); - void Pause(); + void DisplayCleared(); + void DisplayStarted(); + void DisplayPaused(); private: Pinetime::System::SystemTask& systemTask; - States currentState = States::Init; - TickType_t startTime; - TickType_t oldTimeElapsed = 0; - static constexpr int maxLapCount = 20; - TickType_t laps[maxLapCount + 1]; + Controllers::StopWatchController& stopWatchController; static constexpr int displayedLaps = 2; - int lapsDone = 0; + TickType_t timeElapsed; lv_obj_t *time, *msecTime, *btnPlayPause, *btnStopLap, *txtPlayPause, *txtStopLap; lv_obj_t* lapText; lv_task_t* taskRefresh; + + void UpdateTime(); + void UpdateLaps(); }; } diff --git a/src/main.cpp b/src/main.cpp index ad7a07dc98..713602b032 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,6 +36,7 @@ #include "components/motor/MotorController.h" #include "components/datetime/DateTimeController.h" #include "components/heartrate/HeartRateController.h" +#include "components/stopwatch/StopWatchController.h" #include "components/fs/FS.h" #include "drivers/Spi.h" #include "drivers/SpiMaster.h" @@ -111,6 +112,7 @@ Pinetime::Drivers::WatchdogView watchdogView(watchdog); Pinetime::Controllers::NotificationManager notificationManager; Pinetime::Controllers::MotionController motionController; Pinetime::Controllers::TimerController timerController; +Pinetime::Controllers::StopWatchController stopWatchController; Pinetime::Controllers::AlarmController alarmController {dateTimeController}; Pinetime::Controllers::TouchHandler touchHandler(touchPanel, lvgl); Pinetime::Controllers::ButtonHandler buttonHandler; @@ -130,6 +132,7 @@ Pinetime::Applications::DisplayApp displayApp(lcd, motionController, timerController, alarmController, + stopWatchController, brightnessController, touchHandler, fs); @@ -145,6 +148,7 @@ Pinetime::System::SystemTask systemTask(spi, dateTimeController, timerController, alarmController, + stopWatchController, watchdog, notificationManager, motorController, diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index ef631af74e..1e9fbb80fe 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -57,6 +57,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi, Controllers::DateTime& dateTimeController, Controllers::TimerController& timerController, Controllers::AlarmController& alarmController, + Controllers::StopWatchController& stopWatchController, Drivers::Watchdog& watchdog, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::MotorController& motorController, @@ -81,6 +82,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi, dateTimeController {dateTimeController}, timerController {timerController}, alarmController {alarmController}, + stopWatchController {stopWatchController}, watchdog {watchdog}, notificationManager {notificationManager}, motorController {motorController}, diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index d1e4a004f9..9a3ffba001 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -18,6 +18,7 @@ #include "components/motor/MotorController.h" #include "components/timer/TimerController.h" #include "components/alarm/AlarmController.h" +#include "components/stopwatch/StopWatchController.h" #include "components/fs/FS.h" #include "touchhandler/TouchHandler.h" #include "buttonhandler/ButtonHandler.h" @@ -65,6 +66,7 @@ namespace Pinetime { Controllers::DateTime& dateTimeController, Controllers::TimerController& timerController, Controllers::AlarmController& alarmController, + Controllers::StopWatchController& stopWatchController, Drivers::Watchdog& watchdog, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::MotorController& motorController, @@ -110,6 +112,7 @@ namespace Pinetime { Pinetime::Controllers::DateTime& dateTimeController; Pinetime::Controllers::TimerController& timerController; Pinetime::Controllers::AlarmController& alarmController; + Pinetime::Controllers::StopWatchController& stopWatchController; QueueHandle_t systemTasksMsgQueue; Pinetime::Drivers::Watchdog& watchdog; Pinetime::Controllers::NotificationManager& notificationManager;