summaryrefslogtreecommitdiff
path: root/src/displayapp
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp')
-rw-r--r--src/displayapp/DisplayApp.cpp10
-rw-r--r--src/displayapp/screens/FirmwareValidation.cpp6
-rw-r--r--src/displayapp/screens/HeartRate.cpp8
-rw-r--r--src/displayapp/screens/Motion.cpp12
-rw-r--r--src/displayapp/screens/Notifications.cpp18
-rw-r--r--src/displayapp/screens/Steps.h1
-rw-r--r--src/displayapp/screens/SystemInfo.cpp4
-rw-r--r--src/displayapp/screens/Tile.cpp8
-rw-r--r--src/displayapp/screens/Timer.h5
-rw-r--r--src/displayapp/screens/WatchFaceAnalog.cpp22
-rw-r--r--src/displayapp/screens/settings/SettingShakeThreshold.cpp4
11 files changed, 46 insertions, 52 deletions
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index 108e380d..015bc8de 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -152,7 +152,7 @@ void DisplayApp::Refresh() {
}
Messages msg;
- if (xQueueReceive(msgQueue, &msg, queueTimeout)) {
+ if (xQueueReceive(msgQueue, &msg, queueTimeout) == pdTRUE) {
switch (msg) {
case Messages::DimScreen:
brightnessController.Set(Controllers::BrightnessController::Levels::Low);
@@ -485,10 +485,9 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
void DisplayApp::PushMessage(Messages msg) {
if (in_isr()) {
- BaseType_t xHigherPriorityTaskWoken;
- xHigherPriorityTaskWoken = pdFALSE;
+ BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xQueueSendFromISR(msgQueue, &msg, &xHigherPriorityTaskWoken);
- if (xHigherPriorityTaskWoken) {
+ if (xHigherPriorityTaskWoken == pdTRUE) {
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
} else {
@@ -532,8 +531,7 @@ void DisplayApp::Register(Pinetime::System::SystemTask* systemTask) {
}
void DisplayApp::ApplyBrightness() {
auto brightness = settingsController.GetBrightness();
- if(brightness != Controllers::BrightnessController::Levels::Low &&
- brightness != Controllers::BrightnessController::Levels::Medium &&
+ if (brightness != Controllers::BrightnessController::Levels::Low && brightness != Controllers::BrightnessController::Levels::Medium &&
brightness != Controllers::BrightnessController::Levels::High) {
brightness = Controllers::BrightnessController::Levels::High;
}
diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp
index a2314690..bda6d68d 100644
--- a/src/displayapp/screens/FirmwareValidation.cpp
+++ b/src/displayapp/screens/FirmwareValidation.cpp
@@ -32,16 +32,16 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp* app,
lv_label_set_long_mode(labelIsValidated, LV_LABEL_LONG_BREAK);
lv_obj_set_width(labelIsValidated, 240);
- if (validator.IsValidated())
+ if (validator.IsValidated()) {
lv_label_set_text_static(labelIsValidated, "You have already\n#00ff00 validated# this firmware#");
- else {
+ } else {
lv_label_set_text_static(labelIsValidated,
"Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version.");
buttonValidate = lv_btn_create(lv_scr_act(), nullptr);
buttonValidate->user_data = this;
lv_obj_set_size(buttonValidate, 115, 50);
- lv_obj_align(buttonValidate, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
+ lv_obj_align(buttonValidate, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_obj_set_event_cb(buttonValidate, ButtonEventHandler);
lv_obj_set_style_local_bg_color(buttonValidate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::highlight);
diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp
index 305e0c4b..71bf86ca 100644
--- a/src/displayapp/screens/HeartRate.cpp
+++ b/src/displayapp/screens/HeartRate.cpp
@@ -64,8 +64,9 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp* app,
label_startStop = lv_label_create(btn_startStop, nullptr);
UpdateStartStopButton(isHrRunning);
- if (isHrRunning)
+ if (isHrRunning) {
systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping);
+ }
taskRefresh = lv_task_create(RefreshTaskCallback, 100, LV_TASK_PRIO_MID, this);
}
@@ -110,8 +111,9 @@ void HeartRate::OnStartStopEvent(lv_event_t event) {
}
void HeartRate::UpdateStartStopButton(bool isRunning) {
- if (isRunning)
+ if (isRunning) {
lv_label_set_text_static(label_startStop, "Stop");
- else
+ } else {
lv_label_set_text_static(label_startStop, "Start");
+ }
}
diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp
index c2dc4dac..e3689599 100644
--- a/src/displayapp/screens/Motion.cpp
+++ b/src/displayapp/screens/Motion.cpp
@@ -7,9 +7,9 @@ using namespace Pinetime::Applications::Screens;
Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionController& motionController)
: Screen(app), motionController {motionController} {
- chart = lv_chart_create(lv_scr_act(), NULL);
+ chart = lv_chart_create(lv_scr_act(), nullptr);
lv_obj_set_size(chart, 240, 240);
- lv_obj_align(chart, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);
+ lv_obj_align(chart, nullptr, LV_ALIGN_IN_TOP_MID, 0, 0);
lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/
// lv_chart_set_series_opa(chart, LV_OPA_70); /*Opacity of the data series*/
// lv_chart_set_series_width(chart, 4); /*Line width and point radious*/
@@ -28,13 +28,13 @@ Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionContr
lv_chart_init_points(chart, ser3, 0);
lv_chart_refresh(chart); /*Required after direct set*/
- label = lv_label_create(lv_scr_act(), NULL);
+ label = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text_fmt(label, "X #FF0000 %d# Y #00B000 %d# Z #FFFF00 %d#", 0, 0, 0);
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
- lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10);
+ lv_obj_align(label, nullptr, LV_ALIGN_IN_TOP_MID, 0, 10);
lv_label_set_recolor(label, true);
- labelStep = lv_label_create(lv_scr_act(), NULL);
+ labelStep = lv_label_create(lv_scr_act(), nullptr);
lv_obj_align(labelStep, chart, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_label_set_text_static(labelStep, "Steps ---");
@@ -58,5 +58,5 @@ void Motion::Refresh() {
motionController.X() / 0x10,
motionController.Y() / 0x10,
motionController.Z() / 0x10);
- lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_MID, 0, 10);
+ lv_obj_align(label, nullptr, LV_ALIGN_IN_TOP_MID, 0, 10);
}
diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp
index 90a010f5..5100ef9b 100644
--- a/src/displayapp/screens/Notifications.cpp
+++ b/src/displayapp/screens/Notifications.cpp
@@ -139,15 +139,9 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
switch (event) {
case Pinetime::Applications::TouchEvents::SwipeRight:
if (validDisplay) {
- Controllers::NotificationManager::Notification previousNotification;
auto previousMessage = notificationManager.GetPrevious(currentId);
auto nextMessage = notificationManager.GetNext(currentId);
- if (!previousMessage.valid) {
- // dismissed last message (like 5/5), need to go one message down (like 4/4)
- afterDismissNextMessageFromAbove = false; // show next message coming from below
- } else {
- afterDismissNextMessageFromAbove = true; // show next message coming from above
- }
+ afterDismissNextMessageFromAbove = previousMessage.valid;
notificationManager.Dismiss(currentId);
if (previousMessage.valid) {
currentId = previousMessage.id;
@@ -270,7 +264,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
lv_obj_t* alert_count = lv_label_create(container, nullptr);
lv_label_set_text_fmt(alert_count, "%i/%i", notifNr, notifNb);
- lv_obj_align(alert_count, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 16);
+ lv_obj_align(alert_count, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 16);
lv_obj_t* alert_type = lv_label_create(container, nullptr);
lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::orange);
@@ -288,7 +282,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
}
lv_label_set_long_mode(alert_type, LV_LABEL_LONG_SROLL_CIRC);
lv_obj_set_width(alert_type, 180);
- lv_obj_align(alert_type, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 16);
+ lv_obj_align(alert_type, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 16);
lv_obj_t* alert_subject = lv_label_create(subject_container, nullptr);
lv_label_set_long_mode(alert_subject, LV_LABEL_LONG_BREAK);
@@ -312,7 +306,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
bt_accept->user_data = this;
lv_obj_set_event_cb(bt_accept, CallEventHandler);
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, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
label_accept = lv_label_create(bt_accept, nullptr);
lv_label_set_text_static(label_accept, Symbols::phone);
lv_obj_set_style_local_bg_color(bt_accept, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::highlight);
@@ -321,7 +315,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
bt_reject->user_data = this;
lv_obj_set_event_cb(bt_reject, CallEventHandler);
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, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
label_reject = lv_label_create(bt_reject, nullptr);
lv_label_set_text_static(label_reject, Symbols::phoneSlash);
lv_obj_set_style_local_bg_color(bt_reject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
@@ -330,7 +324,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
bt_mute->user_data = this;
lv_obj_set_event_cb(bt_mute, CallEventHandler);
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, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
label_mute = lv_label_create(bt_mute, nullptr);
lv_label_set_text_static(label_mute, Symbols::volumMute);
lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray);
diff --git a/src/displayapp/screens/Steps.h b/src/displayapp/screens/Steps.h
index f109e0f2..32ad40bd 100644
--- a/src/displayapp/screens/Steps.h
+++ b/src/displayapp/screens/Steps.h
@@ -29,7 +29,6 @@ namespace Pinetime {
uint32_t currentTripSteps = 0;
lv_obj_t* lSteps;
- lv_obj_t* lStepsIcon;
lv_obj_t* stepsArc;
lv_obj_t* resetBtn;
lv_obj_t* resetButtonLabel;
diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp
index 01c35195..b5b17347 100644
--- a/src/displayapp/screens/SystemInfo.cpp
+++ b/src/displayapp/screens/SystemInfo.cpp
@@ -99,7 +99,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen1() {
std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
auto batteryPercent = batteryController.PercentRemaining();
- auto resetReason = [this]() {
+ const auto* resetReason = [this]() {
switch (watchdog.ResetReason()) {
case Drivers::Watchdog::ResetReasons::Watchdog:
return "wtdg";
@@ -182,7 +182,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_recolor(label, true);
- auto& bleAddr = bleController.Address();
+ const auto& bleAddr = bleController.Address();
lv_label_set_text_fmt(label,
"#808080 BLE MAC#\n"
" %02x:%02x:%02x:%02x:%02x:%02x"
diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp
index a60076ed..681f9c9f 100644
--- a/src/displayapp/screens/Tile.cpp
+++ b/src/displayapp/screens/Tile.cpp
@@ -51,8 +51,9 @@ Tile::Tile(uint8_t screenID,
uint8_t btIndex = 0;
for (uint8_t i = 0; i < 6; i++) {
- if (i == 3)
+ if (i == 3) {
btnmMap[btIndex++] = "\n";
+ }
if (applications[i].application == Apps::None) {
btnmMap[btIndex] = " ";
} else {
@@ -66,7 +67,7 @@ Tile::Tile(uint8_t screenID,
btnm1 = lv_btnmatrix_create(lv_scr_act(), nullptr);
lv_btnmatrix_set_map(btnm1, btnmMap);
lv_obj_set_size(btnm1, LV_HOR_RES - 16, LV_VER_RES - 60);
- lv_obj_align(btnm1, NULL, LV_ALIGN_CENTER, 0, 10);
+ lv_obj_align(btnm1, nullptr, LV_ALIGN_CENTER, 0, 10);
lv_obj_set_style_local_radius(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, 20);
lv_obj_set_style_local_bg_opa(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, LV_OPA_50);
@@ -102,8 +103,9 @@ void Tile::UpdateScreen() {
}
void Tile::OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId) {
- if (obj != btnm1)
+ if (obj != btnm1) {
return;
+ }
app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Up);
running = false;
diff --git a/src/displayapp/screens/Timer.h b/src/displayapp/screens/Timer.h
index a6b60a17..306281d7 100644
--- a/src/displayapp/screens/Timer.h
+++ b/src/displayapp/screens/Timer.h
@@ -26,7 +26,6 @@ namespace Pinetime::Applications::Screens {
void UpdateMask();
Controllers::TimerController& timerController;
- lv_obj_t* msecTime;
lv_obj_t* btnPlayPause;
lv_obj_t* txtPlayPause;
@@ -40,7 +39,7 @@ namespace Pinetime::Applications::Screens {
Widgets::Counter secondCounter = Widgets::Counter(0, 59, jetbrains_mono_76);
bool buttonPressing = false;
- int maskPosition = 0;
- TickType_t pressTime;
+ lv_coord_t maskPosition = 0;
+ TickType_t pressTime = 0;
};
}
diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp
index 5e5317ee..b36c29d3 100644
--- a/src/displayapp/screens/WatchFaceAnalog.cpp
+++ b/src/displayapp/screens/WatchFaceAnalog.cpp
@@ -61,9 +61,9 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app,
sMinute = 99;
sSecond = 99;
- lv_obj_t* bg_clock_img = lv_img_create(lv_scr_act(), NULL);
+ lv_obj_t* bg_clock_img = lv_img_create(lv_scr_act(), nullptr);
lv_img_set_src(bg_clock_img, &bg_clock);
- lv_obj_align(bg_clock_img, NULL, LV_ALIGN_CENTER, 0, 0);
+ lv_obj_align(bg_clock_img, nullptr, LV_ALIGN_CENTER, 0, 0);
batteryIcon.Create(lv_scr_act());
lv_obj_align(batteryIcon.GetObject(), nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
@@ -72,24 +72,24 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app,
lv_label_set_text_static(plugIcon, Symbols::plug);
lv_obj_align(plugIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
- notificationIcon = lv_label_create(lv_scr_act(), NULL);
+ notificationIcon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_LIME);
lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false));
- lv_obj_align(notificationIcon, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
+ lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0);
// Date - Day / Week day
- label_date_day = lv_label_create(lv_scr_act(), NULL);
+ label_date_day = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::orange);
lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day());
lv_label_set_align(label_date_day, LV_LABEL_ALIGN_CENTER);
- lv_obj_align(label_date_day, NULL, LV_ALIGN_CENTER, 50, 0);
+ lv_obj_align(label_date_day, nullptr, LV_ALIGN_CENTER, 50, 0);
- minute_body = lv_line_create(lv_scr_act(), NULL);
- minute_body_trace = lv_line_create(lv_scr_act(), NULL);
- hour_body = lv_line_create(lv_scr_act(), NULL);
- hour_body_trace = lv_line_create(lv_scr_act(), NULL);
- second_body = lv_line_create(lv_scr_act(), NULL);
+ minute_body = lv_line_create(lv_scr_act(), nullptr);
+ minute_body_trace = lv_line_create(lv_scr_act(), nullptr);
+ hour_body = lv_line_create(lv_scr_act(), nullptr);
+ hour_body_trace = lv_line_create(lv_scr_act(), nullptr);
+ second_body = lv_line_create(lv_scr_act(), nullptr);
lv_style_init(&second_line_style);
lv_style_set_line_width(&second_line_style, LV_STATE_DEFAULT, 3);
diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.cpp b/src/displayapp/screens/settings/SettingShakeThreshold.cpp
index de46f7de..e7edee9a 100644
--- a/src/displayapp/screens/settings/SettingShakeThreshold.cpp
+++ b/src/displayapp/screens/settings/SettingShakeThreshold.cpp
@@ -57,7 +57,7 @@ SettingShakeThreshold::SettingShakeThreshold(DisplayApp* app,
lv_obj_set_width(calButton, 200);
lv_obj_align(calButton, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0);
lv_btn_set_checkable(calButton, true);
- calLabel = lv_label_create(calButton, NULL);
+ calLabel = lv_label_create(calButton, nullptr);
lv_label_set_text_static(calLabel, "Calibrate");
lv_arc_set_value(positionArc, settingsController.GetShakeThreshold());
@@ -102,7 +102,7 @@ void SettingShakeThreshold::Refresh() {
}
if (xTaskGetTickCount() - vCalTime > pdMS_TO_TICKS(7500)) {
lv_btn_set_state(calButton, LV_STATE_DEFAULT);
- lv_event_send(calButton, LV_EVENT_VALUE_CHANGED, NULL);
+ lv_event_send(calButton, LV_EVENT_VALUE_CHANGED, nullptr);
}
}
if (motionController.currentShakeSpeed() - 300 > lv_arc_get_value(animArc)) {