Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/displayapp/screens/WatchFaceInfineat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/screens/WatchFaceInfineat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down
4 changes: 2 additions & 2 deletions src/displayapp/screens/WatchFacePineTimeStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/screens/WatchFacePineTimeStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down