cleaned up the code and reduced the size of the diff by removing things like additional whitespaces
This commit is contained in:
parent
5da65494b3
commit
56af4a0b83
|
@ -21,7 +21,7 @@ void MotorController::Init() {
|
||||||
isBusy = false;
|
isBusy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotorController::RunForDuration(uint8_t motorDuration) {
|
void MotorController::runForDuration(uint8_t motorDuration) {
|
||||||
|
|
||||||
if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF || isBusy)
|
if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF || isBusy)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -12,7 +12,7 @@ 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 startRunning(uint8_t motorDuration);
|
||||||
void stopRunning();
|
void stopRunning();
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,11 @@ Notifications::Notifications(DisplayApp* app,
|
||||||
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
||||||
Controllers::MotorController& motorController,
|
Controllers::MotorController& motorController,
|
||||||
Modes mode)
|
Modes mode)
|
||||||
: Screen(app),
|
: Screen(app),
|
||||||
notificationManager {notificationManager},
|
notificationManager{notificationManager},
|
||||||
alertNotificationService {alertNotificationService},
|
alertNotificationService{alertNotificationService},
|
||||||
motorController{motorController},
|
motorController{motorController},
|
||||||
mode {mode} {
|
mode{mode} {
|
||||||
notificationManager.ClearNewNotificationFlag();
|
notificationManager.ClearNewNotificationFlag();
|
||||||
auto notification = notificationManager.GetLastNotification();
|
auto notification = notificationManager.GetLastNotification();
|
||||||
if (notification.valid) {
|
if (notification.valid) {
|
||||||
|
@ -45,8 +45,6 @@ Notifications::Notifications(DisplayApp* app,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == Modes::Preview) {
|
if (mode == Modes::Preview) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
timeoutLine = lv_line_create(lv_scr_act(), nullptr);
|
timeoutLine = lv_line_create(lv_scr_act(), nullptr);
|
||||||
|
|
||||||
|
@ -75,9 +73,8 @@ bool Notifications::Refresh() {
|
||||||
lv_line_set_points(timeoutLine, timeoutLinePoints, 2);
|
lv_line_set_points(timeoutLine, timeoutLinePoints, 2);
|
||||||
}
|
}
|
||||||
//make sure we stop any vibrations before exiting
|
//make sure we stop any vibrations before exiting
|
||||||
if (!running) {
|
if (!running)
|
||||||
motorController.stopRunning();
|
motorController.stopRunning();
|
||||||
}
|
|
||||||
return running;
|
return running;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,9 +170,8 @@ Notifications::NotificationItem::NotificationItem(const char* title,
|
||||||
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
|
||||||
Controllers::MotorController& motorController,
|
Controllers::MotorController& motorController,
|
||||||
uint32_t* timeoutEnd)
|
uint32_t* timeoutEnd)
|
||||||
: notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService},
|
: notifNr{notifNr}, notifNb{notifNb}, mode{mode}, alertNotificationService{alertNotificationService},
|
||||||
motorController{motorController}, timeoutEnd{timeoutEnd} {
|
motorController{motorController}, timeoutEnd{timeoutEnd} {
|
||||||
|
|
||||||
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));
|
||||||
|
@ -260,7 +256,6 @@ Notifications::NotificationItem::NotificationItem(const char* title,
|
||||||
timeoutOnHold = true;
|
timeoutOnHold = true;
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
|
lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
|
||||||
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
|
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
|
||||||
|
@ -291,7 +286,7 @@ void Notifications::NotificationItem::OnRejectIncomingCall(lv_event_t event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Notifications::NotificationItem::callPreviewInteraction() {
|
inline void Notifications::NotificationItem::callPreviewInteraction() {
|
||||||
*timeoutEnd = xTaskGetTickCount() + (5 * 1024);
|
*timeoutEnd = xTaskGetTickCount() + (5 * 1024);
|
||||||
timeoutOnHold = false;
|
timeoutOnHold = false;
|
||||||
motorController.stopRunning();
|
motorController.stopRunning();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ namespace Pinetime {
|
||||||
void OnAcceptIncomingCall(lv_event_t event);
|
void OnAcceptIncomingCall(lv_event_t event);
|
||||||
void OnMuteIncomingCall(lv_event_t event);
|
void OnMuteIncomingCall(lv_event_t event);
|
||||||
void OnRejectIncomingCall(lv_event_t event);
|
void OnRejectIncomingCall(lv_event_t event);
|
||||||
|
|
||||||
bool timeoutOnHold = false;
|
bool timeoutOnHold = false;
|
||||||
private:
|
private:
|
||||||
void callPreviewInteraction();
|
void callPreviewInteraction();
|
||||||
|
@ -81,7 +82,6 @@ namespace Pinetime {
|
||||||
std::unique_ptr<NotificationItem> currentItem;
|
std::unique_ptr<NotificationItem> currentItem;
|
||||||
Controllers::NotificationManager::Notification::Id currentId;
|
Controllers::NotificationManager::Notification::Id currentId;
|
||||||
Controllers::MotorController& motorController;
|
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}};
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -228,7 +228,7 @@ void SystemTask::Work() {
|
||||||
if (notificationManager.GetLastNotification().category == Controllers::NotificationManager::Categories::IncomingCall) {
|
if (notificationManager.GetLastNotification().category == Controllers::NotificationManager::Categories::IncomingCall) {
|
||||||
motorController.startRunning(500);
|
motorController.startRunning(500);
|
||||||
} else {
|
} else {
|
||||||
motorController.RunForDuration(35);
|
motorController.runForDuration(35);
|
||||||
}
|
}
|
||||||
displayApp->PushMessage(Pinetime::Applications::Display::Messages::NewNotification);
|
displayApp->PushMessage(Pinetime::Applications::Display::Messages::NewNotification);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user