trigger vibration from systemtask
This commit is contained in:
parent
da56ca5bfb
commit
1bd5457848
5 changed files with 9 additions and 21 deletions
|
@ -5,7 +5,6 @@
|
||||||
#include "components/ble/BleController.h"
|
#include "components/ble/BleController.h"
|
||||||
#include "components/datetime/DateTimeController.h"
|
#include "components/datetime/DateTimeController.h"
|
||||||
#include "components/ble/NotificationManager.h"
|
#include "components/ble/NotificationManager.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"
|
||||||
|
@ -33,7 +32,6 @@ DisplayApp::DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Driver
|
||||||
Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog,
|
Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog,
|
||||||
System::SystemTask &systemTask,
|
System::SystemTask &systemTask,
|
||||||
Pinetime::Controllers::NotificationManager& notificationManager,
|
Pinetime::Controllers::NotificationManager& notificationManager,
|
||||||
Pinetime::Controllers::MotorController& motorController,
|
|
||||||
Pinetime::Controllers::HeartRateController& heartRateController) :
|
Pinetime::Controllers::HeartRateController& heartRateController) :
|
||||||
lcd{lcd},
|
lcd{lcd},
|
||||||
lvgl{lvgl},
|
lvgl{lvgl},
|
||||||
|
@ -45,7 +43,6 @@ DisplayApp::DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Driver
|
||||||
currentScreen{new Screens::Clock(this, dateTimeController, batteryController, bleController, notificationManager, heartRateController) },
|
currentScreen{new Screens::Clock(this, dateTimeController, batteryController, bleController, notificationManager, heartRateController) },
|
||||||
systemTask{systemTask},
|
systemTask{systemTask},
|
||||||
notificationManager{notificationManager},
|
notificationManager{notificationManager},
|
||||||
motorController{motorController},
|
|
||||||
heartRateController{heartRateController} {
|
heartRateController{heartRateController} {
|
||||||
msgQueue = xQueueCreate(queueSize, itemSize);
|
msgQueue = xQueueCreate(queueSize, itemSize);
|
||||||
onClockApp = true;
|
onClockApp = true;
|
||||||
|
@ -127,7 +124,7 @@ void DisplayApp::Refresh() {
|
||||||
currentScreen.reset(nullptr);
|
currentScreen.reset(nullptr);
|
||||||
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up);
|
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up);
|
||||||
onClockApp = false;
|
onClockApp = false;
|
||||||
currentScreen.reset(new Screens::Notifications(this, notificationManager, motorController, Screens::Notifications::Modes::Preview));
|
currentScreen.reset(new Screens::Notifications(this, notificationManager, Screens::Notifications::Modes::Preview));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -218,7 +215,7 @@ void DisplayApp::RunningState() {
|
||||||
case Apps::Music : currentScreen.reset(new Screens::Music(this, systemTask.nimble().music())); break;
|
case Apps::Music : currentScreen.reset(new Screens::Music(this, systemTask.nimble().music())); break;
|
||||||
case Apps::Navigation : currentScreen.reset(new Screens::Navigation(this, systemTask.nimble().navigation())); break;
|
case Apps::Navigation : currentScreen.reset(new Screens::Navigation(this, systemTask.nimble().navigation())); break;
|
||||||
case Apps::FirmwareValidation: currentScreen.reset(new Screens::FirmwareValidation(this, validator)); break;
|
case Apps::FirmwareValidation: currentScreen.reset(new Screens::FirmwareValidation(this, validator)); break;
|
||||||
case Apps::Notifications: currentScreen.reset(new Screens::Notifications(this, notificationManager, motorController, Screens::Notifications::Modes::Normal)); break;
|
case Apps::Notifications: currentScreen.reset(new Screens::Notifications(this, notificationManager, Screens::Notifications::Modes::Normal)); break;
|
||||||
case Apps::HeartRate: currentScreen.reset(new Screens::HeartRate(this, heartRateController)); break;
|
case Apps::HeartRate: currentScreen.reset(new Screens::HeartRate(this, heartRateController)); break;
|
||||||
}
|
}
|
||||||
nextApp = Apps::None;
|
nextApp = Apps::None;
|
||||||
|
|
|
@ -23,7 +23,6 @@ namespace Pinetime {
|
||||||
class Ble;
|
class Ble;
|
||||||
class DateTime;
|
class DateTime;
|
||||||
class NotificationManager;
|
class NotificationManager;
|
||||||
class MotorController;
|
|
||||||
class HeartRateController;
|
class HeartRateController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +44,6 @@ namespace Pinetime {
|
||||||
Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog,
|
Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog,
|
||||||
System::SystemTask &systemTask,
|
System::SystemTask &systemTask,
|
||||||
Pinetime::Controllers::NotificationManager& notificationManager,
|
Pinetime::Controllers::NotificationManager& notificationManager,
|
||||||
Pinetime::Controllers::MotorController& motorController,
|
|
||||||
Pinetime::Controllers::HeartRateController& heartRateController);
|
Pinetime::Controllers::HeartRateController& heartRateController);
|
||||||
void Start();
|
void Start();
|
||||||
void PushMessage(Messages msg);
|
void PushMessage(Messages msg);
|
||||||
|
@ -89,7 +87,6 @@ namespace Pinetime {
|
||||||
Controllers::BrightnessController brightnessController;
|
Controllers::BrightnessController brightnessController;
|
||||||
std::unique_ptr<Screens::Modal> modal;
|
std::unique_ptr<Screens::Modal> modal;
|
||||||
Pinetime::Controllers::NotificationManager& notificationManager;
|
Pinetime::Controllers::NotificationManager& notificationManager;
|
||||||
Pinetime::Controllers::MotorController& motorController;
|
|
||||||
Pinetime::Controllers::FirmwareValidator validator;
|
Pinetime::Controllers::FirmwareValidator validator;
|
||||||
TouchModes touchMode = TouchModes::Gestures;
|
TouchModes touchMode = TouchModes::Gestures;
|
||||||
Pinetime::Controllers::HeartRateController& heartRateController;
|
Pinetime::Controllers::HeartRateController& heartRateController;
|
||||||
|
|
|
@ -5,10 +5,8 @@ using namespace Pinetime::Applications::Screens;
|
||||||
|
|
||||||
Notifications::Notifications(DisplayApp *app,
|
Notifications::Notifications(DisplayApp *app,
|
||||||
Pinetime::Controllers::NotificationManager ¬ificationManager,
|
Pinetime::Controllers::NotificationManager ¬ificationManager,
|
||||||
Pinetime::Controllers::MotorController& motorController,
|
|
||||||
Modes mode) :
|
Modes mode) :
|
||||||
Screen(app), notificationManager{notificationManager},
|
Screen(app), notificationManager{notificationManager}, mode{mode} {
|
||||||
motorController{motorController}, mode{mode} {
|
|
||||||
|
|
||||||
notificationManager.ClearNewNotificationFlag();
|
notificationManager.ClearNewNotificationFlag();
|
||||||
auto notification = notificationManager.GetLastNotification();
|
auto notification = notificationManager.GetLastNotification();
|
||||||
|
@ -29,8 +27,6 @@ Notifications::Notifications(DisplayApp *app,
|
||||||
style_line.line.width = 3;
|
style_line.line.width = 3;
|
||||||
style_line.line.rounded = 0;
|
style_line.line.rounded = 0;
|
||||||
|
|
||||||
motorController.SetDuration(35);
|
|
||||||
|
|
||||||
timeoutLine = lv_line_create(lv_scr_act(), nullptr);
|
timeoutLine = lv_line_create(lv_scr_act(), nullptr);
|
||||||
lv_line_set_style(timeoutLine, LV_LINE_STYLE_MAIN, &style_line);
|
lv_line_set_style(timeoutLine, LV_LINE_STYLE_MAIN, &style_line);
|
||||||
lv_line_set_points(timeoutLine, timeoutLinePoints, 2);
|
lv_line_set_points(timeoutLine, timeoutLinePoints, 2);
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "Screen.h"
|
#include "Screen.h"
|
||||||
#include "components/ble/NotificationManager.h"
|
#include "components/ble/NotificationManager.h"
|
||||||
#include "components/motor/MotorController.h"
|
|
||||||
|
|
||||||
namespace Pinetime {
|
namespace Pinetime {
|
||||||
namespace Applications {
|
namespace Applications {
|
||||||
|
@ -15,7 +14,6 @@ namespace Pinetime {
|
||||||
enum class Modes {Normal, Preview};
|
enum class Modes {Normal, Preview};
|
||||||
explicit Notifications(DisplayApp* app,
|
explicit Notifications(DisplayApp* app,
|
||||||
Pinetime::Controllers::NotificationManager& notificationManager,
|
Pinetime::Controllers::NotificationManager& notificationManager,
|
||||||
Pinetime::Controllers::MotorController& motorController,
|
|
||||||
Modes mode);
|
Modes mode);
|
||||||
~Notifications() override;
|
~Notifications() override;
|
||||||
|
|
||||||
|
@ -49,7 +47,6 @@ namespace Pinetime {
|
||||||
const char* text;
|
const char* text;
|
||||||
};
|
};
|
||||||
Pinetime::Controllers::NotificationManager& notificationManager;
|
Pinetime::Controllers::NotificationManager& notificationManager;
|
||||||
Pinetime::Controllers::MotorController& motorController;
|
|
||||||
Modes mode = Modes::Normal;
|
Modes mode = Modes::Normal;
|
||||||
std::unique_ptr<NotificationItem> currentItem;
|
std::unique_ptr<NotificationItem> currentItem;
|
||||||
Controllers::NotificationManager::Notification::Id currentId;
|
Controllers::NotificationManager::Notification::Id currentId;
|
||||||
|
|
|
@ -80,17 +80,17 @@ void SystemTask::Work() {
|
||||||
twiMaster.Init();
|
twiMaster.Init();
|
||||||
touchPanel.Init();
|
touchPanel.Init();
|
||||||
batteryController.Init();
|
batteryController.Init();
|
||||||
|
motorController.Init();
|
||||||
|
|
||||||
|
|
||||||
displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController,
|
displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController,
|
||||||
dateTimeController, watchdogView, *this, notificationManager,
|
dateTimeController, watchdogView, *this, notificationManager,
|
||||||
motorController, heartRateController));
|
heartRateController));
|
||||||
displayApp->Start();
|
displayApp->Start();
|
||||||
|
|
||||||
batteryController.Update();
|
batteryController.Update();
|
||||||
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateBatteryLevel);
|
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateBatteryLevel);
|
||||||
|
|
||||||
motorController.Init();
|
|
||||||
|
|
||||||
heartRateSensor.Init();
|
heartRateSensor.Init();
|
||||||
heartRateSensor.Disable();
|
heartRateSensor.Disable();
|
||||||
heartRateApp.reset(new Pinetime::Applications::HeartRateTask(heartRateSensor, heartRateController));
|
heartRateApp.reset(new Pinetime::Applications::HeartRateTask(heartRateSensor, heartRateController));
|
||||||
|
@ -162,6 +162,7 @@ void SystemTask::Work() {
|
||||||
break;
|
break;
|
||||||
case Messages::OnNewNotification:
|
case Messages::OnNewNotification:
|
||||||
if(isSleeping && !isWakingUp) GoToRunning();
|
if(isSleeping && !isWakingUp) GoToRunning();
|
||||||
|
motorController.SetDuration(35);
|
||||||
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification);
|
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification);
|
||||||
break;
|
break;
|
||||||
case Messages::BleConnected:
|
case Messages::BleConnected:
|
||||||
|
|
Loading…
Reference in a new issue