Merge pull request #301 from petterhs/vib
Short vibration when enabling it in quick settings menu
This commit is contained in:
commit
9f15fd1820
7 changed files with 17 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include "components/datetime/DateTimeController.h"
|
#include "components/datetime/DateTimeController.h"
|
||||||
#include "components/ble/NotificationManager.h"
|
#include "components/ble/NotificationManager.h"
|
||||||
#include "components/motion/MotionController.h"
|
#include "components/motion/MotionController.h"
|
||||||
|
#include "components/motor/MotorController.h"
|
||||||
#include "displayapp/screens/ApplicationList.h"
|
#include "displayapp/screens/ApplicationList.h"
|
||||||
#include "displayapp/screens/Brightness.h"
|
#include "displayapp/screens/Brightness.h"
|
||||||
#include "displayapp/screens/Clock.h"
|
#include "displayapp/screens/Clock.h"
|
||||||
|
@ -51,6 +52,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
||||||
Pinetime::Controllers::NotificationManager& notificationManager,
|
Pinetime::Controllers::NotificationManager& notificationManager,
|
||||||
Pinetime::Controllers::HeartRateController& heartRateController,
|
Pinetime::Controllers::HeartRateController& heartRateController,
|
||||||
Controllers::Settings& settingsController,
|
Controllers::Settings& settingsController,
|
||||||
|
Pinetime::Controllers::MotorController& motorController,
|
||||||
Pinetime::Controllers::MotionController& motionController)
|
Pinetime::Controllers::MotionController& motionController)
|
||||||
: lcd {lcd},
|
: lcd {lcd},
|
||||||
lvgl {lvgl},
|
lvgl {lvgl},
|
||||||
|
@ -63,6 +65,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
||||||
notificationManager {notificationManager},
|
notificationManager {notificationManager},
|
||||||
heartRateController {heartRateController},
|
heartRateController {heartRateController},
|
||||||
settingsController {settingsController},
|
settingsController {settingsController},
|
||||||
|
motorController{motorController},
|
||||||
motionController {motionController} {
|
motionController {motionController} {
|
||||||
msgQueue = xQueueCreate(queueSize, itemSize);
|
msgQueue = xQueueCreate(queueSize, itemSize);
|
||||||
// Start clock when smartwatch boots
|
// Start clock when smartwatch boots
|
||||||
|
@ -262,7 +265,7 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
|
||||||
// Settings
|
// Settings
|
||||||
case Apps::QuickSettings:
|
case Apps::QuickSettings:
|
||||||
currentScreen =
|
currentScreen =
|
||||||
std::make_unique<Screens::QuickSettings>(this, batteryController, dateTimeController, brightnessController, settingsController);
|
std::make_unique<Screens::QuickSettings>(this, batteryController, dateTimeController, brightnessController, motorController, settingsController);
|
||||||
returnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft);
|
returnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft);
|
||||||
break;
|
break;
|
||||||
case Apps::Settings:
|
case Apps::Settings:
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "LittleVgl.h"
|
#include "LittleVgl.h"
|
||||||
#include "TouchEvents.h"
|
#include "TouchEvents.h"
|
||||||
#include "components/brightness/BrightnessController.h"
|
#include "components/brightness/BrightnessController.h"
|
||||||
|
#include "components/motor/MotorController.h"
|
||||||
#include "components/firmwarevalidator/FirmwareValidator.h"
|
#include "components/firmwarevalidator/FirmwareValidator.h"
|
||||||
#include "components/settings/Settings.h"
|
#include "components/settings/Settings.h"
|
||||||
#include "displayapp/screens/Screen.h"
|
#include "displayapp/screens/Screen.h"
|
||||||
|
@ -51,6 +52,7 @@ namespace Pinetime {
|
||||||
Pinetime::Controllers::NotificationManager& notificationManager,
|
Pinetime::Controllers::NotificationManager& notificationManager,
|
||||||
Pinetime::Controllers::HeartRateController& heartRateController,
|
Pinetime::Controllers::HeartRateController& heartRateController,
|
||||||
Controllers::Settings& settingsController,
|
Controllers::Settings& settingsController,
|
||||||
|
Pinetime::Controllers::MotorController& motorController,
|
||||||
Pinetime::Controllers::MotionController& motionController);
|
Pinetime::Controllers::MotionController& motionController);
|
||||||
void Start();
|
void Start();
|
||||||
void PushMessage(Display::Messages msg);
|
void PushMessage(Display::Messages msg);
|
||||||
|
@ -72,6 +74,7 @@ namespace Pinetime {
|
||||||
Pinetime::Controllers::NotificationManager& notificationManager;
|
Pinetime::Controllers::NotificationManager& notificationManager;
|
||||||
Pinetime::Controllers::HeartRateController& heartRateController;
|
Pinetime::Controllers::HeartRateController& heartRateController;
|
||||||
Pinetime::Controllers::Settings& settingsController;
|
Pinetime::Controllers::Settings& settingsController;
|
||||||
|
Pinetime::Controllers::MotorController& motorController;
|
||||||
Pinetime::Controllers::MotionController& motionController;
|
Pinetime::Controllers::MotionController& motionController;
|
||||||
|
|
||||||
Pinetime::Controllers::FirmwareValidator validator;
|
Pinetime::Controllers::FirmwareValidator validator;
|
||||||
|
|
|
@ -18,6 +18,7 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
||||||
Pinetime::Controllers::NotificationManager& notificationManager,
|
Pinetime::Controllers::NotificationManager& notificationManager,
|
||||||
Pinetime::Controllers::HeartRateController& heartRateController,
|
Pinetime::Controllers::HeartRateController& heartRateController,
|
||||||
Pinetime::Controllers::Settings& settingsController,
|
Pinetime::Controllers::Settings& settingsController,
|
||||||
|
Pinetime::Controllers::MotorController& motorController,
|
||||||
Pinetime::Controllers::MotionController& motionController)
|
Pinetime::Controllers::MotionController& motionController)
|
||||||
: lcd {lcd}, bleController {bleController} {
|
: lcd {lcd}, bleController {bleController} {
|
||||||
msgQueue = xQueueCreate(queueSize, itemSize);
|
msgQueue = xQueueCreate(queueSize, itemSize);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <drivers/Watchdog.h>
|
#include <drivers/Watchdog.h>
|
||||||
#include <components/heartrate/HeartRateController.h>
|
#include <components/heartrate/HeartRateController.h>
|
||||||
#include <components/motion/MotionController.h>
|
#include <components/motion/MotionController.h>
|
||||||
|
#include <components/motor/MotorController.h>
|
||||||
#include <components/settings/Settings.h>
|
#include <components/settings/Settings.h>
|
||||||
#include "TouchEvents.h"
|
#include "TouchEvents.h"
|
||||||
#include "Apps.h"
|
#include "Apps.h"
|
||||||
|
@ -41,6 +42,7 @@ namespace Pinetime {
|
||||||
Pinetime::Controllers::NotificationManager& notificationManager,
|
Pinetime::Controllers::NotificationManager& notificationManager,
|
||||||
Pinetime::Controllers::HeartRateController& heartRateController,
|
Pinetime::Controllers::HeartRateController& heartRateController,
|
||||||
Pinetime::Controllers::Settings& settingsController,
|
Pinetime::Controllers::Settings& settingsController,
|
||||||
|
Pinetime::Controllers::MotorController& motorController,
|
||||||
Pinetime::Controllers::MotionController& motionController);
|
Pinetime::Controllers::MotionController& motionController);
|
||||||
void Start();
|
void Start();
|
||||||
void PushMessage(Pinetime::Applications::Display::Messages msg);
|
void PushMessage(Pinetime::Applications::Display::Messages msg);
|
||||||
|
|
|
@ -21,11 +21,13 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
|
||||||
Pinetime::Controllers::Battery& batteryController,
|
Pinetime::Controllers::Battery& batteryController,
|
||||||
Controllers::DateTime& dateTimeController,
|
Controllers::DateTime& dateTimeController,
|
||||||
Controllers::BrightnessController& brightness,
|
Controllers::BrightnessController& brightness,
|
||||||
|
Controllers::MotorController& motorController,
|
||||||
Pinetime::Controllers::Settings& settingsController)
|
Pinetime::Controllers::Settings& settingsController)
|
||||||
: Screen(app),
|
: Screen(app),
|
||||||
batteryController {batteryController},
|
batteryController {batteryController},
|
||||||
dateTimeController {dateTimeController},
|
dateTimeController {dateTimeController},
|
||||||
brightness {brightness},
|
brightness {brightness},
|
||||||
|
motorController{motorController},
|
||||||
settingsController {settingsController} {
|
settingsController {settingsController} {
|
||||||
|
|
||||||
// Time
|
// 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) {
|
if (lv_obj_get_state(btn3, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
|
||||||
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::ON);
|
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::ON);
|
||||||
|
motorController.SetDuration(35);
|
||||||
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
|
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
|
||||||
} else {
|
} else {
|
||||||
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::OFF);
|
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::OFF);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <lvgl/lvgl.h>
|
#include <lvgl/lvgl.h>
|
||||||
#include "components/datetime/DateTimeController.h"
|
#include "components/datetime/DateTimeController.h"
|
||||||
#include "components/brightness/BrightnessController.h"
|
#include "components/brightness/BrightnessController.h"
|
||||||
|
#include "components/motor/MotorController.h"
|
||||||
#include "components/settings/Settings.h"
|
#include "components/settings/Settings.h"
|
||||||
#include "components/battery/BatteryController.h"
|
#include "components/battery/BatteryController.h"
|
||||||
|
|
||||||
|
@ -21,6 +22,7 @@ namespace Pinetime {
|
||||||
Pinetime::Controllers::Battery& batteryController,
|
Pinetime::Controllers::Battery& batteryController,
|
||||||
Controllers::DateTime& dateTimeController,
|
Controllers::DateTime& dateTimeController,
|
||||||
Controllers::BrightnessController& brightness,
|
Controllers::BrightnessController& brightness,
|
||||||
|
Controllers::MotorController& motorController,
|
||||||
Pinetime::Controllers::Settings& settingsController);
|
Pinetime::Controllers::Settings& settingsController);
|
||||||
|
|
||||||
~QuickSettings() override;
|
~QuickSettings() override;
|
||||||
|
@ -36,6 +38,7 @@ namespace Pinetime {
|
||||||
Pinetime::Controllers::Battery& batteryController;
|
Pinetime::Controllers::Battery& batteryController;
|
||||||
Controllers::DateTime& dateTimeController;
|
Controllers::DateTime& dateTimeController;
|
||||||
Controllers::BrightnessController& brightness;
|
Controllers::BrightnessController& brightness;
|
||||||
|
Controllers::MotorController& motorController;
|
||||||
Controllers::Settings& settingsController;
|
Controllers::Settings& settingsController;
|
||||||
|
|
||||||
lv_task_t* taskUpdate;
|
lv_task_t* taskUpdate;
|
||||||
|
|
|
@ -115,6 +115,7 @@ void SystemTask::Work() {
|
||||||
notificationManager,
|
notificationManager,
|
||||||
heartRateController,
|
heartRateController,
|
||||||
settingsController,
|
settingsController,
|
||||||
|
motorController,
|
||||||
motionController);
|
motionController);
|
||||||
displayApp->Start();
|
displayApp->Start();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue