1
0
Fork 0

Merge pull request #301 from petterhs/vib

Short vibration when enabling it in quick settings menu
This commit is contained in:
JF002 2021-05-02 11:58:48 +02:00 committed by GitHub
commit 9f15fd1820
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 1 deletions

View file

@ -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<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);
break;
case Apps::Settings:

View file

@ -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;

View file

@ -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);

View file

@ -17,6 +17,7 @@
#include <drivers/Watchdog.h>
#include <components/heartrate/HeartRateController.h>
#include <components/motion/MotionController.h>
#include <components/motor/MotorController.h>
#include <components/settings/Settings.h>
#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);

View file

@ -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);

View file

@ -7,6 +7,7 @@
#include <lvgl/lvgl.h>
#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;

View file

@ -115,6 +115,7 @@ void SystemTask::Work() {
notificationManager,
heartRateController,
settingsController,
motorController,
motionController);
displayApp->Start();