create motorcontroller in main and pass by reference

This commit is contained in:
petter
2021-01-25 16:47:52 +01:00
committed by jlukanc
parent f27e632906
commit 3dd88339f3
7 changed files with 31 additions and 10 deletions

View File

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

View File

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