add motor to notifs, fix tabs in motorcontroller.h
This commit is contained in:
parent
ce6c5d3bd3
commit
b5992fd7ec
3 changed files with 40 additions and 34 deletions
|
@ -7,50 +7,50 @@ namespace Pinetime {
|
||||||
static constexpr uint8_t pinMotor = 16;
|
static constexpr uint8_t pinMotor = 16;
|
||||||
|
|
||||||
class MotorController {
|
class MotorController {
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init();
|
||||||
void SetDuration(uint8_t motorDuration);
|
void SetDuration(uint8_t motorDuration);
|
||||||
#ifndef NRF_CLOCK_ENABLED
|
#ifndef NRF_CLOCK_ENABLED
|
||||||
#define NRF_CLOCK_ENABLED 1
|
#define NRF_CLOCK_ENABLED 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CLOCK_CONFIG_LF_SRC
|
#ifndef CLOCK_CONFIG_LF_SRC
|
||||||
#define CLOCK_CONFIG_LF_SRC 1
|
#define CLOCK_CONFIG_LF_SRC 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CLOCK_CONFIG_IRQ_PRIORITY
|
#ifndef CLOCK_CONFIG_IRQ_PRIORITY
|
||||||
#define CLOCK_CONFIG_IRQ_PRIORITY 6
|
#define CLOCK_CONFIG_IRQ_PRIORITY 6
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define APP_TIMER_ENABLED 1
|
#define APP_TIMER_ENABLED 1
|
||||||
#define APP_TIMER_CONFIG_RTC_FREQUENCY 15 //2048hz
|
#define APP_TIMER_CONFIG_RTC_FREQUENCY 15 //2048hz
|
||||||
#define APP_TIMER_CONFIG_IRQ_PRIORITY 6
|
#define APP_TIMER_CONFIG_IRQ_PRIORITY 6
|
||||||
|
|
||||||
#ifndef APP_TIMER_CONFIG_OP_QUEUE_SIZE
|
#ifndef APP_TIMER_CONFIG_OP_QUEUE_SIZE
|
||||||
#define APP_TIMER_CONFIG_OP_QUEUE_SIZE 10
|
#define APP_TIMER_CONFIG_OP_QUEUE_SIZE 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef APP_TIMER_CONFIG_USE_SCHEDULER
|
#ifndef APP_TIMER_CONFIG_USE_SCHEDULER
|
||||||
#define APP_TIMER_CONFIG_USE_SCHEDULER 0
|
#define APP_TIMER_CONFIG_USE_SCHEDULER 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef APP_TIMER_KEEPS_RTC_ACTIVE
|
#ifndef APP_TIMER_KEEPS_RTC_ACTIVE
|
||||||
#define APP_TIMER_KEEPS_RTC_ACTIVE 0
|
#define APP_TIMER_KEEPS_RTC_ACTIVE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef APP_TIMER_SAFE_WINDOW_MS
|
#ifndef APP_TIMER_SAFE_WINDOW_MS
|
||||||
#define APP_TIMER_SAFE_WINDOW_MS 300000
|
#define APP_TIMER_SAFE_WINDOW_MS 300000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef APP_TIMER_WITH_PROFILER
|
#ifndef APP_TIMER_WITH_PROFILER
|
||||||
#define APP_TIMER_WITH_PROFILER 0
|
#define APP_TIMER_WITH_PROFILER 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef APP_TIMER_CONFIG_SWI_NUMBER
|
#ifndef APP_TIMER_CONFIG_SWI_NUMBER
|
||||||
#define APP_TIMER_CONFIG_SWI_NUMBER 0
|
#define APP_TIMER_CONFIG_SWI_NUMBER 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,9 @@ Notifications::Notifications(DisplayApp *app, Pinetime::Controllers::Notificatio
|
||||||
Screen(app), notificationManager{notificationManager}, mode{mode} {
|
Screen(app), notificationManager{notificationManager}, mode{mode} {
|
||||||
notificationManager.ClearNewNotificationFlag();
|
notificationManager.ClearNewNotificationFlag();
|
||||||
auto notification = notificationManager.GetLastNotification();
|
auto notification = notificationManager.GetLastNotification();
|
||||||
|
|
||||||
|
motorController.Init(); //start the vibration timer setups
|
||||||
|
|
||||||
if(notification.valid) {
|
if(notification.valid) {
|
||||||
currentId = notification.id;
|
currentId = notification.id;
|
||||||
currentItem.reset(new NotificationItem("\nNotification", notification.message.data(), notification.index, notificationManager.NbNotifications(), mode));
|
currentItem.reset(new NotificationItem("\nNotification", notification.message.data(), notification.index, notificationManager.NbNotifications(), mode));
|
||||||
|
@ -22,6 +25,7 @@ Notifications::Notifications(DisplayApp *app, Pinetime::Controllers::Notificatio
|
||||||
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);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#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 {
|
||||||
|
@ -45,6 +46,7 @@ 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;
|
||||||
|
|
Loading…
Reference in a new issue