summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-04-21 14:06:42 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-04-21 14:06:42 (GMT)
commit3744e655fa94cc2efece15c3196cf8b398354ca2 (patch)
tree1040ff59e6f06fb901ba621856e28957c0b36589
parent9f062635af3548425102b976e26ebbdfa998d670 (diff)
parent8ea7d77d1b1f476c890bf04b44ad9e2c858a4d1c (diff)
Merge branch 'rev22-develop' into edge
-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/Apps.h1
-rw-r--r--src/displayapp/DisplayApp.cpp4
-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.cpp48
-rw-r--r--src/displayapp/screens/FlashLight.h24
-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.cpp121
-rw-r--r--src/displayapp/screens/Timer.h82
-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.cpp17
-rw-r--r--src/displayapp/screens/settings/SettingShakeThreshold.cpp8
33 files changed, 275 insertions, 246 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c0df7b2..0b8e876 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -458,7 +458,7 @@ list(APPEND SOURCE_FILES
displayapp/screens/WatchFaceAnalog24.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 4d20c51..cd011f6 100644
--- a/src/components/alarm/AlarmController.cpp
+++ b/src/components/alarm/AlarmController.cpp
@@ -67,7 +67,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 4dee63e..ce54bb7 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/Apps.h b/src/displayapp/Apps.h
index 4f9fdcc..7e8ef8f 100644
--- a/src/displayapp/Apps.h
+++ b/src/displayapp/Apps.h
@@ -14,6 +14,7 @@ namespace Pinetime {
Timer,
Alarm,
FlashLight,
+ FlashLightRed,
BatteryInfo,
Music,
Paint,
diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp
index fc3519f..5c5aad2 100644
--- a/src/displayapp/DisplayApp.cpp
+++ b/src/displayapp/DisplayApp.cpp
@@ -434,6 +434,10 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
currentScreen = std::make_unique<Screens::FlashLight>(this, *systemTask, brightnessController);
ReturnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
+ case Apps::FlashLightRed:
+ currentScreen = std::make_unique<Screens::FlashLight>(this, *systemTask, brightnessController, LV_COLOR_RED);
+ ReturnApp(Apps::QuickSettings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
+ break;
case Apps::StopWatch:
currentScreen = std::make_unique<Screens::StopWatch>(this, *systemTask);
break;
diff --git a/src/displayapp/screens/Alarm.cpp b/src/displayapp/screens/Alarm.cpp
index 69d84e2..9edc19a 100644
--- a/src/displayapp/screens/Alarm.cpp
+++ b/src/displayapp/screens/Alarm.cpp
@@ -267,7 +267,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.");
}
}
@@ -281,13 +281,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 671f359..130a13c 100644
--- a/src/displayapp/screens/Clock.cpp
+++ b/src/displayapp/screens/Clock.cpp
@@ -12,7 +12,7 @@
#include "displayapp/screens/WatchFaceTerminal.h"
#include "displayapp/screens/WatchFaceAnalog.h"
#include "displayapp/screens/WatchFaceAnalog24.h"
-#include "displayapp/screens/PineTimeStyle.h"
+#include "displayapp/screens/WatchFacePineTimeStyle.h"
#include "systemtask/SystemTask.h"
using namespace Pinetime::Applications::Screens;
@@ -47,7 +47,7 @@ Clock::Clock(DisplayApp* app,
return WatchFaceAnalog24Screen();
break;
case 3:
- return PineTimeStyleScreen();
+ return WatchFacePineTimeStyleScreen();
break;
case 4:
return WatchFaceTerminalScreen();
@@ -98,8 +98,8 @@ std::unique_ptr<Screen> Clock::WatchFaceAnalog24Screen() {
motionController);
}
-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 ccf3305..2dca4d0 100644
--- a/src/displayapp/screens/Clock.h
+++ b/src/displayapp/screens/Clock.h
@@ -50,7 +50,7 @@ namespace Pinetime {
std::unique_ptr<Screen> WatchFaceDigitalScreen();
std::unique_ptr<Screen> WatchFaceAnalogScreen();
std::unique_ptr<Screen> WatchFaceAnalog24Screen();
- 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 3493381..954551c 100644
--- a/src/displayapp/screens/FlashLight.cpp
+++ b/src/displayapp/screens/FlashLight.cpp
@@ -4,27 +4,34 @@
using namespace Pinetime::Applications::Screens;
-namespace {
- void event_handler(lv_obj_t* obj, lv_event_t event) {
- auto* screen = static_cast<FlashLight*>(obj->user_data);
- screen->OnClickEvent(obj, event);
+namespace Pinetime {
+ namespace Applications {
+ namespace Screens {
+ namespace FlashLightData {
+ Levels brightnessLevel = Levels::High;
+ }
+ }
}
+}
- typedef Pinetime::Controllers::BrightnessController::Levels Levels;
+using namespace Pinetime::Applications::Screens::FlashLightData;
- Levels brightnessLevel = Levels::High;
+
+void FlashLight::EventHandler(lv_obj_t* obj, lv_event_t event) {
+ auto* screen = static_cast<FlashLight*>(obj->user_data);
+ screen->OnClickEvent(obj, event);
}
FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app,
System::SystemTask& systemTask,
- Controllers::BrightnessController& brightnessController)
+ Controllers::BrightnessController& brightnessController,
+ lv_color_t color)
: Screen(app),
systemTask {systemTask},
- brightnessController {brightnessController}
+ brightnessController {brightnessController},
+ color {color}
{
- systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping);
-
flashLight = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &neofont2);
lv_label_set_text_static(flashLight, Symbols::highlight);
@@ -46,10 +53,11 @@ 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);
+ lv_obj_set_event_cb(backgroundAction, EventHandler);
+ systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping);
}
FlashLight::~FlashLight() {
@@ -76,21 +84,21 @@ void FlashLight::Update(bool on, Controllers::BrightnessController::Levels level
isOn = on;
if (isOn) {
brightnessController.Backup();
- lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, color);
lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
for (auto & i : indicators) {
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
- lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_WHITE);
+ lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DISABLED, color);
lv_obj_set_style_local_border_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
}
} else {
brightnessController.Restore();
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
- lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color);
for (auto & i : indicators) {
- lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, color);
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_BLACK);
- lv_obj_set_style_local_border_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_obj_set_style_local_border_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, color);
}
}
}
@@ -100,12 +108,6 @@ void FlashLight::Update(bool on, Controllers::BrightnessController::Levels level
}
}
-void FlashLight::OnClickEvent(lv_obj_t* obj, lv_event_t event) {
- if (obj == backgroundAction && event == LV_EVENT_CLICKED) {
- Update(!isOn, brightnessLevel);
- }
-}
-
bool FlashLight::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
using namespace Pinetime::Controllers;
diff --git a/src/displayapp/screens/FlashLight.h b/src/displayapp/screens/FlashLight.h
index 8021197..827502a 100644
--- a/src/displayapp/screens/FlashLight.h
+++ b/src/displayapp/screens/FlashLight.h
@@ -11,16 +11,35 @@ namespace Pinetime {
namespace Applications {
namespace Screens {
+ namespace FlashLightData {
+ namespace {
+ typedef Pinetime::Controllers::BrightnessController::Levels Levels;
+ }
+ extern Levels brightnessLevel;
+ }
+
class FlashLight : public Screen {
public:
- FlashLight(DisplayApp* app, System::SystemTask& systemTask, Pinetime::Controllers::BrightnessController& brightness);
+ FlashLight(DisplayApp* app, System::SystemTask& systemTask, Controllers::BrightnessController& brightness, lv_color_t color = LV_COLOR_WHITE);
~FlashLight() override;
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
- void OnClickEvent(lv_obj_t* obj, lv_event_t event);
private:
void Update(bool on, Pinetime::Controllers::BrightnessController::Levels level);
+ inline void OnClickEvent(lv_obj_t* obj, lv_event_t event) {
+ if (obj == backgroundAction) {
+ if (event == LV_EVENT_CLICKED) {
+ } else if (event == LV_EVENT_LONG_PRESSED) {
+ color = (color.full == LV_COLOR_WHITE.full) ? LV_COLOR_RED : LV_COLOR_WHITE;
+ } else {
+ return;
+ }
+ using namespace FlashLightData;
+ Update(!isOn, brightnessLevel);
+ }
+ }
+ static void EventHandler(lv_obj_t* obj, lv_event_t event);
Pinetime::System::SystemTask& systemTask;
Controllers::BrightnessController& brightnessController;
@@ -28,6 +47,7 @@ namespace Pinetime {
lv_obj_t* flashLight;
lv_obj_t* backgroundAction;
lv_obj_t* indicators[3];
+ lv_color_t color;
bool isOn = false;
};
}
diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp
index 21603f4..d39f9a2 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 481883c..4196a9b 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 ---");
labelLastY = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(labelLastY, "LastY 0");
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 9ad9ca5..b2ab503 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, &neofont2);
- 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 257ab22..dd137f0 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 e0e860c..d23e221 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 4c95419..963e6b4 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, &neofont3);
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_LIME);
lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_LIME);
- 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 332fcef..91e6f49 100644
--- a/src/displayapp/screens/Timer.cpp
+++ b/src/displayapp/screens/Timer.cpp
@@ -6,19 +6,23 @@
using namespace Pinetime::Applications::Screens;
-static void btnEventHandler(lv_obj_t* obj, lv_event_t event) {
- Timer* screen = static_cast<Timer*>(obj->user_data);
+void Timer::btnEventHandler(lv_obj_t* obj, lv_event_t event) {
+ auto* screen = static_cast<Timer*>(obj->user_data);
screen->OnButtonEvent(obj, event);
}
-void Timer::createButtons() {
+void Timer::CreateButtons() {
+ if (btnMinutesUp != nullptr) {
+ return;
+ }
+
btnMinutesUp = lv_btn_create(lv_scr_act(), nullptr);
btnMinutesUp->user_data = this;
lv_obj_set_event_cb(btnMinutesUp, btnEventHandler);
lv_obj_set_size(btnMinutesUp, 60, 40);
lv_obj_align(btnMinutesUp, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, -85);
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;
@@ -26,7 +30,7 @@ void Timer::createButtons() {
lv_obj_set_size(btnMinutesDown, 60, 40);
lv_obj_align(btnMinutesDown, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 20, +35);
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;
@@ -34,7 +38,7 @@ void Timer::createButtons() {
lv_obj_set_size(btnSecondsUp, 60, 40);
lv_obj_align(btnSecondsUp, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -20, -85);
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;
@@ -42,10 +46,10 @@ void Timer::createButtons() {
lv_obj_set_size(btnSecondsDown, 60, 40);
lv_obj_align(btnSecondsDown, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -20, +35);
txtSDown = lv_label_create(btnSecondsDown, nullptr);
- lv_label_set_text(txtSDown, "-");
+ lv_label_set_text_static(txtSDown, "-");
}
-void Timer::stop() {
+void Timer::Stop() {
int32_t secondsRemaining = timerController.GetSecondsRemaining();
if (timerController.IsOvertime()) {
minutesToSet = 0;
@@ -57,50 +61,31 @@ void Timer::stop() {
}
timerController.StopTimer();
timerController.StopAlerting();
- lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
- lv_label_set_text_fmt(time, "%02lu:%02lu", secondsRemaining / 60, secondsRemaining % 60);
- lv_label_set_text(txtPlayPause, Symbols::play);
- createButtons();
+ RefreshRunning();
}
Timer::Timer(DisplayApp* app, Controllers::TimerController& timerController)
- : Screen(app), running {true}, timerController {timerController} {
+ : Screen(app), timerController {timerController} {
backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_click(backgroundLabel, true);
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, &neofont3);
- int32_t seconds = timerController.GetSecondsRemaining();
- bool overtime = timerController.IsOvertime();
-
- if (overtime) {
- seconds = -seconds + 1; // "+ 1" is to not show -00:00 again after +00:00
- lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
- } else {
- lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
- }
-
- lv_label_set_text_fmt(time, "%02lu:%02lu", seconds / 60, seconds % 60);
-
+ lv_label_set_text_static(time, "00:00");
lv_obj_align(time, lv_scr_act(), LV_ALIGN_CENTER, 0, -20);
-
btnPlayPause = lv_btn_create(lv_scr_act(), nullptr);
btnPlayPause->user_data = this;
lv_obj_set_event_cb(btnPlayPause, btnEventHandler);
lv_obj_set_size(btnPlayPause, 115, 50);
lv_obj_align(btnPlayPause, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0);
txtPlayPause = lv_label_create(btnPlayPause, nullptr);
- if (timerController.IsRunning()) {
- lv_label_set_text(txtPlayPause, overtime ? Symbols::stop : Symbols::pause);
- } else {
- lv_label_set_text(txtPlayPause, Symbols::play);
- createButtons();
- }
+ RefreshRunning();
+ Refresh();
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
}
@@ -114,6 +99,7 @@ Timer::~Timer() {
}
void Timer::Refresh() {
+
if (timerController.IsRunning()) {
int32_t seconds = timerController.GetSecondsRemaining();
if (timerController.IsOvertime()) {
@@ -121,7 +107,7 @@ void Timer::Refresh() {
// safety measures, lets not overflow counter as it will display badly
if (seconds >= 100 * 60) {
- stop();
+ Stop();
return;
}
}
@@ -129,65 +115,18 @@ void Timer::Refresh() {
}
}
-void Timer::OnButtonEvent(lv_obj_t* obj, lv_event_t event) {
- if (event == LV_EVENT_CLICKED) {
- if (obj == btnPlayPause) {
- if (timerController.IsRunning()) {
- stop();
- } else if (secondsToSet + minutesToSet > 0) {
- lv_label_set_text(txtPlayPause, Symbols::pause);
- timerController.StartTimer((secondsToSet + minutesToSet * 60) * 1000);
-
- // inlined destroyButtons()
- lv_obj_del(btnSecondsDown);
- btnSecondsDown = nullptr;
- lv_obj_del(btnSecondsUp);
- btnSecondsUp = nullptr;
- lv_obj_del(btnMinutesDown);
- btnMinutesDown = nullptr;
- lv_obj_del(btnMinutesUp);
- btnMinutesUp = nullptr;
- }
+void Timer::RefreshRunning() {
+ if (timerController.IsRunning()) {
+ if (timerController.IsOvertime()) {
+ lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
} else {
- if (!timerController.IsRunning()) {
- if (obj == btnMinutesUp) {
- if (minutesToSet >= 59) {
- minutesToSet = 0;
- } else {
- minutesToSet++;
- }
- lv_label_set_text_fmt(time, "%02d:%02d", minutesToSet, secondsToSet);
-
- } else if (obj == btnMinutesDown) {
- if (minutesToSet == 0) {
- minutesToSet = 59;
- } else {
- minutesToSet--;
- }
- lv_label_set_text_fmt(time, "%02d:%02d", minutesToSet, secondsToSet);
-
- } else if (obj == btnSecondsUp) {
- if (secondsToSet >= 59) {
- secondsToSet = 0;
- } else {
- secondsToSet++;
- }
- lv_label_set_text_fmt(time, "%02d:%02d", minutesToSet, secondsToSet);
-
- } else if (obj == btnSecondsDown) {
- if (secondsToSet == 0) {
- secondsToSet = 59;
- } else {
- secondsToSet--;
- }
- lv_label_set_text_fmt(time, "%02d:%02d", minutesToSet, secondsToSet);
- }
- }
+ lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_LIME);
}
+ lv_label_set_text_static(txtPlayPause, Symbols::pause);
+ } else {
+ lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
+ lv_label_set_text_static(txtPlayPause, Symbols::play);
+ CreateButtons();
}
}
-void Timer::SetDone() {
- lv_obj_set_style_local_text_color(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED);
- lv_label_set_text(txtPlayPause, Symbols::stop);
-}
diff --git a/src/displayapp/screens/Timer.h b/src/displayapp/screens/Timer.h
index 1eee6d0..9b1431e 100644
--- a/src/displayapp/screens/Timer.h
+++ b/src/displayapp/screens/Timer.h
@@ -18,21 +18,89 @@ namespace Pinetime::Applications::Screens {
~Timer() override;
void Refresh() override;
- void SetDone();
- void OnButtonEvent(lv_obj_t* obj, lv_event_t event);
-
+ void RefreshRunning();
+ inline void SetDone() {
+ lv_label_set_text_static(time, "00:00");
+ RefreshRunning();
+ secondsToSet = 0;
+ minutesToSet = 0;
+ CreateButtons();
+ }
private:
- bool running;
+ static void btnEventHandler(lv_obj_t* obj, lv_event_t event);
+ inline void OnButtonEvent(lv_obj_t* obj, lv_event_t event) {
+ if (event == LV_EVENT_CLICKED) {
+ if (obj == btnPlayPause) {
+ if (timerController.IsRunning()) {
+ uint32_t seconds = timerController.GetSecondsRemaining();
+ minutesToSet = seconds / 60;
+ secondsToSet = seconds % 60;
+ timerController.StopTimer();
+ CreateButtons();
+ RefreshRunning();
+ } else if (secondsToSet + minutesToSet > 0) {
+ timerController.StartTimer((secondsToSet + minutesToSet * 60) * 1000);
+ RefreshRunning();
+ DeleteButtons();
+ }
+ } else {
+ if (!timerController.IsRunning()) {
+ if (obj == btnMinutesUp) {
+ if (minutesToSet >= 59) {
+ minutesToSet = 0;
+ } else {
+ minutesToSet++;
+ }
+ lv_label_set_text_fmt(time, "%02d:%02d", minutesToSet, secondsToSet);
+
+ } else if (obj == btnMinutesDown) {
+ if (minutesToSet == 0) {
+ minutesToSet = 59;
+ } else {
+ minutesToSet--;
+ }
+ lv_label_set_text_fmt(time, "%02d:%02d", minutesToSet, secondsToSet);
+
+ } else if (obj == btnSecondsUp) {
+ if (secondsToSet >= 59) {
+ secondsToSet = 0;
+ } else {
+ secondsToSet++;
+ }
+ lv_label_set_text_fmt(time, "%02d:%02d", minutesToSet, secondsToSet);
+
+ } else if (obj == btnSecondsDown) {
+ if (secondsToSet == 0) {
+ secondsToSet = 59;
+ } else {
+ secondsToSet--;
+ }
+ lv_label_set_text_fmt(time, "%02d:%02d", minutesToSet, secondsToSet);
+ }
+ }
+ }
+ }
+ }
+ void CreateButtons();
+ inline void DeleteButtons() {
+ lv_obj_del(btnSecondsDown);
+ btnSecondsDown = nullptr;
+ lv_obj_del(btnSecondsUp);
+ btnSecondsUp = nullptr;
+ lv_obj_del(btnMinutesDown);
+ btnMinutesDown = nullptr;
+ lv_obj_del(btnMinutesUp);
+ btnMinutesUp = nullptr;
+ }
uint8_t secondsToSet = 0;
uint8_t minutesToSet = 0;
Controllers::TimerController& timerController;
- void createButtons();
- void stop();
+ void Stop();
lv_obj_t* backgroundLabel;
lv_task_t* taskRefresh;
- lv_obj_t *time, *btnPlayPause, *txtPlayPause, *btnMinutesUp, *btnMinutesDown, *btnSecondsUp, *btnSecondsDown, *txtMUp,
+ lv_obj_t *time, *btnPlayPause, *txtPlayPause, *btnMinutesUp = nullptr, *btnMinutesDown, *btnSecondsUp, *btnSecondsDown, *txtMUp,
*txtMDown, *txtSUp, *txtSDown;
};
}
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 76283e2..a5cbac3 100644
--- a/src/displayapp/screens/WatchFaceDigital.cpp
+++ b/src/displayapp/screens/WatchFaceDigital.cpp
@@ -155,7 +155,7 @@ void WatchFaceDigital::Refresh() {
bleState = bleController.IsConnected();
if (bleState.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 526e8ea..28b78a8 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 d2754ec..46f2f02 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,15 +124,18 @@ 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) {
- if (object == btn2 && event == LV_EVENT_CLICKED) {
-
- running = false;
- app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::Up);
-
+ if (object == btn2) {
+ if (event == LV_EVENT_CLICKED) {
+ running = false;
+ app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::Up);
+ } else if (event == LV_EVENT_LONG_PRESSED) {
+ running = false;
+ app->StartApp(Apps::FlashLightRed, DisplayApp::FullRefreshDirections::Up);
+ }
} else if (object == btn1 && event == LV_EVENT_CLICKED) {
brightness.Step();
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;
}