Refactors watch faces. Replace lv_tick_get() with xTaskGetTickCount()

This commit is contained in:
Steve Amor 2025-02-28 19:15:29 +00:00 committed by mark9064
parent 248a6aea87
commit 9fb35cc073
4 changed files with 6 additions and 6 deletions

View file

@ -316,7 +316,7 @@ WatchFaceInfineat::~WatchFaceInfineat() {
bool WatchFaceInfineat::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnSettings)) {
lv_obj_set_hidden(btnSettings, false);
savedTick = lv_tick_get();
savedTick = xTaskGetTickCount();
return true;
}
// Prevent screen from sleeping when double tapping with settings on
@ -463,7 +463,7 @@ void WatchFaceInfineat::Refresh() {
}
if (!lv_obj_get_hidden(btnSettings)) {
if ((savedTick > 0) && (lv_tick_get() - savedTick > 3000)) {
if ((savedTick > 0) && (xTaskGetTickCount() - savedTick > pdMS_TO_TICKS(3000))) {
lv_obj_set_hidden(btnSettings, true);
savedTick = 0;
}

View file

@ -45,8 +45,8 @@ namespace Pinetime {
static bool IsAvailable(Pinetime::Controllers::FS& filesystem);
private:
uint32_t savedTick = 0;
uint8_t chargingBatteryPercent = 101; // not a mistake ;)
TickType_t savedTick = 0;
TickType_t chargingAnimationTick = 0;
Utility::DirtyValue<uint8_t> batteryPercentRemaining {};

View file

@ -407,7 +407,7 @@ bool WatchFacePineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents ev
if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnClose)) {
lv_obj_set_hidden(btnSetColor, false);
lv_obj_set_hidden(btnSetOpts, false);
savedTick = lv_tick_get();
savedTick = xTaskGetTickCount();
return true;
}
if ((event == Pinetime::Applications::TouchEvents::DoubleTap) && (lv_obj_get_hidden(btnClose) == false)) {
@ -558,7 +558,7 @@ void WatchFacePineTimeStyle::Refresh() {
}
if (!lv_obj_get_hidden(btnSetColor)) {
if ((savedTick > 0) && (lv_tick_get() - savedTick > 3000)) {
if ((savedTick > 0) && (xTaskGetTickCount() - savedTick > pdMS_TO_TICKS(3000))) {
lv_obj_set_hidden(btnSetColor, true);
lv_obj_set_hidden(btnSetOpts, true);
savedTick = 0;

View file

@ -52,7 +52,7 @@ namespace Pinetime {
Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown;
uint8_t currentDay = 0;
uint32_t savedTick = 0;
TickType_t savedTick = 0;
Utility::DirtyValue<uint8_t> batteryPercentRemaining {};
Utility::DirtyValue<bool> isCharging {};