From 6e1726d1d03fd9643f1564603da7153090c2e138 Mon Sep 17 00:00:00 2001 From: petter <39340152+petterhs@users.noreply.github.com> Date: Tue, 20 Apr 2021 13:31:40 +0200 Subject: [PATCH] short vibration when enabling it --- src/displayapp/DisplayApp.cpp | 5 ++++- src/displayapp/DisplayApp.h | 3 +++ src/displayapp/DisplayAppRecovery.cpp | 1 + src/displayapp/DisplayAppRecovery.h | 2 ++ src/displayapp/screens/settings/QuickSettings.cpp | 3 +++ src/displayapp/screens/settings/QuickSettings.h | 3 +++ src/systemtask/SystemTask.cpp | 1 + 7 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 68f2d971..3a20c766 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -7,6 +7,7 @@ #include "components/datetime/DateTimeController.h" #include "components/ble/NotificationManager.h" #include "components/motion/MotionController.h" +#include "components/motor/MotorController.h" #include "displayapp/screens/ApplicationList.h" #include "displayapp/screens/Brightness.h" #include "displayapp/screens/Clock.h" @@ -51,6 +52,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::HeartRateController& heartRateController, Controllers::Settings& settingsController, + Pinetime::Controllers::MotorController& motorController, Pinetime::Controllers::MotionController& motionController) : lcd {lcd}, lvgl {lvgl}, @@ -63,6 +65,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, notificationManager {notificationManager}, heartRateController {heartRateController}, settingsController {settingsController}, + motorController{motorController}, motionController {motionController} { msgQueue = xQueueCreate(queueSize, itemSize); // Start clock when smartwatch boots @@ -262,7 +265,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) // Settings case Apps::QuickSettings: currentScreen = - std::make_unique(this, batteryController, dateTimeController, brightnessController, settingsController); + std::make_unique(this, batteryController, dateTimeController, brightnessController, motorController, settingsController); returnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft); break; case Apps::Settings: diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index ff5ddac8..75e52755 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -8,6 +8,7 @@ #include "LittleVgl.h" #include "TouchEvents.h" #include "components/brightness/BrightnessController.h" +#include "components/motor/MotorController.h" #include "components/firmwarevalidator/FirmwareValidator.h" #include "components/settings/Settings.h" #include "displayapp/screens/Screen.h" @@ -51,6 +52,7 @@ namespace Pinetime { Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::HeartRateController& heartRateController, Controllers::Settings& settingsController, + Pinetime::Controllers::MotorController& motorController, Pinetime::Controllers::MotionController& motionController); void Start(); void PushMessage(Display::Messages msg); @@ -72,6 +74,7 @@ namespace Pinetime { Pinetime::Controllers::NotificationManager& notificationManager; Pinetime::Controllers::HeartRateController& heartRateController; Pinetime::Controllers::Settings& settingsController; + Pinetime::Controllers::MotorController& motorController; Pinetime::Controllers::MotionController& motionController; Pinetime::Controllers::FirmwareValidator validator; diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp index 5c7dd03d..6db987fa 100644 --- a/src/displayapp/DisplayAppRecovery.cpp +++ b/src/displayapp/DisplayAppRecovery.cpp @@ -18,6 +18,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::HeartRateController& heartRateController, Pinetime::Controllers::Settings& settingsController, + Pinetime::Controllers::MotorController& motorController, Pinetime::Controllers::MotionController& motionController) : lcd {lcd}, bleController {bleController} { msgQueue = xQueueCreate(queueSize, itemSize); diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h index 025be6c0..30b8e0a1 100644 --- a/src/displayapp/DisplayAppRecovery.h +++ b/src/displayapp/DisplayAppRecovery.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "TouchEvents.h" #include "Apps.h" @@ -41,6 +42,7 @@ namespace Pinetime { Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::HeartRateController& heartRateController, Pinetime::Controllers::Settings& settingsController, + Pinetime::Controllers::MotorController& motorController, Pinetime::Controllers::MotionController& motionController); void Start(); void PushMessage(Pinetime::Applications::Display::Messages msg); diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index d19e4222..3994794d 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -21,11 +21,13 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Battery& batteryController, Controllers::DateTime& dateTimeController, Controllers::BrightnessController& brightness, + Controllers::MotorController& motorController, Pinetime::Controllers::Settings& settingsController) : Screen(app), batteryController {batteryController}, dateTimeController {dateTimeController}, brightness {brightness}, + motorController{motorController}, settingsController {settingsController} { // Time @@ -138,6 +140,7 @@ void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) { if (lv_obj_get_state(btn3, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) { settingsController.SetVibrationStatus(Controllers::Settings::Vibration::ON); + motorController.SetDuration(35); lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn); } else { settingsController.SetVibrationStatus(Controllers::Settings::Vibration::OFF); diff --git a/src/displayapp/screens/settings/QuickSettings.h b/src/displayapp/screens/settings/QuickSettings.h index 8d04bec3..a14f46bf 100644 --- a/src/displayapp/screens/settings/QuickSettings.h +++ b/src/displayapp/screens/settings/QuickSettings.h @@ -7,6 +7,7 @@ #include #include "components/datetime/DateTimeController.h" #include "components/brightness/BrightnessController.h" +#include "components/motor/MotorController.h" #include "components/settings/Settings.h" #include "components/battery/BatteryController.h" @@ -21,6 +22,7 @@ namespace Pinetime { Pinetime::Controllers::Battery& batteryController, Controllers::DateTime& dateTimeController, Controllers::BrightnessController& brightness, + Controllers::MotorController& motorController, Pinetime::Controllers::Settings& settingsController); ~QuickSettings() override; @@ -36,6 +38,7 @@ namespace Pinetime { Pinetime::Controllers::Battery& batteryController; Controllers::DateTime& dateTimeController; Controllers::BrightnessController& brightness; + Controllers::MotorController& motorController; Controllers::Settings& settingsController; lv_task_t* taskUpdate; diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 5b03fbbb..6d695e2c 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -115,6 +115,7 @@ void SystemTask::Work() { notificationManager, heartRateController, settingsController, + motorController, motionController); displayApp->Start();