summaryrefslogtreecommitdiff
path: root/src/displayapp
diff options
context:
space:
mode:
authorpetter <39340152+petterhs@users.noreply.github.com>2021-01-25 16:47:52 +0100
committerjlukanc <27705324+jlukanc1@users.noreply.github.com>2021-01-25 12:45:04 -0500
commit3dd88339f39089232c40f043a478b9ba47cb1dad (patch)
tree6f43eaac7fb7fc70a1932d1722d99492f6160938 /src/displayapp
parentf27e63290639ca257e88298b60429d72271c4954 (diff)
create motorcontroller in main and pass by reference
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/DisplayApp.cpp7
-rw-r--r--src/displayapp/DisplayApp.h3
-rw-r--r--src/displayapp/screens/Notifications.cpp10
-rw-r--r--src/displayapp/screens/Notifications.h7
4 files changed, 20 insertions, 7 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index b6ad90b4..12efe62b 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -5,6 +5,7 @@
#include "components/ble/BleController.h"
#include "components/datetime/DateTimeController.h"
#include "components/ble/NotificationManager.h"
+#include "components/motor/MotorController.h"
#include "displayapp/screens/ApplicationList.h"
#include "displayapp/screens/Brightness.h"
#include "displayapp/screens/Clock.h"
@@ -32,6 +33,7 @@ DisplayApp::DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Driver
Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog,
System::SystemTask &systemTask,
Pinetime::Controllers::NotificationManager& notificationManager,
+ Pinetime::Controllers::MotorController& motorController,
Pinetime::Controllers::HeartRateController& heartRateController) :
lcd{lcd},
lvgl{lvgl},
@@ -43,6 +45,7 @@ DisplayApp::DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Driver
currentScreen{new Screens::Clock(this, dateTimeController, batteryController, bleController, notificationManager, heartRateController) },
systemTask{systemTask},
notificationManager{notificationManager},
+ motorController{motorController},
heartRateController{heartRateController} {
msgQueue = xQueueCreate(queueSize, itemSize);
onClockApp = true;
@@ -124,7 +127,7 @@ void DisplayApp::Refresh() {
currentScreen.reset(nullptr);
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up);
onClockApp = false;
- currentScreen.reset(new Screens::Notifications(this, notificationManager, Screens::Notifications::Modes::Preview));
+ currentScreen.reset(new Screens::Notifications(this, notificationManager, motorController, Screens::Notifications::Modes::Preview));
}
}
break;
@@ -215,7 +218,7 @@ void DisplayApp::RunningState() {
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::FirmwareValidation: currentScreen.reset(new Screens::FirmwareValidation(this, validator)); break;
- case Apps::Notifications: currentScreen.reset(new Screens::Notifications(this, notificationManager, Screens::Notifications::Modes::Normal)); break;
+ case Apps::Notifications: currentScreen.reset(new Screens::Notifications(this, notificationManager, motorController, Screens::Notifications::Modes::Normal)); break;
case Apps::HeartRate: currentScreen.reset(new Screens::HeartRate(this, heartRateController)); break;
}
nextApp = Apps::None;
diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h
index da5a7b22..68730468 100644
--- a/src/displayapp/DisplayApp.h
+++ b/src/displayapp/DisplayApp.h
@@ -23,6 +23,7 @@ namespace Pinetime {
class Ble;
class DateTime;
class NotificationManager;
+ class MotorController;
class HeartRateController;
}
@@ -44,6 +45,7 @@ namespace Pinetime {
Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog,
System::SystemTask &systemTask,
Pinetime::Controllers::NotificationManager& notificationManager,
+ Pinetime::Controllers::MotorController& motorController,
Pinetime::Controllers::HeartRateController& heartRateController);
void Start();
void PushMessage(Messages msg);
@@ -87,6 +89,7 @@ namespace Pinetime {
Controllers::BrightnessController brightnessController;
std::unique_ptr<Screens::Modal> modal;
Pinetime::Controllers::NotificationManager& notificationManager;
+ Pinetime::Controllers::MotorController& motorController;
Pinetime::Controllers::FirmwareValidator validator;
TouchModes touchMode = TouchModes::Gestures;
Pinetime::Controllers::HeartRateController& heartRateController;
diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp
index cfcecec2..b777aca8 100644
--- a/src/displayapp/screens/Notifications.cpp
+++ b/src/displayapp/screens/Notifications.cpp
@@ -3,12 +3,16 @@
using namespace Pinetime::Applications::Screens;
-Notifications::Notifications(DisplayApp *app, Pinetime::Controllers::NotificationManager &notificationManager, Modes mode) :
- Screen(app), notificationManager{notificationManager}, mode{mode} {
+Notifications::Notifications(DisplayApp *app,
+ Pinetime::Controllers::NotificationManager &notificationManager,
+ Pinetime::Controllers::MotorController& motorController,
+ Modes mode) :
+ Screen(app), notificationManager{notificationManager},
+ motorController{motorController}, mode{mode} {
+
notificationManager.ClearNewNotificationFlag();
auto notification = notificationManager.GetLastNotification();
- motorController.Init(); //start the vibration timer setups
if(notification.valid) {
currentId = notification.id;
diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h
index 345ad15a..85d13545 100644
--- a/src/displayapp/screens/Notifications.h
+++ b/src/displayapp/screens/Notifications.h
@@ -13,7 +13,10 @@ namespace Pinetime {
class Notifications : public Screen {
public:
enum class Modes {Normal, Preview};
- explicit Notifications(DisplayApp* app, Pinetime::Controllers::NotificationManager& notificationManager, Modes mode);
+ explicit Notifications(DisplayApp* app,
+ Pinetime::Controllers::NotificationManager& notificationManager,
+ Pinetime::Controllers::MotorController& motorController,
+ Modes mode);
~Notifications() override;
bool Refresh() override;
@@ -46,7 +49,7 @@ namespace Pinetime {
const char* text;
};
Pinetime::Controllers::NotificationManager& notificationManager;
- Pinetime::Controllers::MotorController motorController;
+ Pinetime::Controllers::MotorController& motorController;
Modes mode = Modes::Normal;
std::unique_ptr<NotificationItem> currentItem;
Controllers::NotificationManager::Notification::Id currentId;