Improvements
This commit is contained in:
parent
5bdef365f2
commit
e6dcb3009f
|
@ -16,41 +16,37 @@ void MotorController::Init() {
|
||||||
nrf_gpio_pin_set(pinMotor);
|
nrf_gpio_pin_set(pinMotor);
|
||||||
app_timer_init();
|
app_timer_init();
|
||||||
|
|
||||||
app_timer_create(&shortVibTimer, APP_TIMER_MODE_SINGLE_SHOT, vibrate);
|
app_timer_create(&shortVibTimer, APP_TIMER_MODE_SINGLE_SHOT, StopMotor);
|
||||||
app_timer_create(&longVibTimer, APP_TIMER_MODE_REPEATED, vibrate);
|
app_timer_create(&longVibTimer, APP_TIMER_MODE_REPEATED, Ring);
|
||||||
isBusy = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotorController::runForDuration(uint8_t motorDuration) {
|
void MotorController::Ring(void* p_context) {
|
||||||
|
auto* motorController = static_cast<MotorController*>(p_context);
|
||||||
|
motorController->RunForDuration(50);
|
||||||
|
}
|
||||||
|
|
||||||
if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF || isBusy)
|
void MotorController::RunForDuration(uint8_t motorDuration) {
|
||||||
|
if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
nrf_gpio_pin_clear(pinMotor);
|
nrf_gpio_pin_clear(pinMotor);
|
||||||
/* Start timer for motorDuration miliseconds and timer triggers vibrate() when it finishes*/
|
app_timer_start(shortVibTimer, APP_TIMER_TICKS(motorDuration), nullptr);
|
||||||
app_timer_start(shortVibTimer, APP_TIMER_TICKS(motorDuration), NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotorController::startRunning(uint8_t motorDuration) {
|
void MotorController::StartRinging() {
|
||||||
if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF || isBusy )
|
if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF) {
|
||||||
return;
|
return;
|
||||||
//prevent other vibrations while running
|
}
|
||||||
isBusy = true;
|
Ring(this);
|
||||||
nrf_gpio_pin_clear(pinMotor);
|
app_timer_start(longVibTimer, APP_TIMER_TICKS(1000), this);
|
||||||
app_timer_start(longVibTimer, APP_TIMER_TICKS(motorDuration), NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotorController::stopRunning() {
|
void MotorController::StopRinging() {
|
||||||
|
|
||||||
app_timer_stop(longVibTimer);
|
app_timer_stop(longVibTimer);
|
||||||
nrf_gpio_pin_set(pinMotor);
|
nrf_gpio_pin_set(pinMotor);
|
||||||
isBusy = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotorController::vibrate(void* p_context) {
|
void MotorController::StopMotor(void* p_context) {
|
||||||
if (nrf_gpio_pin_out_read(pinMotor) == 0) {
|
|
||||||
nrf_gpio_pin_set(pinMotor);
|
nrf_gpio_pin_set(pinMotor);
|
||||||
} else {
|
|
||||||
nrf_gpio_pin_clear(pinMotor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,14 +12,14 @@ namespace Pinetime {
|
||||||
public:
|
public:
|
||||||
MotorController(Controllers::Settings& settingsController);
|
MotorController(Controllers::Settings& settingsController);
|
||||||
void Init();
|
void Init();
|
||||||
void runForDuration(uint8_t motorDuration);
|
void RunForDuration(uint8_t motorDuration);
|
||||||
void startRunning(uint8_t motorDuration);
|
void StartRinging();
|
||||||
void stopRunning();
|
static void StopRinging();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static void Ring(void* p_context);
|
||||||
Controllers::Settings& settingsController;
|
Controllers::Settings& settingsController;
|
||||||
static void vibrate(void* p_context);
|
static void StopMotor(void* p_context);
|
||||||
bool isBusy;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,12 +336,12 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
|
||||||
|
|
||||||
case Apps::Notifications:
|
case Apps::Notifications:
|
||||||
currentScreen = std::make_unique<Screens::Notifications>(
|
currentScreen = std::make_unique<Screens::Notifications>(
|
||||||
this, notificationManager, systemTask->nimble().alertService(), motorController, Screens::Notifications::Modes::Normal);
|
this, notificationManager, systemTask->nimble().alertService(), Screens::Notifications::Modes::Normal);
|
||||||
ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
|
ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
|
||||||
break;
|
break;
|
||||||
case Apps::NotificationsPreview:
|
case Apps::NotificationsPreview:
|
||||||
currentScreen = std::make_unique<Screens::Notifications>(
|
currentScreen = std::make_unique<Screens::Notifications>(
|
||||||
this, notificationManager, systemTask->nimble().alertService(), motorController, Screens::Notifications::Modes::Preview);
|
this, notificationManager, systemTask->nimble().alertService(), Screens::Notifications::Modes::Preview);
|
||||||
ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
|
ReturnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp);
|
||||||
break;
|
break;
|
||||||
case Apps::Timer:
|
case Apps::Timer:
|
||||||
|
|
|
@ -109,9 +109,9 @@ bool Metronome::Refresh() {
|
||||||
startTime = xTaskGetTickCount();
|
startTime = xTaskGetTickCount();
|
||||||
if (counter == 0) {
|
if (counter == 0) {
|
||||||
counter = bpb;
|
counter = bpb;
|
||||||
motorController.SetDuration(90);
|
motorController.RunForDuration(90);
|
||||||
} else {
|
} else {
|
||||||
motorController.SetDuration(30);
|
motorController.RunForDuration(30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -11,13 +11,8 @@ extern lv_font_t jetbrains_mono_bold_20;
|
||||||
Notifications::Notifications(DisplayApp* app,
|
Notifications::Notifications(DisplayApp* app,
|
||||||
Pinetime::Controllers::NotificationManager& notificationManager,
|
Pinetime::Controllers::NotificationManager& notificationManager,
|
||||||
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
||||||
Controllers::MotorController& motorController,
|
|
||||||
Modes mode)
|
Modes mode)
|
||||||
: Screen(app),
|
: Screen(app), notificationManager {notificationManager}, alertNotificationService {alertNotificationService}, mode {mode} {
|
||||||
notificationManager{notificationManager},
|
|
||||||
alertNotificationService{alertNotificationService},
|
|
||||||
motorController{motorController},
|
|
||||||
mode{mode} {
|
|
||||||
notificationManager.ClearNewNotificationFlag();
|
notificationManager.ClearNewNotificationFlag();
|
||||||
auto notification = notificationManager.GetLastNotification();
|
auto notification = notificationManager.GetLastNotification();
|
||||||
if (notification.valid) {
|
if (notification.valid) {
|
||||||
|
@ -28,10 +23,7 @@ Notifications::Notifications(DisplayApp* app,
|
||||||
notification.category,
|
notification.category,
|
||||||
notificationManager.NbNotifications(),
|
notificationManager.NbNotifications(),
|
||||||
mode,
|
mode,
|
||||||
alertNotificationService,
|
alertNotificationService);
|
||||||
motorController,
|
|
||||||
&timeoutTickCountEnd,
|
|
||||||
&timeoutTickCountStart);
|
|
||||||
validDisplay = true;
|
validDisplay = true;
|
||||||
} else {
|
} else {
|
||||||
currentItem = std::make_unique<NotificationItem>("Notification",
|
currentItem = std::make_unique<NotificationItem>("Notification",
|
||||||
|
@ -40,14 +32,10 @@ Notifications::Notifications(DisplayApp* app,
|
||||||
notification.category,
|
notification.category,
|
||||||
notificationManager.NbNotifications(),
|
notificationManager.NbNotifications(),
|
||||||
Modes::Preview,
|
Modes::Preview,
|
||||||
alertNotificationService,
|
alertNotificationService);
|
||||||
motorController,
|
|
||||||
&timeoutTickCountEnd,
|
|
||||||
&timeoutTickCountStart);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == Modes::Preview) {
|
if (mode == Modes::Preview && notification.category != Controllers::NotificationManager::Categories::IncomingCall) {
|
||||||
|
|
||||||
timeoutLine = lv_line_create(lv_scr_act(), nullptr);
|
timeoutLine = lv_line_create(lv_scr_act(), nullptr);
|
||||||
|
|
||||||
lv_obj_set_style_local_line_width(timeoutLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3);
|
lv_obj_set_style_local_line_width(timeoutLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3);
|
||||||
|
@ -61,11 +49,13 @@ Notifications::Notifications(DisplayApp* app,
|
||||||
}
|
}
|
||||||
|
|
||||||
Notifications::~Notifications() {
|
Notifications::~Notifications() {
|
||||||
|
// make sure we stop any vibrations before exiting
|
||||||
|
Controllers::MotorController::StopRinging();
|
||||||
lv_obj_clean(lv_scr_act());
|
lv_obj_clean(lv_scr_act());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Notifications::Refresh() {
|
bool Notifications::Refresh() {
|
||||||
if (mode == Modes::Preview && !currentItem->timeoutOnHold) {
|
if (mode == Modes::Preview && timeoutLine != nullptr) {
|
||||||
auto tick = xTaskGetTickCount();
|
auto tick = xTaskGetTickCount();
|
||||||
int32_t pos = 240 - ((tick - timeoutTickCountStart) / ((timeoutTickCountEnd - timeoutTickCountStart) / 240));
|
int32_t pos = 240 - ((tick - timeoutTickCountStart) / ((timeoutTickCountEnd - timeoutTickCountStart) / 240));
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
|
@ -74,10 +64,7 @@ bool Notifications::Refresh() {
|
||||||
timeoutLinePoints[1].x = pos;
|
timeoutLinePoints[1].x = pos;
|
||||||
lv_line_set_points(timeoutLine, timeoutLinePoints, 2);
|
lv_line_set_points(timeoutLine, timeoutLinePoints, 2);
|
||||||
}
|
}
|
||||||
//make sure we stop any vibrations before exiting
|
return running && currentItem->IsRunning();
|
||||||
if (!running)
|
|
||||||
motorController.stopRunning();
|
|
||||||
return running;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||||
|
@ -105,10 +92,7 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||||
previousNotification.category,
|
previousNotification.category,
|
||||||
notificationManager.NbNotifications(),
|
notificationManager.NbNotifications(),
|
||||||
mode,
|
mode,
|
||||||
alertNotificationService,
|
alertNotificationService);
|
||||||
motorController,
|
|
||||||
&timeoutTickCountEnd,
|
|
||||||
&timeoutTickCountStart);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case Pinetime::Applications::TouchEvents::SwipeUp: {
|
case Pinetime::Applications::TouchEvents::SwipeUp: {
|
||||||
|
@ -133,10 +117,7 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||||
nextNotification.category,
|
nextNotification.category,
|
||||||
notificationManager.NbNotifications(),
|
notificationManager.NbNotifications(),
|
||||||
mode,
|
mode,
|
||||||
alertNotificationService,
|
alertNotificationService);
|
||||||
motorController,
|
|
||||||
&timeoutTickCountEnd,
|
|
||||||
&timeoutTickCountStart);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case Pinetime::Applications::TouchEvents::LongTap: {
|
case Pinetime::Applications::TouchEvents::LongTap: {
|
||||||
|
@ -149,19 +130,9 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
static void AcceptIncomingCallEventHandler(lv_obj_t* obj, lv_event_t event) {
|
void CallEventHandler(lv_obj_t* obj, lv_event_t event) {
|
||||||
auto* item = static_cast<Notifications::NotificationItem*>(obj->user_data);
|
auto* item = static_cast<Notifications::NotificationItem*>(obj->user_data);
|
||||||
item->OnAcceptIncomingCall(event);
|
item->OnCallButtonEvent(obj, event);
|
||||||
}
|
|
||||||
|
|
||||||
static void MuteIncomingCallEventHandler(lv_obj_t* obj, lv_event_t event) {
|
|
||||||
auto* item = static_cast<Notifications::NotificationItem*>(obj->user_data);
|
|
||||||
item->OnMuteIncomingCall(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void RejectIncomingCallEventHandler(lv_obj_t* obj, lv_event_t event) {
|
|
||||||
auto* item = static_cast<Notifications::NotificationItem*>(obj->user_data);
|
|
||||||
item->OnRejectIncomingCall(event);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,12 +142,8 @@ Notifications::NotificationItem::NotificationItem(const char* title,
|
||||||
Controllers::NotificationManager::Categories category,
|
Controllers::NotificationManager::Categories category,
|
||||||
uint8_t notifNb,
|
uint8_t notifNb,
|
||||||
Modes mode,
|
Modes mode,
|
||||||
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
Pinetime::Controllers::AlertNotificationService& alertNotificationService)
|
||||||
Controllers::MotorController& motorController,
|
: notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService} {
|
||||||
uint32_t* timeoutEnd,
|
|
||||||
uint32_t* timeoutStart)
|
|
||||||
: notifNr{notifNr}, notifNb{notifNb}, mode{mode}, alertNotificationService{alertNotificationService},
|
|
||||||
motorController{motorController}, timeoutEnd{timeoutEnd}, timeoutStart{timeoutStart} {
|
|
||||||
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), NULL);
|
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), NULL);
|
||||||
|
|
||||||
lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222));
|
lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222));
|
||||||
|
@ -234,7 +201,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
|
||||||
|
|
||||||
bt_accept = lv_btn_create(lv_scr_act(), nullptr);
|
bt_accept = lv_btn_create(lv_scr_act(), nullptr);
|
||||||
bt_accept->user_data = this;
|
bt_accept->user_data = this;
|
||||||
lv_obj_set_event_cb(bt_accept, AcceptIncomingCallEventHandler);
|
lv_obj_set_event_cb(bt_accept, CallEventHandler);
|
||||||
lv_obj_set_size(bt_accept, 76, 76);
|
lv_obj_set_size(bt_accept, 76, 76);
|
||||||
lv_obj_align(bt_accept, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
|
lv_obj_align(bt_accept, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
|
||||||
label_accept = lv_label_create(bt_accept, nullptr);
|
label_accept = lv_label_create(bt_accept, nullptr);
|
||||||
|
@ -243,7 +210,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
|
||||||
|
|
||||||
bt_reject = lv_btn_create(lv_scr_act(), nullptr);
|
bt_reject = lv_btn_create(lv_scr_act(), nullptr);
|
||||||
bt_reject->user_data = this;
|
bt_reject->user_data = this;
|
||||||
lv_obj_set_event_cb(bt_reject, RejectIncomingCallEventHandler);
|
lv_obj_set_event_cb(bt_reject, CallEventHandler);
|
||||||
lv_obj_set_size(bt_reject, 76, 76);
|
lv_obj_set_size(bt_reject, 76, 76);
|
||||||
lv_obj_align(bt_reject, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
lv_obj_align(bt_reject, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||||
label_reject = lv_label_create(bt_reject, nullptr);
|
label_reject = lv_label_create(bt_reject, nullptr);
|
||||||
|
@ -252,13 +219,12 @@ Notifications::NotificationItem::NotificationItem(const char* title,
|
||||||
|
|
||||||
bt_mute = lv_btn_create(lv_scr_act(), nullptr);
|
bt_mute = lv_btn_create(lv_scr_act(), nullptr);
|
||||||
bt_mute->user_data = this;
|
bt_mute->user_data = this;
|
||||||
lv_obj_set_event_cb(bt_mute, MuteIncomingCallEventHandler);
|
lv_obj_set_event_cb(bt_mute, CallEventHandler);
|
||||||
lv_obj_set_size(bt_mute, 76, 76);
|
lv_obj_set_size(bt_mute, 76, 76);
|
||||||
lv_obj_align(bt_mute, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
|
lv_obj_align(bt_mute, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
|
||||||
label_mute = lv_label_create(bt_mute, nullptr);
|
label_mute = lv_label_create(bt_mute, nullptr);
|
||||||
lv_label_set_text(label_mute, Symbols::volumMute);
|
lv_label_set_text(label_mute, Symbols::volumMute);
|
||||||
lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
|
lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
|
||||||
timeoutOnHold = true;
|
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,35 +235,24 @@ Notifications::NotificationItem::NotificationItem(const char* title,
|
||||||
lv_label_set_text(backgroundLabel, "");
|
lv_label_set_text(backgroundLabel, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notifications::NotificationItem::OnAcceptIncomingCall(lv_event_t event) {
|
void Notifications::NotificationItem::OnCallButtonEvent(lv_obj_t* obj, lv_event_t event) {
|
||||||
if (event != LV_EVENT_CLICKED)
|
if (event != LV_EVENT_CLICKED) {
|
||||||
return;
|
return;
|
||||||
callPreviewInteraction();
|
|
||||||
alertNotificationService.AcceptIncomingCall();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notifications::NotificationItem::OnMuteIncomingCall(lv_event_t event) {
|
Controllers::MotorController::StopRinging();
|
||||||
if (event != LV_EVENT_CLICKED)
|
|
||||||
return;
|
if (obj == bt_accept) {
|
||||||
callPreviewInteraction();
|
alertNotificationService.AcceptIncomingCall();
|
||||||
|
} else if (obj == bt_reject) {
|
||||||
|
alertNotificationService.RejectIncomingCall();
|
||||||
|
} else if (obj == bt_mute) {
|
||||||
alertNotificationService.MuteIncomingCall();
|
alertNotificationService.MuteIncomingCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notifications::NotificationItem::OnRejectIncomingCall(lv_event_t event) {
|
running = false;
|
||||||
if (event != LV_EVENT_CLICKED)
|
|
||||||
return;
|
|
||||||
callPreviewInteraction();
|
|
||||||
alertNotificationService.RejectIncomingCall();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Notifications::NotificationItem::callPreviewInteraction() {
|
|
||||||
*timeoutStart = xTaskGetTickCount();
|
|
||||||
*timeoutEnd = *timeoutStart + (5 * 1024);
|
|
||||||
timeoutOnHold = false;
|
|
||||||
motorController.stopRunning();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Notifications::NotificationItem::~NotificationItem() {
|
Notifications::NotificationItem::~NotificationItem() {
|
||||||
lv_obj_clean(lv_scr_act());
|
lv_obj_clean(lv_scr_act());
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 Controllers {
|
namespace Controllers {
|
||||||
|
@ -20,7 +19,6 @@ namespace Pinetime {
|
||||||
explicit Notifications(DisplayApp* app,
|
explicit Notifications(DisplayApp* app,
|
||||||
Pinetime::Controllers::NotificationManager& notificationManager,
|
Pinetime::Controllers::NotificationManager& notificationManager,
|
||||||
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
||||||
Controllers::MotorController& motorController,
|
|
||||||
Modes mode);
|
Modes mode);
|
||||||
~Notifications() override;
|
~Notifications() override;
|
||||||
|
|
||||||
|
@ -35,22 +33,14 @@ namespace Pinetime {
|
||||||
Controllers::NotificationManager::Categories,
|
Controllers::NotificationManager::Categories,
|
||||||
uint8_t notifNb,
|
uint8_t notifNb,
|
||||||
Modes mode,
|
Modes mode,
|
||||||
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
Pinetime::Controllers::AlertNotificationService& alertNotificationService);
|
||||||
Controllers::MotorController& motorController,
|
|
||||||
uint32_t* timeoutEnd,
|
|
||||||
uint32_t* timeoutStart);
|
|
||||||
~NotificationItem();
|
~NotificationItem();
|
||||||
bool Refresh() {
|
bool IsRunning() const {
|
||||||
return false;
|
return running;
|
||||||
}
|
}
|
||||||
void OnAcceptIncomingCall(lv_event_t event);
|
void OnCallButtonEvent(lv_obj_t*, lv_event_t event);
|
||||||
void OnMuteIncomingCall(lv_event_t event);
|
|
||||||
void OnRejectIncomingCall(lv_event_t event);
|
|
||||||
|
|
||||||
bool timeoutOnHold = false;
|
|
||||||
private:
|
private:
|
||||||
void callPreviewInteraction();
|
|
||||||
|
|
||||||
uint8_t notifNr = 0;
|
uint8_t notifNr = 0;
|
||||||
uint8_t notifNb = 0;
|
uint8_t notifNb = 0;
|
||||||
char pageText[4];
|
char pageText[4];
|
||||||
|
@ -66,11 +56,9 @@ namespace Pinetime {
|
||||||
lv_obj_t* label_mute;
|
lv_obj_t* label_mute;
|
||||||
lv_obj_t* label_reject;
|
lv_obj_t* label_reject;
|
||||||
lv_obj_t* bottomPlaceholder;
|
lv_obj_t* bottomPlaceholder;
|
||||||
uint32_t* timeoutEnd;
|
|
||||||
uint32_t* timeoutStart;
|
|
||||||
Modes mode;
|
Modes mode;
|
||||||
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
|
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
|
||||||
Controllers::MotorController& motorController;
|
bool running = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -83,11 +71,10 @@ namespace Pinetime {
|
||||||
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;
|
||||||
Controllers::MotorController& motorController;
|
|
||||||
bool validDisplay = false;
|
bool validDisplay = false;
|
||||||
|
|
||||||
lv_point_t timeoutLinePoints[2] {{0, 1}, {239, 1}};
|
lv_point_t timeoutLinePoints[2] {{0, 1}, {239, 1}};
|
||||||
lv_obj_t* timeoutLine;
|
lv_obj_t* timeoutLine = nullptr;
|
||||||
uint32_t timeoutTickCountStart;
|
uint32_t timeoutTickCountStart;
|
||||||
uint32_t timeoutTickCountEnd;
|
uint32_t timeoutTickCountEnd;
|
||||||
};
|
};
|
||||||
|
|
|
@ -140,7 +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) {
|
if (lv_obj_get_state(btn3, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
|
||||||
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::ON);
|
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::ON);
|
||||||
motorController.runForDuration(35);
|
motorController.RunForDuration(35);
|
||||||
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
|
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
|
||||||
} else {
|
} else {
|
||||||
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::OFF);
|
settingsController.SetVibrationStatus(Controllers::Settings::Vibration::OFF);
|
||||||
|
|
|
@ -267,16 +267,17 @@ void SystemTask::Work() {
|
||||||
GoToRunning();
|
GoToRunning();
|
||||||
}
|
}
|
||||||
if (notificationManager.GetLastNotification().category == Controllers::NotificationManager::Categories::IncomingCall) {
|
if (notificationManager.GetLastNotification().category == Controllers::NotificationManager::Categories::IncomingCall) {
|
||||||
motorController.startRunning(500);
|
motorController.StartRinging();
|
||||||
} else {
|
} else {
|
||||||
motorController.runForDuration(35);
|
motorController.RunForDuration(35);
|
||||||
}
|
}
|
||||||
displayApp.PushMessage(Pinetime::Applications::Display::Messages::NewNotification);
|
displayApp.PushMessage(Pinetime::Applications::Display::Messages::NewNotification);
|
||||||
|
break;
|
||||||
case Messages::OnTimerDone:
|
case Messages::OnTimerDone:
|
||||||
if (isSleeping && !isWakingUp) {
|
if (isSleeping && !isWakingUp) {
|
||||||
GoToRunning();
|
GoToRunning();
|
||||||
}
|
}
|
||||||
motorController.runForDuration(35);
|
motorController.RunForDuration(35);
|
||||||
displayApp.PushMessage(Pinetime::Applications::Display::Messages::TimerDone);
|
displayApp.PushMessage(Pinetime::Applications::Display::Messages::TimerDone);
|
||||||
break;
|
break;
|
||||||
case Messages::BleConnected:
|
case Messages::BleConnected:
|
||||||
|
@ -329,7 +330,7 @@ void SystemTask::Work() {
|
||||||
stepCounterMustBeReset = true;
|
stepCounterMustBeReset = true;
|
||||||
break;
|
break;
|
||||||
case Messages::OnChargingEvent:
|
case Messages::OnChargingEvent:
|
||||||
motorController.SetDuration(15);
|
motorController.RunForDuration(15);
|
||||||
// Battery level is updated on every message - there's no need to do anything
|
// Battery level is updated on every message - there's no need to do anything
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue