diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 64b7ffbd66..311696747e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -473,6 +473,7 @@ list(APPEND SOURCE_FILES components/settings/Settings.cpp components/timer/TimerController.cpp components/alarm/AlarmController.cpp + components/alert/AlertController.cpp components/fs/FS.cpp drivers/Cst816s.cpp FreeRTOS/port.c @@ -539,6 +540,7 @@ list(APPEND RECOVERY_SOURCE_FILES components/settings/Settings.cpp components/timer/TimerController.cpp components/alarm/AlarmController.cpp + components/alert/AlertController.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/alert/AlertController.h drivers/Cst816s.h FreeRTOS/portmacro.h FreeRTOS/portmacro_cmsis.h diff --git a/src/components/alarm/AlarmController.cpp b/src/components/alarm/AlarmController.cpp index 88f65d9adb..a31f50c44e 100644 --- a/src/components/alarm/AlarmController.cpp +++ b/src/components/alarm/AlarmController.cpp @@ -104,5 +104,5 @@ void AlarmController::StopAlerting() { // set next instance ScheduleAlarm(); } - systemTask->PushMessage(System::Messages::StopRinging); + systemTask->PushMessage(System::Messages::StopAlarm); } diff --git a/src/components/alert/AlertController.cpp b/src/components/alert/AlertController.cpp new file mode 100644 index 0000000000..95e50371c4 --- /dev/null +++ b/src/components/alert/AlertController.cpp @@ -0,0 +1,74 @@ +#include "components/alert/AlertController.h" + +using namespace Pinetime::Controllers; +using namespace Pinetime::Applications::Display; + +AlertController::AlertController(MotorController& motorController) : motorController {motorController} { +} + +// return true if a change has happened +bool AlertController::Update() { + if (motorController.IsVibrating()) + return false; + + bool ok = true; + + if (phoneCallIsActive) { + ok = motorController.StartRinging(55); + } else if (timerIsActive) { + ok = motorController.StartRinging(50); + } else if (alarmIsActive) { + ok = motorController.StartRinging(45); + } else if (notificationIsActive) { + ok = motorController.SingleVibration(40); + } + + return ok; +} + +Messages AlertController::DisplayMessage() const { + if (timerIsActive) { + return Messages::TimerDone; + } else if (alarmIsActive) { + return Messages::AlarmTriggered; + } + + return Messages::NewNotification; +} + +void AlertController::ActivatePhoneCall() { + phoneCallIsActive = true; +}; + +void AlertController::ActivateTimer() { + timerIsActive = true; +}; + +void AlertController::ActivateAlarm() { + alarmIsActive = true; +}; + +void AlertController::ActivateNotification() { + notificationIsActive = true; +}; + +void AlertController::DeactivatePhoneCall() { + if (phoneCallIsActive) { + motorController.StopRinging(); + } + phoneCallIsActive = false; +}; + +void AlertController::DeactivateTimer() { + if (!phoneCallIsActive && timerIsActive) { + motorController.StopRinging(); + } + timerIsActive = false; +}; + +void AlertController::DeactivateAlarm() { + if (!phoneCallIsActive && !timerIsActive && alarmIsActive) { + motorController.StopRinging(); + } + alarmIsActive = false; +}; diff --git a/src/components/alert/AlertController.h b/src/components/alert/AlertController.h new file mode 100644 index 0000000000..b93764311e --- /dev/null +++ b/src/components/alert/AlertController.h @@ -0,0 +1,38 @@ +#pragma once + +#include "components/motor/MotorController.h" +#include "displayapp/Messages.h" + +namespace Pinetime { + namespace Controllers { + + class AlertController { + public: + AlertController(MotorController& motorController); + + bool IsActive() const { + return phoneCallIsActive || timerIsActive || alarmIsActive || notificationIsActive; + } + + void ActivatePhoneCall(); + void ActivateTimer(); + void ActivateAlarm(); + void ActivateNotification(); + + void DeactivatePhoneCall(); + void DeactivateTimer(); + void DeactivateAlarm(); + + bool Update(); + Pinetime::Applications::Display::Messages DisplayMessage() const; + + private: + bool phoneCallIsActive = false; + bool timerIsActive = false; + bool alarmIsActive = false; + bool notificationIsActive = false; + + MotorController& motorController; + }; + } +} diff --git a/src/components/motor/MotorController.cpp b/src/components/motor/MotorController.cpp index db6103f424..afa2707c42 100644 --- a/src/components/motor/MotorController.cpp +++ b/src/components/motor/MotorController.cpp @@ -9,7 +9,7 @@ void MotorController::Init() { nrf_gpio_cfg_output(PinMap::Motor); nrf_gpio_pin_set(PinMap::Motor); - shortVib = xTimerCreate("shortVib", 1, pdFALSE, nullptr, StopMotor); + shortVib = xTimerCreate("shortVib", 1, pdFALSE, this, StopMotor); longVib = xTimerCreate("longVib", pdMS_TO_TICKS(1000), pdTRUE, this, Ring); } @@ -20,20 +20,38 @@ void MotorController::Ring(TimerHandle_t xTimer) { void MotorController::RunForDuration(uint8_t motorDuration) { if (motorDuration > 0 && xTimerChangePeriod(shortVib, pdMS_TO_TICKS(motorDuration), 0) == pdPASS && xTimerStart(shortVib, 0) == pdPASS) { + isShortVibrating = true; nrf_gpio_pin_clear(PinMap::Motor); } } -void MotorController::StartRinging() { - RunForDuration(50); +bool MotorController::StartRinging(uint8_t Duration) { + if (IsVibrating()) { + return false; + } + isLongVibrating = true; + RunForDuration(Duration); xTimerStart(longVib, 0); + return true; } void MotorController::StopRinging() { xTimerStop(longVib, 0); nrf_gpio_pin_set(PinMap::Motor); + isLongVibrating = false; } void MotorController::StopMotor(TimerHandle_t xTimer) { + auto* motorController = static_cast(pvTimerGetTimerID(xTimer)); nrf_gpio_pin_set(PinMap::Motor); + motorController->isShortVibrating = false; +} + +// CAUTION: this one will not trigger a vibration if another one is already running! +bool MotorController::SingleVibration(uint8_t Duration) { + if (IsVibrating()) { + return false; + } + RunForDuration(Duration); + return true; } diff --git a/src/components/motor/MotorController.h b/src/components/motor/MotorController.h index 6dea6d1f9e..f8516ea7b6 100644 --- a/src/components/motor/MotorController.h +++ b/src/components/motor/MotorController.h @@ -12,15 +12,28 @@ namespace Pinetime { MotorController() = default; void Init(); - void RunForDuration(uint8_t motorDuration); - void StartRinging(); + + // SingleVibration and StartRinging do nothing when a vibration is already running. + // they return false in this case. + // if everything went good they return true. + bool SingleVibration(uint8_t Duration); + bool StartRinging(uint8_t Duration); void StopRinging(); + bool IsVibrating() { + return isShortVibrating || isLongVibrating; + }; + private: + void RunForDuration(uint8_t motorDuration); + static void Ring(TimerHandle_t xTimer); static void StopMotor(TimerHandle_t xTimer); TimerHandle_t shortVib; TimerHandle_t longVib; + + bool isShortVibrating = false; + bool isLongVibrating = false; }; } } diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 69830eadbd..98cec36078 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::AlertController& alertController, 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}, + alertController {alertController}, brightnessController {brightnessController}, touchHandler {touchHandler}, filesystem {filesystem} { @@ -384,6 +386,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio notificationManager, systemTask->nimble().alertService(), motorController, + alertController, *systemTask, Screens::Notifications::Modes::Normal); break; @@ -392,6 +395,7 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio notificationManager, systemTask->nimble().alertService(), motorController, + alertController, *systemTask, Screens::Notifications::Modes::Preview); break; diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index c1d04cc94c..7bbf87098e 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -15,6 +15,7 @@ #include "displayapp/screens/Screen.h" #include "components/timer/TimerController.h" #include "components/alarm/AlarmController.h" +#include "components/alert/AlertController.h" #include "touchhandler/TouchHandler.h" #include "displayapp/Messages.h" @@ -65,6 +66,7 @@ namespace Pinetime { Pinetime::Controllers::MotionController& motionController, Pinetime::Controllers::TimerController& timerController, Pinetime::Controllers::AlarmController& alarmController, + Pinetime::Controllers::AlertController& alertController, Pinetime::Controllers::BrightnessController& brightnessController, Pinetime::Controllers::TouchHandler& touchHandler, Pinetime::Controllers::FS& filesystem); @@ -93,6 +95,7 @@ namespace Pinetime { Pinetime::Controllers::MotionController& motionController; Pinetime::Controllers::TimerController& timerController; Pinetime::Controllers::AlarmController& alarmController; + Pinetime::Controllers::AlertController& alertController; 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..ad3e708452 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::AlertController& alertController, 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 97aaca8812..dc9e9b2c64 100644 --- a/src/displayapp/DisplayAppRecovery.h +++ b/src/displayapp/DisplayAppRecovery.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "BootErrors.h" #include "displayapp/TouchEvents.h" #include "displayapp/Apps.h" @@ -60,6 +61,7 @@ namespace Pinetime { Pinetime::Controllers::MotionController& motionController, Pinetime::Controllers::TimerController& timerController, Pinetime::Controllers::AlarmController& alarmController, + Pinetime::Controllers::AlertController& alertController, Pinetime::Controllers::BrightnessController& brightnessController, Pinetime::Controllers::TouchHandler& touchHandler, Pinetime::Controllers::FS& filesystem); diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp index 0b6864e892..35669e6e3b 100644 --- a/src/displayapp/screens/InfiniPaint.cpp +++ b/src/displayapp/screens/InfiniPaint.cpp @@ -54,7 +54,7 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } std::fill(b, b + bufferSize, selectColor); - motor.RunForDuration(35); + motor.SingleVibration(35); return true; default: return true; diff --git a/src/displayapp/screens/Metronome.cpp b/src/displayapp/screens/Metronome.cpp index 40456ab88d..166cd46c4c 100644 --- a/src/displayapp/screens/Metronome.cpp +++ b/src/displayapp/screens/Metronome.cpp @@ -83,9 +83,9 @@ void Metronome::Refresh() { counter--; if (counter == 0) { counter = bpb; - motorController.RunForDuration(90); + motorController.SingleVibration(90); } else { - motorController.RunForDuration(30); + motorController.SingleVibration(30); } } } diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 6c68c70de7..68ad39b89f 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -14,12 +14,14 @@ Notifications::Notifications(DisplayApp* app, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::AlertNotificationService& alertNotificationService, Pinetime::Controllers::MotorController& motorController, + Pinetime::Controllers::AlertController& alertController, System::SystemTask& systemTask, Modes mode) : Screen(app), notificationManager {notificationManager}, alertNotificationService {alertNotificationService}, motorController {motorController}, + alertController {alertController}, systemTask {systemTask}, mode {mode} { @@ -33,18 +35,19 @@ Notifications::Notifications(DisplayApp* app, notification.category, notificationManager.NbNotifications(), alertNotificationService, - motorController); + motorController, + alertController); validDisplay = true; } else { - currentItem = std::make_unique(alertNotificationService, motorController); + currentItem = std::make_unique(alertNotificationService, motorController, alertController); validDisplay = false; } if (mode == Modes::Preview) { systemTask.PushMessage(System::Messages::DisableSleeping); if (notification.category == Controllers::NotificationManager::Categories::IncomingCall) { - motorController.StartRinging(); + alertController.ActivatePhoneCall(); } else { - motorController.RunForDuration(35); + alertController.ActivateNotification(); } timeoutLine = lv_line_create(lv_scr_act(), nullptr); @@ -63,8 +66,6 @@ Notifications::Notifications(DisplayApp* app, Notifications::~Notifications() { lv_task_del(taskRefresh); - // make sure we stop any vibrations before exiting - motorController.StopRinging(); systemTask.PushMessage(System::Messages::EnableSleeping); lv_obj_clean(lv_scr_act()); } @@ -111,9 +112,10 @@ void Notifications::Refresh() { notification.category, notificationManager.NbNotifications(), alertNotificationService, - motorController); + motorController, + alertController); } else { - currentItem = std::make_unique(alertNotificationService, motorController); + currentItem = std::make_unique(alertNotificationService, motorController, alertController); } } @@ -122,7 +124,6 @@ void Notifications::Refresh() { void Notifications::OnPreviewInteraction() { systemTask.PushMessage(System::Messages::EnableSleeping); - motorController.StopRinging(); if (timeoutLine != nullptr) { lv_obj_del(timeoutLine); timeoutLine = nullptr; @@ -202,7 +203,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { previousNotification.category, notificationManager.NbNotifications(), alertNotificationService, - motorController); + motorController, + alertController); } return true; case Pinetime::Applications::TouchEvents::SwipeUp: { @@ -229,7 +231,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { nextNotification.category, notificationManager.NbNotifications(), alertNotificationService, - motorController); + motorController, + alertController); } return true; default: @@ -245,14 +248,16 @@ namespace { } Notifications::NotificationItem::NotificationItem(Pinetime::Controllers::AlertNotificationService& alertNotificationService, - Pinetime::Controllers::MotorController& motorController) + Pinetime::Controllers::MotorController& motorController, + Pinetime::Controllers::AlertController& alertController) : NotificationItem("Notification", "No notification to display", 0, Controllers::NotificationManager::Categories::Unknown, 0, alertNotificationService, - motorController) { + motorController, + alertController) { } Notifications::NotificationItem::NotificationItem(const char* title, @@ -261,8 +266,9 @@ Notifications::NotificationItem::NotificationItem(const char* title, Controllers::NotificationManager::Categories category, uint8_t notifNb, Pinetime::Controllers::AlertNotificationService& alertNotificationService, - Pinetime::Controllers::MotorController& motorController) - : alertNotificationService {alertNotificationService}, motorController {motorController} { + Pinetime::Controllers::MotorController& motorController, + Pinetime::Controllers::AlertController& alertController) + : alertNotificationService {alertNotificationService}, motorController {motorController}, alertController {alertController} { container = lv_cont_create(lv_scr_act(), nullptr); lv_obj_set_size(container, LV_HOR_RES, LV_VER_RES); lv_obj_set_style_local_bg_color(container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); @@ -356,7 +362,7 @@ void Notifications::NotificationItem::OnCallButtonEvent(lv_obj_t* obj, lv_event_ return; } - motorController.StopRinging(); + alertController.DeactivatePhoneCall(); if (obj == bt_accept) { alertNotificationService.AcceptIncomingCall(); diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h index a4d2709b50..8eba5ed836 100644 --- a/src/displayapp/screens/Notifications.h +++ b/src/displayapp/screens/Notifications.h @@ -24,6 +24,7 @@ namespace Pinetime { Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::AlertNotificationService& alertNotificationService, Pinetime::Controllers::MotorController& motorController, + Pinetime::Controllers::AlertController& alertController, System::SystemTask& systemTask, Modes mode); ~Notifications() override; @@ -37,14 +38,16 @@ namespace Pinetime { class NotificationItem { public: NotificationItem(Pinetime::Controllers::AlertNotificationService& alertNotificationService, - Pinetime::Controllers::MotorController& motorController); + Pinetime::Controllers::MotorController& motorController, + Pinetime::Controllers::AlertController& alertController); NotificationItem(const char* title, const char* msg, uint8_t notifNr, Controllers::NotificationManager::Categories, uint8_t notifNb, Pinetime::Controllers::AlertNotificationService& alertNotificationService, - Pinetime::Controllers::MotorController& motorController); + Pinetime::Controllers::MotorController& motorController, + Pinetime::Controllers::AlertController& alertController); ~NotificationItem(); bool IsRunning() const { @@ -64,6 +67,7 @@ namespace Pinetime { lv_obj_t* label_reject; Pinetime::Controllers::AlertNotificationService& alertNotificationService; Pinetime::Controllers::MotorController& motorController; + Pinetime::Controllers::AlertController& alertController; bool running = true; }; @@ -72,6 +76,7 @@ namespace Pinetime { Pinetime::Controllers::NotificationManager& notificationManager; Pinetime::Controllers::AlertNotificationService& alertNotificationService; Pinetime::Controllers::MotorController& motorController; + Pinetime::Controllers::AlertController& alertController; System::SystemTask& systemTask; Modes mode = Modes::Normal; std::unique_ptr currentItem; diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index b76affc976..1673048d05 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -158,7 +158,7 @@ void QuickSettings::OnButtonEvent(lv_obj_t* object) { settingsController.SetNotificationStatus(Controllers::Settings::Notification::On); lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn); lv_obj_set_state(btn3, static_cast(ButtonState::NotificationsOn)); - motorController.RunForDuration(35); + motorController.SingleVibration(35); } } else if (object == btn4) { diff --git a/src/main.cpp b/src/main.cpp index b205f1e6b3..f47bc7d490 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -111,6 +111,7 @@ Pinetime::Controllers::NotificationManager notificationManager; Pinetime::Controllers::MotionController motionController; Pinetime::Controllers::TimerController timerController; Pinetime::Controllers::AlarmController alarmController {dateTimeController}; +Pinetime::Controllers::AlertController alertController {motorController}; Pinetime::Controllers::TouchHandler touchHandler(touchPanel, lvgl); Pinetime::Controllers::ButtonHandler buttonHandler; Pinetime::Controllers::BrightnessController brightnessController {}; @@ -129,6 +130,7 @@ Pinetime::Applications::DisplayApp displayApp(lcd, motionController, timerController, alarmController, + alertController, brightnessController, touchHandler, fs); @@ -144,6 +146,7 @@ Pinetime::System::SystemTask systemTask(spi, dateTimeController, timerController, alarmController, + alertController, watchdog, notificationManager, motorController, diff --git a/src/systemtask/Messages.h b/src/systemtask/Messages.h index b7fee8a52c..5143e3db9a 100644 --- a/src/systemtask/Messages.h +++ b/src/systemtask/Messages.h @@ -27,7 +27,7 @@ namespace Pinetime { OnChargingEvent, OnPairing, SetOffAlarm, - StopRinging, + StopAlarm, MeasureBatteryTimerExpired, BatteryPercentageUpdated, LowBattery, diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 73f573fa0e..e6d57ad3db 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -58,7 +58,8 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi, Controllers::Ble& bleController, Controllers::DateTime& dateTimeController, Controllers::TimerController& timerController, - Controllers::AlarmController& alarmController, + Pinetime::Controllers::AlarmController& alarmController, + Pinetime::Controllers::AlertController& alertController, Drivers::Watchdog& watchdog, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::MotorController& motorController, @@ -83,6 +84,7 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi, dateTimeController {dateTimeController}, timerController {timerController}, alarmController {alarmController}, + alertController {alertController}, watchdog {watchdog}, notificationManager {notificationManager}, motorController {motorController}, @@ -209,6 +211,9 @@ void SystemTask::Work() { #pragma ide diagnostic ignored "EndlessLoop" while (true) { UpdateMotion(); + if (alertController.Update()) { + displayApp.PushMessage(alertController.DisplayMessage()); + } Messages msg; if (xQueueReceive(systemTasksMsgQueue, &msg, 100) == pdTRUE) { @@ -295,18 +300,18 @@ void SystemTask::Work() { if (state == SystemTaskState::Sleeping) { GoToRunning(); } - motorController.RunForDuration(35); + alertController.ActivateTimer(); displayApp.PushMessage(Pinetime::Applications::Display::Messages::TimerDone); break; case Messages::SetOffAlarm: if (state == SystemTaskState::Sleeping) { GoToRunning(); } - motorController.StartRinging(); + alertController.ActivateAlarm(); displayApp.PushMessage(Pinetime::Applications::Display::Messages::AlarmTriggered); break; - case Messages::StopRinging: - motorController.StopRinging(); + case Messages::StopAlarm: + alertController.DeactivateAlarm(); break; case Messages::BleConnected: ReloadIdleTimer(); @@ -397,7 +402,7 @@ void SystemTask::Work() { GoToRunning(); displayApp.PushMessage(Pinetime::Applications::Display::Messages::Clock); } - motorController.RunForDuration(35); + motorController.SingleVibration(35); } break; case Messages::OnNewHalfHour: @@ -409,12 +414,12 @@ void SystemTask::Work() { GoToRunning(); displayApp.PushMessage(Pinetime::Applications::Display::Messages::Clock); } - motorController.RunForDuration(35); + motorController.SingleVibration(35); } break; case Messages::OnChargingEvent: batteryController.ReadPowerState(); - motorController.RunForDuration(15); + motorController.SingleVibration(15); ReloadIdleTimer(); if (state == SystemTaskState::Sleeping) { GoToRunning(); @@ -440,7 +445,7 @@ void SystemTask::Work() { if (state == SystemTaskState::Sleeping) { GoToRunning(); } - motorController.RunForDuration(35); + motorController.SingleVibration(35); displayApp.PushMessage(Pinetime::Applications::Display::Messages::ShowPairingKey); break; case Messages::BleRadioEnableToggle: diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index 9c43b9b222..63ed769a5a 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/alert/AlertController.h" #include "components/fs/FS.h" #include "touchhandler/TouchHandler.h" #include "buttonhandler/ButtonHandler.h" @@ -68,6 +69,7 @@ namespace Pinetime { Controllers::DateTime& dateTimeController, Controllers::TimerController& timerController, Controllers::AlarmController& alarmController, + Controllers::AlertController& alertController, Drivers::Watchdog& watchdog, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::MotorController& motorController, @@ -113,6 +115,7 @@ namespace Pinetime { Pinetime::Controllers::DateTime& dateTimeController; Pinetime::Controllers::TimerController& timerController; Pinetime::Controllers::AlarmController& alarmController; + Pinetime::Controllers::AlertController& alertController; QueueHandle_t systemTasksMsgQueue; Pinetime::Drivers::Watchdog& watchdog; Pinetime::Controllers::NotificationManager& notificationManager;