summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-04-20 04:33:46 (GMT)
committerGitHub <noreply@github.com>2022-04-20 04:33:46 (GMT)
commitbe01602fcb6dc9cd91df702658c0b52da74023a9 (patch)
treebd0813acb88165deb7322201c52a259b242c49da
parent28f45caa11e0adbb208ba65b88b7ea399d584ba7 (diff)
parent5a13c5215c5022f036947838975c5c16b9ab268c (diff)
Merge branch 'InfiniTimeOrg:develop' into develop
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/components/alarm/AlarmController.cpp3
-rw-r--r--src/components/ble/NimbleController.cpp1
-rw-r--r--src/components/ble/NimbleController.h1
-rw-r--r--src/displayapp/screens/Alarm.cpp8
-rw-r--r--src/displayapp/screens/Clock.cpp8
-rw-r--r--src/displayapp/screens/Clock.h2
-rw-r--r--src/displayapp/screens/FirmwareUpdate.cpp11
-rw-r--r--src/displayapp/screens/FirmwareUpdate.h1
-rw-r--r--src/displayapp/screens/FirmwareValidation.cpp4
-rw-r--r--src/displayapp/screens/FlashLight.cpp2
-rw-r--r--src/displayapp/screens/HeartRate.cpp14
-rw-r--r--src/displayapp/screens/Motion.cpp2
-rw-r--r--src/displayapp/screens/Music.cpp50
-rw-r--r--src/displayapp/screens/Navigation.cpp8
-rw-r--r--src/displayapp/screens/Notifications.cpp10
-rw-r--r--src/displayapp/screens/Paddle.cpp2
-rw-r--r--src/displayapp/screens/PassKey.cpp2
-rw-r--r--src/displayapp/screens/Steps.cpp2
-rw-r--r--src/displayapp/screens/StopWatch.cpp28
-rw-r--r--src/displayapp/screens/Tile.cpp4
-rw-r--r--src/displayapp/screens/Timer.cpp22
-rw-r--r--src/displayapp/screens/Twos.cpp2
-rw-r--r--src/displayapp/screens/WatchFaceAnalog.cpp10
-rw-r--r--src/displayapp/screens/WatchFaceDigital.cpp2
-rw-r--r--src/displayapp/screens/WatchFacePineTimeStyle.cpp (renamed from src/displayapp/screens/PineTimeStyle.cpp)33
-rw-r--r--src/displayapp/screens/WatchFacePineTimeStyle.h (renamed from src/displayapp/screens/PineTimeStyle.h)6
-rw-r--r--src/displayapp/screens/settings/QuickSettings.cpp4
-rw-r--r--src/displayapp/screens/settings/SettingShakeThreshold.cpp8
29 files changed, 122 insertions, 130 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 077546a..b233f92 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -456,7 +456,7 @@ list(APPEND SOURCE_FILES
displayapp/screens/WatchFaceAnalog.cpp
displayapp/screens/WatchFaceDigital.cpp
displayapp/screens/WatchFaceTerminal.cpp
- displayapp/screens/PineTimeStyle.cpp
+ displayapp/screens/WatchFacePineTimeStyle.cpp
##
diff --git a/src/components/alarm/AlarmController.cpp b/src/components/alarm/AlarmController.cpp
index 28b328d..11d96e7 100644
--- a/src/components/alarm/AlarmController.cpp
+++ b/src/components/alarm/AlarmController.cpp
@@ -54,7 +54,8 @@ void AlarmController::ScheduleAlarm() {
auto now = dateTimeController.CurrentDateTime();
alarmTime = now;
- time_t ttAlarmTime = std::chrono::system_clock::to_time_t(alarmTime);
+ time_t ttAlarmTime = std::chrono::system_clock::to_time_t(
+ std::chrono::time_point_cast<std::chrono::system_clock::duration>(alarmTime));
tm* tmAlarmTime = std::localtime(&ttAlarmTime);
// If the time being set has already passed today,the alarm should be set for tomorrow
diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp
index 10eb429..d2d6dc0 100644
--- a/src/components/ble/NimbleController.cpp
+++ b/src/components/ble/NimbleController.cpp
@@ -35,7 +35,6 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask,
: systemTask {systemTask},
bleController {bleController},
dateTimeController {dateTimeController},
- notificationManager {notificationManager},
spiNorFlash {spiNorFlash},
fs {fs},
dfuService {systemTask, bleController, spiNorFlash},
diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h
index ad19421..000231f 100644
--- a/src/components/ble/NimbleController.h
+++ b/src/components/ble/NimbleController.h
@@ -86,7 +86,6 @@ namespace Pinetime {
Pinetime::System::SystemTask& systemTask;
Ble& bleController;
DateTime& dateTimeController;
- NotificationManager& notificationManager;
Pinetime::Drivers::SpiNorFlash& spiNorFlash;
FS& fs;
DfuService dfuService;
diff --git a/src/displayapp/screens/Alarm.cpp b/src/displayapp/screens/Alarm.cpp
index 879e50d..d5fc2c0 100644
--- a/src/displayapp/screens/Alarm.cpp
+++ b/src/displayapp/screens/Alarm.cpp
@@ -303,7 +303,7 @@ void Alarm::ShowInfo() {
lv_label_set_text_fmt(
txtMessage, "Time to\nalarm:\n%2lu Days\n%2lu Hours\n%2lu Minutes\n%2lu Seconds", daysToAlarm, hrsToAlarm, minToAlarm, secToAlarm);
} else {
- lv_label_set_text(txtMessage, "Alarm\nis not\nset.");
+ lv_label_set_text_static(txtMessage, "Alarm\nis not\nset.");
}
}
@@ -317,13 +317,13 @@ void Alarm::SetRecurButtonState() {
using Pinetime::Controllers::AlarmController;
switch (alarmController.Recurrence()) {
case AlarmController::RecurType::None:
- lv_label_set_text(txtRecur, "ONCE");
+ lv_label_set_text_static(txtRecur, "ONCE");
break;
case AlarmController::RecurType::Daily:
- lv_label_set_text(txtRecur, "DAILY");
+ lv_label_set_text_static(txtRecur, "DAILY");
break;
case AlarmController::RecurType::Weekdays:
- lv_label_set_text(txtRecur, "MON-FRI");
+ lv_label_set_text_static(txtRecur, "MON-FRI");
}
}
diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp
index fd74683..693e42a 100644
--- a/src/displayapp/screens/Clock.cpp
+++ b/src/displayapp/screens/Clock.cpp
@@ -11,7 +11,7 @@
#include "displayapp/screens/WatchFaceDigital.h"
#include "displayapp/screens/WatchFaceTerminal.h"
#include "displayapp/screens/WatchFaceAnalog.h"
-#include "displayapp/screens/PineTimeStyle.h"
+#include "displayapp/screens/WatchFacePineTimeStyle.h"
using namespace Pinetime::Applications::Screens;
@@ -40,7 +40,7 @@ Clock::Clock(DisplayApp* app,
return WatchFaceAnalogScreen();
break;
case 2:
- return PineTimeStyleScreen();
+ return WatchFacePineTimeStyleScreen();
break;
case 3:
return WatchFaceTerminalScreen();
@@ -79,8 +79,8 @@ std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
}
-std::unique_ptr<Screen> Clock::PineTimeStyleScreen() {
- return std::make_unique<Screens::PineTimeStyle>(
+std::unique_ptr<Screen> Clock::WatchFacePineTimeStyleScreen() {
+ return std::make_unique<Screens::WatchFacePineTimeStyle>(
app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, motionController);
}
diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h
index 50996a7..1ba752c 100644
--- a/src/displayapp/screens/Clock.h
+++ b/src/displayapp/screens/Clock.h
@@ -46,7 +46,7 @@ namespace Pinetime {
std::unique_ptr<Screen> screen;
std::unique_ptr<Screen> WatchFaceDigitalScreen();
std::unique_ptr<Screen> WatchFaceAnalogScreen();
- std::unique_ptr<Screen> PineTimeStyleScreen();
+ std::unique_ptr<Screen> WatchFacePineTimeStyleScreen();
std::unique_ptr<Screen> WatchFaceTerminalScreen();
};
}
diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp
index 373fcae..0a8544b 100644
--- a/src/displayapp/screens/FirmwareUpdate.cpp
+++ b/src/displayapp/screens/FirmwareUpdate.cpp
@@ -15,7 +15,7 @@ FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime
lv_label_set_text_static(backgroundLabel, "");
titleLabel = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text(titleLabel, "Firmware update");
+ lv_label_set_text_static(titleLabel, "Firmware update");
lv_obj_set_auto_realign(titleLabel, true);
lv_obj_align(titleLabel, nullptr, LV_ALIGN_IN_TOP_MID, 0, 50);
@@ -27,7 +27,7 @@ FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime
lv_bar_set_value(bar1, 0, LV_ANIM_OFF);
percentLabel = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text(percentLabel, "Waiting...");
+ lv_label_set_text_static(percentLabel, "Waiting...");
lv_obj_set_auto_realign(percentLabel, true);
lv_obj_align(percentLabel, bar1, LV_ALIGN_OUT_TOP_MID, 0, 60);
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
@@ -81,20 +81,19 @@ void FirmwareUpdate::DisplayProgression() const {
float current = bleController.FirmwareUpdateCurrentBytes() / 1024.0f;
float total = bleController.FirmwareUpdateTotalBytes() / 1024.0f;
int16_t pc = (current / total) * 100.0f;
- sprintf(percentStr, "%d %%", pc);
- lv_label_set_text(percentLabel, percentStr);
+ lv_label_set_text_fmt(percentLabel, "%d %%", pc);
lv_bar_set_value(bar1, pc, LV_ANIM_OFF);
}
void FirmwareUpdate::UpdateValidated() {
lv_label_set_recolor(percentLabel, true);
- lv_label_set_text(percentLabel, "#00ff00 Image Ok!#");
+ lv_label_set_text_static(percentLabel, "#00ff00 Image Ok!#");
}
void FirmwareUpdate::UpdateError() {
lv_label_set_recolor(percentLabel, true);
- lv_label_set_text(percentLabel, "#ff0000 Error!#");
+ lv_label_set_text_static(percentLabel, "#ff0000 Error!#");
startTime = xTaskGetTickCount();
}
diff --git a/src/displayapp/screens/FirmwareUpdate.h b/src/displayapp/screens/FirmwareUpdate.h
index a61178c..5156b7e 100644
--- a/src/displayapp/screens/FirmwareUpdate.h
+++ b/src/displayapp/screens/FirmwareUpdate.h
@@ -24,7 +24,6 @@ namespace Pinetime {
lv_obj_t* bar1;
lv_obj_t* percentLabel;
lv_obj_t* titleLabel;
- mutable char percentStr[10];
States state = States::Idle;
diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp
index c7a5b27..16244ad 100644
--- a/src/displayapp/screens/FirmwareValidation.cpp
+++ b/src/displayapp/screens/FirmwareValidation.cpp
@@ -33,9 +33,9 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp* app,
lv_obj_set_width(labelIsValidated, 240);
if (validator.IsValidated())
- lv_label_set_text(labelIsValidated, "You have already\n#00ff00 validated# this firmware#");
+ lv_label_set_text_static(labelIsValidated, "You have already\n#00ff00 validated# this firmware#");
else {
- lv_label_set_text(labelIsValidated, "Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version.");
+ 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;
diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp
index 3f90750..9110562 100644
--- a/src/displayapp/screens/FlashLight.cpp
+++ b/src/displayapp/screens/FlashLight.cpp
@@ -44,7 +44,7 @@ FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app,
lv_label_set_long_mode(backgroundAction, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundAction, 240, 240);
lv_obj_set_pos(backgroundAction, 0, 0);
- lv_label_set_text(backgroundAction, "");
+ lv_label_set_text_static(backgroundAction, "");
lv_obj_set_click(backgroundAction, true);
backgroundAction->user_data = this;
lv_obj_set_event_cb(backgroundAction, event_handler);
diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp
index 513c40b..89b43bb 100644
--- a/src/displayapp/screens/HeartRate.cpp
+++ b/src/displayapp/screens/HeartRate.cpp
@@ -41,16 +41,16 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp* app,
else
lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
- lv_label_set_text(label_hr, "000");
+ lv_label_set_text_static(label_hr, "000");
lv_obj_align(label_hr, nullptr, LV_ALIGN_CENTER, 0, -40);
label_bpm = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text(label_bpm, "Heart rate BPM");
+ lv_label_set_text_static(label_bpm, "Heart rate BPM");
lv_obj_align(label_bpm, label_hr, LV_ALIGN_OUT_TOP_MID, 0, -20);
label_status = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(label_status, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222));
- lv_label_set_text(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData));
+ lv_label_set_text_static(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData));
lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
@@ -81,13 +81,13 @@ void HeartRate::Refresh() {
case Controllers::HeartRateController::States::NoTouch:
case Controllers::HeartRateController::States::NotEnoughData:
// case Controllers::HeartRateController::States::Stopped:
- lv_label_set_text(label_hr, "000");
+ lv_label_set_text_static(label_hr, "000");
break;
default:
lv_label_set_text_fmt(label_hr, "%03d", heartRateController.HeartRate());
}
- lv_label_set_text(label_status, ToString(state));
+ lv_label_set_text_static(label_status, ToString(state));
lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
}
@@ -109,7 +109,7 @@ void HeartRate::OnStartStopEvent(lv_event_t event) {
void HeartRate::UpdateStartStopButton(bool isRunning) {
if (isRunning)
- lv_label_set_text(label_startStop, "Stop");
+ lv_label_set_text_static(label_startStop, "Stop");
else
- lv_label_set_text(label_startStop, "Start");
+ lv_label_set_text_static(label_startStop, "Start");
}
diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp
index 23eb276..799dcb3 100644
--- a/src/displayapp/screens/Motion.cpp
+++ b/src/displayapp/screens/Motion.cpp
@@ -35,7 +35,7 @@ Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionContr
labelStep = lv_label_create(lv_scr_act(), NULL);
lv_obj_align(labelStep, chart, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
- lv_label_set_text(labelStep, "Steps ---");
+ lv_label_set_text_static(labelStep, "Steps ---");
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
}
diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp
index 9f17b95..dd4609c 100644
--- a/src/displayapp/screens/Music.cpp
+++ b/src/displayapp/screens/Music.cpp
@@ -62,7 +62,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_obj_align(btnVolDown, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_obj_add_style(btnVolDown, LV_STATE_DEFAULT, &btn_style);
label = lv_label_create(btnVolDown, nullptr);
- lv_label_set_text(label, Symbols::volumDown);
+ lv_label_set_text_static(label, Symbols::volumDown);
lv_obj_set_hidden(btnVolDown, true);
btnVolUp = lv_btn_create(lv_scr_act(), nullptr);
@@ -72,7 +72,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_obj_align(btnVolUp, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
lv_obj_add_style(btnVolUp, LV_STATE_DEFAULT, &btn_style);
label = lv_label_create(btnVolUp, nullptr);
- lv_label_set_text(label, Symbols::volumUp);
+ lv_label_set_text_static(label, Symbols::volumUp);
lv_obj_set_hidden(btnVolUp, true);
btnPrev = lv_btn_create(lv_scr_act(), nullptr);
@@ -82,7 +82,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_obj_align(btnPrev, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
lv_obj_add_style(btnPrev, LV_STATE_DEFAULT, &btn_style);
label = lv_label_create(btnPrev, nullptr);
- lv_label_set_text(label, Symbols::stepBackward);
+ lv_label_set_text_static(label, Symbols::stepBackward);
btnNext = lv_btn_create(lv_scr_act(), nullptr);
btnNext->user_data = this;
@@ -91,7 +91,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_obj_align(btnNext, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
lv_obj_add_style(btnNext, LV_STATE_DEFAULT, &btn_style);
label = lv_label_create(btnNext, nullptr);
- lv_label_set_text(label, Symbols::stepForward);
+ lv_label_set_text_static(label, Symbols::stepForward);
btnPlayPause = lv_btn_create(lv_scr_act(), nullptr);
btnPlayPause->user_data = this;
@@ -100,12 +100,12 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_obj_align(btnPlayPause, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
lv_obj_add_style(btnPlayPause, LV_STATE_DEFAULT, &btn_style);
txtPlayPause = lv_label_create(btnPlayPause, nullptr);
- lv_label_set_text(txtPlayPause, Symbols::play);
+ lv_label_set_text_static(txtPlayPause, Symbols::play);
txtTrackDuration = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtTrackDuration, LV_LABEL_LONG_SROLL);
lv_obj_align(txtTrackDuration, nullptr, LV_ALIGN_IN_TOP_LEFT, 12, 20);
- lv_label_set_text(txtTrackDuration, "--:--/--:--");
+ lv_label_set_text_static(txtTrackDuration, "--:--/--:--");
lv_label_set_align(txtTrackDuration, LV_ALIGN_IN_LEFT_MID);
lv_obj_set_width(txtTrackDuration, LV_HOR_RES);
@@ -117,7 +117,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_obj_align(txtArtist, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 1 * FONT_HEIGHT);
lv_label_set_align(txtArtist, LV_ALIGN_IN_LEFT_MID);
lv_obj_set_width(txtArtist, LV_HOR_RES - 12);
- lv_label_set_text(txtArtist, "Artist Name");
+ lv_label_set_text_static(txtArtist, "Artist Name");
txtTrack = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_SROLL_CIRC);
@@ -125,7 +125,7 @@ Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Mus
lv_label_set_align(txtTrack, LV_ALIGN_IN_LEFT_MID);
lv_obj_set_width(txtTrack, LV_HOR_RES - 12);
- lv_label_set_text(txtTrack, "This is a very long getTrack name");
+ lv_label_set_text_static(txtTrack, "This is a very long getTrack name");
/** Init animation */
imgDisc = lv_img_create(lv_scr_act(), nullptr);
@@ -187,7 +187,7 @@ void Music::Refresh() {
}
if (playing == Pinetime::Controllers::MusicService::MusicStatus::Playing) {
- lv_label_set_text(txtPlayPause, Symbols::pause);
+ lv_label_set_text_static(txtPlayPause, Symbols::pause);
if (xTaskGetTickCount() - 1024 >= lastIncrement) {
if (frameB) {
@@ -211,31 +211,27 @@ void Music::Refresh() {
UpdateLength();
}
} else {
- lv_label_set_text(txtPlayPause, Symbols::play);
+ lv_label_set_text_static(txtPlayPause, Symbols::play);
}
}
void Music::UpdateLength() {
if (totalLength > (99 * 60 * 60)) {
- lv_label_set_text(txtTrackDuration, "Inf/Inf");
+ lv_label_set_text_static(txtTrackDuration, "Inf/Inf");
} else if (totalLength > (99 * 60)) {
- char timer[12];
- sprintf(timer,
- "%02d:%02d/%02d:%02d",
- (currentLength / (60 * 60)) % 100,
- ((currentLength % (60 * 60)) / 60) % 100,
- (totalLength / (60 * 60)) % 100,
- ((totalLength % (60 * 60)) / 60) % 100);
- lv_label_set_text(txtTrackDuration, timer);
+ lv_label_set_text_fmt(txtTrackDuration,
+ "%02d:%02d/%02d:%02d",
+ (currentLength / (60 * 60)) % 100,
+ ((currentLength % (60 * 60)) / 60) % 100,
+ (totalLength / (60 * 60)) % 100,
+ ((totalLength % (60 * 60)) / 60) % 100);
} else {
- char timer[12];
- sprintf(timer,
- "%02d:%02d/%02d:%02d",
- (currentLength / 60) % 100,
- (currentLength % 60) % 100,
- (totalLength / 60) % 100,
- (totalLength % 60) % 100);
- lv_label_set_text(txtTrackDuration, timer);
+ lv_label_set_text_fmt(txtTrackDuration,
+ "%02d:%02d/%02d:%02d",
+ (currentLength / 60) % 100,
+ (currentLength % 60) % 100,
+ (totalLength / 60) % 100,
+ (totalLength % 60) % 100);
}
}
diff --git a/src/displayapp/screens/Navigation.cpp b/src/displayapp/screens/Navigation.cpp
index 674362a..0dd0d30 100644
--- a/src/displayapp/screens/Navigation.cpp
+++ b/src/displayapp/screens/Navigation.cpp
@@ -134,13 +134,13 @@ Navigation::Navigation(Pinetime::Applications::DisplayApp* app, Pinetime::Contro
imgFlag = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(imgFlag, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_navi_80);
lv_obj_set_style_local_text_color(imgFlag, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN);
- lv_label_set_text(imgFlag, iconForName("flag"));
+ lv_label_set_text_static(imgFlag, iconForName("flag"));
lv_obj_align(imgFlag, nullptr, LV_ALIGN_CENTER, 0, -60);
txtNarrative = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(txtNarrative, LV_LABEL_LONG_BREAK);
lv_obj_set_width(txtNarrative, LV_HOR_RES);
- lv_label_set_text(txtNarrative, "Navigation");
+ lv_label_set_text_static(txtNarrative, "Navigation");
lv_label_set_align(txtNarrative, LV_LABEL_ALIGN_CENTER);
lv_obj_align(txtNarrative, nullptr, LV_ALIGN_CENTER, 0, 10);
@@ -148,7 +148,7 @@ Navigation::Navigation(Pinetime::Applications::DisplayApp* app, Pinetime::Contro
lv_label_set_long_mode(txtManDist, LV_LABEL_LONG_BREAK);
lv_obj_set_style_local_text_color(txtManDist, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
lv_obj_set_width(txtManDist, LV_HOR_RES);
- lv_label_set_text(txtManDist, "--M");
+ lv_label_set_text_static(txtManDist, "--M");
lv_label_set_align(txtManDist, LV_LABEL_ALIGN_CENTER);
lv_obj_align(txtManDist, nullptr, LV_ALIGN_CENTER, 0, 60);
@@ -173,7 +173,7 @@ Navigation::~Navigation() {
void Navigation::Refresh() {
if (flag != navService.getFlag()) {
flag = navService.getFlag();
- lv_label_set_text(imgFlag, iconForName(flag));
+ lv_label_set_text_static(imgFlag, iconForName(flag));
}
if (narrative != navService.getNarrative()) {
diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp
index f9afd8c..600f748 100644
--- a/src/displayapp/screens/Notifications.cpp
+++ b/src/displayapp/screens/Notifications.cpp
@@ -229,7 +229,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
lv_obj_set_style_local_text_color(alert_subject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
lv_label_set_long_mode(alert_subject, LV_LABEL_LONG_BREAK);
lv_obj_set_width(alert_subject, LV_HOR_RES - 20);
- lv_label_set_text(alert_subject, "Incoming call from");
+ lv_label_set_text_static(alert_subject, "Incoming call from");
lv_obj_t* alert_caller = lv_label_create(container1, nullptr);
lv_obj_align(alert_caller, alert_subject, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
@@ -243,7 +243,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
lv_obj_set_size(bt_accept, 76, 76);
lv_obj_align(bt_accept, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
label_accept = lv_label_create(bt_accept, nullptr);
- lv_label_set_text(label_accept, Symbols::phone);
+ 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, LV_COLOR_GREEN);
bt_reject = lv_btn_create(lv_scr_act(), nullptr);
@@ -252,7 +252,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
lv_obj_set_size(bt_reject, 76, 76);
lv_obj_align(bt_reject, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
label_reject = lv_label_create(bt_reject, nullptr);
- lv_label_set_text(label_reject, Symbols::phoneSlash);
+ 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);
bt_mute = lv_btn_create(lv_scr_act(), nullptr);
@@ -261,7 +261,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
lv_obj_set_size(bt_mute, 76, 76);
lv_obj_align(bt_mute, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
label_mute = lv_label_create(bt_mute, nullptr);
- lv_label_set_text(label_mute, Symbols::volumMute);
+ 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, LV_COLOR_GRAY);
} break;
}
@@ -270,7 +270,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
- lv_label_set_text(backgroundLabel, "");
+ lv_label_set_text_static(backgroundLabel, "");
}
void Notifications::NotificationItem::OnCallButtonEvent(lv_obj_t* obj, lv_event_t event) {
diff --git a/src/displayapp/screens/Paddle.cpp b/src/displayapp/screens/Paddle.cpp
index 608eb64..79401ff 100644
--- a/src/displayapp/screens/Paddle.cpp
+++ b/src/displayapp/screens/Paddle.cpp
@@ -17,7 +17,7 @@ Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::Li
points = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(points, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
- lv_label_set_text(points, "0000");
+ lv_label_set_text_static(points, "0000");
lv_obj_align(points, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 10);
paddle = lv_obj_create(lv_scr_act(), nullptr);
diff --git a/src/displayapp/screens/PassKey.cpp b/src/displayapp/screens/PassKey.cpp
index 9e43a54..e9715cd 100644
--- a/src/displayapp/screens/PassKey.cpp
+++ b/src/displayapp/screens/PassKey.cpp
@@ -15,7 +15,7 @@ PassKey::PassKey(Pinetime::Applications::DisplayApp* app, uint32_t key) : Screen
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
- lv_label_set_text(backgroundLabel, "");
+ lv_label_set_text_static(backgroundLabel, "");
}
PassKey::~PassKey() {
diff --git a/src/displayapp/screens/Steps.cpp b/src/displayapp/screens/Steps.cpp
index 3e7f820..df13758 100644
--- a/src/displayapp/screens/Steps.cpp
+++ b/src/displayapp/screens/Steps.cpp
@@ -61,7 +61,7 @@ Steps::Steps(Pinetime::Applications::DisplayApp* app,
lv_obj_set_width(resetBtn, 115);
lv_obj_align(resetBtn, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0);
resetButtonLabel = lv_label_create(resetBtn, nullptr);
- lv_label_set_text(resetButtonLabel, "Reset");
+ lv_label_set_text_static(resetButtonLabel, "Reset");
currentTripSteps = motionController.GetTripSteps();
diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp
index 8749839..fcff5f1 100644
--- a/src/displayapp/screens/StopWatch.cpp
+++ b/src/displayapp/screens/StopWatch.cpp
@@ -55,13 +55,13 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask)
time = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
- lv_label_set_text(time, "00:00");
+ lv_label_set_text_static(time, "00:00");
lv_obj_align(time, lv_scr_act(), LV_ALIGN_CENTER, 0, -45);
msecTime = lv_label_create(lv_scr_act(), nullptr);
// lv_obj_set_style_local_text_font(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
- lv_label_set_text(msecTime, "00");
+ lv_label_set_text_static(msecTime, "00");
lv_obj_align(msecTime, lv_scr_act(), LV_ALIGN_CENTER, 0, 3);
btnPlayPause = lv_btn_create(lv_scr_act(), nullptr);
@@ -71,7 +71,7 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask)
lv_obj_set_width(btnPlayPause, 115);
lv_obj_align(btnPlayPause, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
txtPlayPause = lv_label_create(btnPlayPause, nullptr);
- lv_label_set_text(txtPlayPause, Symbols::play);
+ lv_label_set_text_static(txtPlayPause, Symbols::play);
btnStopLap = lv_btn_create(lv_scr_act(), nullptr);
btnStopLap->user_data = this;
@@ -82,7 +82,7 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask)
lv_obj_set_style_local_bg_color(btnStopLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex(0x080808));
txtStopLap = lv_label_create(btnStopLap, nullptr);
lv_obj_set_style_local_text_color(txtStopLap, LV_BTN_PART_MAIN, LV_STATE_DISABLED, lv_color_hex(0x888888));
- lv_label_set_text(txtStopLap, Symbols::stop);
+ lv_label_set_text_static(txtStopLap, Symbols::stop);
lv_obj_set_state(btnStopLap, LV_STATE_DISABLED);
lv_obj_set_state(txtStopLap, LV_STATE_DISABLED);
@@ -90,13 +90,13 @@ StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask)
// lv_obj_set_style_local_text_font(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
lv_obj_set_style_local_text_color(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
lv_obj_align(lapOneText, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 50, 30);
- lv_label_set_text(lapOneText, "");
+ lv_label_set_text_static(lapOneText, "");
lapTwoText = lv_label_create(lv_scr_act(), nullptr);
// lv_obj_set_style_local_text_font(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20);
lv_obj_set_style_local_text_color(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
lv_obj_align(lapTwoText, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 50, 55);
- lv_label_set_text(lapTwoText, "");
+ lv_label_set_text_static(lapTwoText, "");
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
}
@@ -113,11 +113,11 @@ void StopWatch::reset() {
lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
- lv_label_set_text(time, "00:00");
- lv_label_set_text(msecTime, "00");
+ lv_label_set_text_static(time, "00:00");
+ lv_label_set_text_static(msecTime, "00");
- lv_label_set_text(lapOneText, "");
- lv_label_set_text(lapTwoText, "");
+ lv_label_set_text_static(lapOneText, "");
+ lv_label_set_text_static(lapTwoText, "");
lapBuffer.clearBuffer();
lapNr = 0;
lv_obj_set_state(btnStopLap, LV_STATE_DISABLED);
@@ -129,8 +129,8 @@ void StopWatch::start() {
lv_obj_set_state(txtStopLap, LV_STATE_DEFAULT);
lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN);
- lv_label_set_text(txtPlayPause, Symbols::pause);
- lv_label_set_text(txtStopLap, Symbols::lapsFlag);
+ lv_label_set_text_static(txtPlayPause, Symbols::pause);
+ lv_label_set_text_static(txtStopLap, Symbols::lapsFlag);
startTime = xTaskGetTickCount();
currentState = States::Running;
systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping);
@@ -141,8 +141,8 @@ void StopWatch::pause() {
// Store the current time elapsed in cache
oldTimeElapsed += timeElapsed;
currentState = States::Halted;
- lv_label_set_text(txtPlayPause, Symbols::play);
- lv_label_set_text(txtStopLap, Symbols::stop);
+ lv_label_set_text_static(txtPlayPause, Symbols::play);
+ lv_label_set_text_static(txtStopLap, Symbols::stop);
lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping);
diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp
index 23d9bca..4df69fe 100644
--- a/src/displayapp/screens/Tile.cpp
+++ b/src/displayapp/screens/Tile.cpp
@@ -39,7 +39,7 @@ Tile::Tile(uint8_t screenID,
// Battery
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
+ lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, -8, 0);
if (numScreens > 1) {
@@ -120,7 +120,7 @@ Tile::~Tile() {
void Tile::UpdateScreen() {
lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str());
- lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
+ lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
}
void Tile::OnValueChangedEvent(lv_obj_t* obj, uint32_t buttonId) {
diff --git a/src/displayapp/screens/Timer.cpp b/src/displayapp/screens/Timer.cpp
index 5cd496c..167b7b1 100644
--- a/src/displayapp/screens/Timer.cpp
+++ b/src/displayapp/screens/Timer.cpp
@@ -18,7 +18,7 @@ void Timer::CreateButtons() {
lv_obj_set_height(btnMinutesUp, 40);
lv_obj_set_width(btnMinutesUp, 60);
txtMUp = lv_label_create(btnMinutesUp, nullptr);
- lv_label_set_text(txtMUp, "+");
+ lv_label_set_text_static(txtMUp, "+");
btnMinutesDown = lv_btn_create(lv_scr_act(), nullptr);
btnMinutesDown->user_data = this;
@@ -27,7 +27,7 @@ void Timer::CreateButtons() {
lv_obj_set_height(btnMinutesDown, 40);
lv_obj_set_width(btnMinutesDown, 60);
txtMDown = lv_label_create(btnMinutesDown, nullptr);
- lv_label_set_text(txtMDown, "-");
+ lv_label_set_text_static(txtMDown, "-");
btnSecondsUp = lv_btn_create(lv_scr_act(), nullptr);
btnSecondsUp->user_data = this;
@@ -36,7 +36,7 @@ void Timer::CreateButtons() {
lv_obj_set_height(btnSecondsUp, 40);
lv_obj_set_width(btnSecondsUp, 60);
txtSUp = lv_label_create(btnSecondsUp, nullptr);
- lv_label_set_text(txtSUp, "+");
+ lv_label_set_text_static(txtSUp, "+");
btnSecondsDown = lv_btn_create(lv_scr_act(), nullptr);
btnSecondsDown->user_data = this;
@@ -45,7 +45,7 @@ void Timer::CreateButtons() {
lv_obj_set_height(btnSecondsDown, 40);
lv_obj_set_width(btnSecondsDown, 60);
txtSDown = lv_label_create(btnSecondsDown, nullptr);
- lv_label_set_text(txtSDown, "-");
+ lv_label_set_text_static(txtSDown, "-");
}
Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController)
@@ -55,7 +55,7 @@ Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController)
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
- lv_label_set_text(backgroundLabel, "");
+ lv_label_set_text_static(backgroundLabel, "");
time = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76);
@@ -73,9 +73,9 @@ Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController)
lv_obj_set_height(btnPlayPause, 40);
txtPlayPause = lv_label_create(btnPlayPause, nullptr);
if (timerController.IsRunning()) {
- lv_label_set_text(txtPlayPause, Symbols::pause);
+ lv_label_set_text_static(txtPlayPause, Symbols::pause);
} else {
- lv_label_set_text(txtPlayPause, Symbols::play);
+ lv_label_set_text_static(txtPlayPause, Symbols::play);
CreateButtons();
}
@@ -98,7 +98,7 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) {
if (event == LV_EVENT_CLICKED) {
if (obj == btnPlayPause) {
if (timerController.IsRunning()) {
- lv_label_set_text(txtPlayPause, Symbols::play);
+ lv_label_set_text_static(txtPlayPause, Symbols::play);
uint32_t seconds = timerController.GetTimeRemaining() / 1000;
minutesToSet = seconds / 60;
secondsToSet = seconds % 60;
@@ -106,7 +106,7 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) {
CreateButtons();
} else if (secondsToSet + minutesToSet > 0) {
- lv_label_set_text(txtPlayPause, Symbols::pause);
+ lv_label_set_text_static(txtPlayPause, Symbols::pause);
timerController.StartTimer((secondsToSet + minutesToSet * 60) * 1000);
lv_obj_del(btnSecondsDown);
@@ -158,8 +158,8 @@ void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) {
}
void Timer::SetDone() {
- lv_label_set_text(time, "00:00");
- lv_label_set_text(txtPlayPause, Symbols::play);
+ lv_label_set_text_static(time, "00:00");
+ lv_label_set_text_static(txtPlayPause, Symbols::play);
secondsToSet = 0;
minutesToSet = 0;
CreateButtons();
diff --git a/src/displayapp/screens/Twos.cpp b/src/displayapp/screens/Twos.cpp
index 6d67585..ca9295d 100644
--- a/src/displayapp/screens/Twos.cpp
+++ b/src/displayapp/screens/Twos.cpp
@@ -90,7 +90,7 @@ Twos::Twos(Pinetime::Applications::DisplayApp* app) : Screen(app) {
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0);
- lv_label_set_text(backgroundLabel, "");
+ lv_label_set_text_static(backgroundLabel, "");
}
Twos::~Twos() {
diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp
index 6104281..4cfc969 100644
--- a/src/displayapp/screens/WatchFaceAnalog.cpp
+++ b/src/displayapp/screens/WatchFaceAnalog.cpp
@@ -67,13 +67,13 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app,
lv_obj_align(bg_clock_img, NULL, LV_ALIGN_CENTER, 0, 0);
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text(batteryIcon, Symbols::batteryHalf);
+ lv_label_set_text_static(batteryIcon, Symbols::batteryHalf);
lv_obj_align(batteryIcon, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
lv_obj_set_auto_realign(batteryIcon, true);
notificationIcon = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00));
- lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false));
+ lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false));
lv_obj_align(notificationIcon, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
// Date - Day / Week day
@@ -185,7 +185,7 @@ void WatchFaceAnalog::SetBatteryIcon() {
} else {
lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
}
- lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
+ lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
}
void WatchFaceAnalog::Refresh() {
@@ -193,7 +193,7 @@ void WatchFaceAnalog::Refresh() {
if (isCharging.IsUpdated()) {
if (isCharging.Get()) {
lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
- lv_label_set_text(batteryIcon, Symbols::plug);
+ lv_label_set_text_static(batteryIcon, Symbols::plug);
} else {
SetBatteryIcon();
}
@@ -208,7 +208,7 @@ void WatchFaceAnalog::Refresh() {
notificationState = notificationManager.AreNewNotificationsAvailable();
if (notificationState.IsUpdated()) {
- lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(notificationState.Get()));
+ lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get()));
}
currentDateTime = dateTimeController.CurrentDateTime();
diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp
index 6a91488..ad328e1 100644
--- a/src/displayapp/screens/WatchFaceDigital.cpp
+++ b/src/displayapp/screens/WatchFaceDigital.cpp
@@ -121,7 +121,7 @@ void WatchFaceDigital::Refresh() {
bleState = bleController.IsConnected();
bleRadioEnabled = bleController.IsRadioEnabled();
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
- lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get()));
+ lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get()));
}
lv_obj_realign(batteryIcon);
lv_obj_realign(batteryPlug);
diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp
index e807289..28e7a6a 100644
--- a/src/displayapp/screens/PineTimeStyle.cpp
+++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp
@@ -19,7 +19,7 @@
* Style/layout copied from TimeStyle for Pebble by Dan Tilden (github.com/tilden)
*/
-#include "displayapp/screens/PineTimeStyle.h"
+#include "displayapp/screens/WatchFacePineTimeStyle.h"
#include <date/date.h>
#include <lvgl/lvgl.h>
#include <cstdio>
@@ -39,7 +39,7 @@ using namespace Pinetime::Applications::Screens;
namespace {
void event_handler(lv_obj_t* obj, lv_event_t event) {
- auto* screen = static_cast<PineTimeStyle*>(obj->user_data);
+ auto* screen = static_cast<WatchFacePineTimeStyle*>(obj->user_data);
screen->UpdateSelected(obj, event);
}
@@ -51,7 +51,7 @@ namespace {
}
}
-PineTimeStyle::PineTimeStyle(DisplayApp* app,
+WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app,
Controllers::DateTime& dateTimeController,
Controllers::Battery& batteryController,
Controllers::Ble& bleController,
@@ -300,12 +300,12 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
Refresh();
}
-PineTimeStyle::~PineTimeStyle() {
+WatchFacePineTimeStyle::~WatchFacePineTimeStyle() {
lv_task_del(taskRefresh);
lv_obj_clean(lv_scr_act());
}
-bool PineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
+bool WatchFacePineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnRandom)) {
lv_obj_set_hidden(btnSet, false);
savedTick = lv_tick_get();
@@ -317,7 +317,7 @@ bool PineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return false;
}
-void PineTimeStyle::CloseMenu() {
+void WatchFacePineTimeStyle::CloseMenu() {
settingsController.SaveSettings();
lv_obj_set_hidden(btnNextTime, true);
lv_obj_set_hidden(btnPrevTime, true);
@@ -330,7 +330,7 @@ void PineTimeStyle::CloseMenu() {
lv_obj_set_hidden(btnClose, true);
}
-bool PineTimeStyle::OnButtonPushed() {
+bool WatchFacePineTimeStyle::OnButtonPushed() {
if (!lv_obj_get_hidden(btnClose)) {
CloseMenu();
return true;
@@ -338,13 +338,12 @@ bool PineTimeStyle::OnButtonPushed() {
return false;
}
-void PineTimeStyle::SetBatteryIcon() {
+void WatchFacePineTimeStyle::SetBatteryIcon() {
auto batteryPercent = batteryPercentRemaining.Get();
lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent));
}
-
-void PineTimeStyle::AlignIcons() {
+void WatchFacePineTimeStyle::AlignIcons() {
if (notificationState.Get() && bleState.Get()) {
lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 8, 25);
lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25);
@@ -355,7 +354,7 @@ void PineTimeStyle::AlignIcons() {
}
}
-void PineTimeStyle::Refresh() {
+void WatchFacePineTimeStyle::Refresh() {
isCharging = batteryController.IsCharging();
if (isCharging.IsUpdated()) {
if (isCharging.Get()) {
@@ -374,7 +373,7 @@ void PineTimeStyle::Refresh() {
bleState = bleController.IsConnected();
bleRadioEnabled = bleController.IsRadioEnabled();
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
- lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get()));
+ lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get()));
AlignIcons();
}
@@ -425,10 +424,10 @@ void PineTimeStyle::Refresh() {
}
if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
- lv_label_set_text_fmt(dateDayOfWeek, "%s", dateTimeController.DayOfWeekShortToString());
+ lv_label_set_text_static(dateDayOfWeek, dateTimeController.DayOfWeekShortToString());
lv_label_set_text_fmt(dateDay, "%d", day);
lv_obj_realign(dateDay);
- lv_label_set_text_fmt(dateMonth, "%s", dateTimeController.MonthShortToString());
+ lv_label_set_text_static(dateMonth, dateTimeController.MonthShortToString());
currentYear = year;
currentMonth = month;
@@ -455,7 +454,7 @@ void PineTimeStyle::Refresh() {
}
}
-void PineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) {
+void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) {
auto valueTime = settingsController.GetPTSColorTime();
auto valueBar = settingsController.GetPTSColorBar();
auto valueBG = settingsController.GetPTSColorBG();
@@ -576,7 +575,7 @@ void PineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) {
}
}
-Pinetime::Controllers::Settings::Colors PineTimeStyle::GetNext(Pinetime::Controllers::Settings::Colors color) {
+Pinetime::Controllers::Settings::Colors WatchFacePineTimeStyle::GetNext(Pinetime::Controllers::Settings::Colors color) {
auto colorAsInt = static_cast<uint8_t>(color);
Pinetime::Controllers::Settings::Colors nextColor;
if (colorAsInt < 16) {
@@ -587,7 +586,7 @@ Pinetime::Controllers::Settings::Colors PineTimeStyle::GetNext(Pinetime::Control
return nextColor;
}
-Pinetime::Controllers::Settings::Colors PineTimeStyle::GetPrevious(Pinetime::Controllers::Settings::Colors color) {
+Pinetime::Controllers::Settings::Colors WatchFacePineTimeStyle::GetPrevious(Pinetime::Controllers::Settings::Colors color) {
auto colorAsInt = static_cast<uint8_t>(color);
Pinetime::Controllers::Settings::Colors prevColor;
diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/WatchFacePineTimeStyle.h
index 5de9a5f..465aa70 100644
--- a/src/displayapp/screens/PineTimeStyle.h
+++ b/src/displayapp/screens/WatchFacePineTimeStyle.h
@@ -21,16 +21,16 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
- class PineTimeStyle : public Screen {
+ class WatchFacePineTimeStyle : public Screen {
public:
- PineTimeStyle(DisplayApp* app,
+ WatchFacePineTimeStyle(DisplayApp* app,
Controllers::DateTime& dateTimeController,
Controllers::Battery& batteryController,
Controllers::Ble& bleController,
Controllers::NotificationManager& notificatioManager,
Controllers::Settings& settingsController,
Controllers::MotionController& motionController);
- ~PineTimeStyle() override;
+ ~WatchFacePineTimeStyle() override;
bool OnTouchEvent(TouchEvents event) override;
bool OnButtonPushed() override;
diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp
index cd56c14..97faaa7 100644
--- a/src/displayapp/screens/settings/QuickSettings.cpp
+++ b/src/displayapp/screens/settings/QuickSettings.cpp
@@ -40,7 +40,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 0);
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
- lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
+ lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
static constexpr uint8_t barHeight = 20 + innerDistance;
@@ -124,7 +124,7 @@ QuickSettings::~QuickSettings() {
void QuickSettings::UpdateScreen() {
lv_label_set_text(label_time, dateTimeController.FormattedTime().c_str());
- lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
+ lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining()));
}
void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.cpp b/src/displayapp/screens/settings/SettingShakeThreshold.cpp
index 9d40fcf..c354bdc 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_align(calButton, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0);
lv_btn_set_checkable(calButton, true);
calLabel = lv_label_create(calButton, NULL);
- lv_label_set_text(calLabel, "Calibrate");
+ lv_label_set_text_static(calLabel, "Calibrate");
lv_arc_set_value(positionArc, settingsController.GetShakeThreshold());
@@ -91,7 +91,7 @@ void SettingShakeThreshold::Refresh() {
calibrating = 2;
lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_RED);
lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_RED);
- lv_label_set_text(calLabel, "Shake!!");
+ lv_label_set_text_static(calLabel, "Shake!");
}
}
if (calibrating == 2) {
@@ -121,14 +121,14 @@ void SettingShakeThreshold::UpdateSelected(lv_obj_t* object, lv_event_t event) {
lv_arc_set_value(positionArc, 0);
calibrating = 1;
vCalTime = xTaskGetTickCount();
- lv_label_set_text(calLabel, "Ready!");
+ lv_label_set_text_static(calLabel, "Ready!");
lv_obj_set_click(positionArc, false);
lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_GREEN);
lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_GREEN);
} else if (lv_btn_get_state(calButton) == LV_BTN_STATE_RELEASED) {
calibrating = 0;
lv_obj_set_click(positionArc, true);
- lv_label_set_text(calLabel, "Calibrate");
+ lv_label_set_text_static(calLabel, "Calibrate");
}
break;
}