From 97140652d6b17908d385018746aec886941127b8 Mon Sep 17 00:00:00 2001 From: ialokim Date: Wed, 29 Dec 2021 03:17:46 +0100 Subject: [PATCH] PTS: add seconds display --- .../screens/WatchFacePineTimeStyle.cpp | 22 ++++++++++++++----- .../screens/WatchFacePineTimeStyle.h | 2 ++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index 63b421da..53f8a1c2 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -172,11 +172,10 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app, } stepGauge = lv_gauge_create(lv_scr_act(), nullptr); lv_gauge_set_needle_count(stepGauge, 1, needle_colors); - lv_obj_set_size(stepGauge, 40, 40); - lv_obj_align(stepGauge, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0); - lv_gauge_set_scale(stepGauge, 360, 11, 0); - lv_gauge_set_angle_offset(stepGauge, 180); - lv_gauge_set_critical_value(stepGauge, 100); + lv_obj_set_size(stepGauge, 37, 37); + lv_obj_align(stepGauge, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, -10); + lv_gauge_set_scale(stepGauge, 180, 5, 0); + lv_gauge_set_critical_value(stepGauge, 120); lv_gauge_set_range(stepGauge, 0, 100); lv_gauge_set_value(stepGauge, 0, 0); @@ -191,6 +190,12 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app, lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_pad_inner(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4); + // Display seconds + timeDD3 = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(timeDD3, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); + lv_label_set_text_static(timeDD3, ":00"); + lv_obj_align(timeDD3, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0); + btnNextTime = lv_btn_create(lv_scr_act(), nullptr); btnNextTime->user_data = this; lv_obj_set_size(btnNextTime, 60, 60); @@ -390,6 +395,7 @@ void WatchFacePineTimeStyle::Refresh() { uint8_t hour = time.hours().count(); uint8_t minute = time.minutes().count(); + uint8_t second = time.seconds().count(); if (displayedHour != hour || displayedMinute != minute) { displayedHour = hour; @@ -415,6 +421,12 @@ void WatchFacePineTimeStyle::Refresh() { } } + if (displayedSecond != second) { + displayedSecond = second; + + lv_label_set_text_fmt(timeDD3, ":%02d", second); + } + if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) { lv_label_set_text_static(dateDayOfWeek, dateTimeController.DayOfWeekShortToString()); lv_label_set_text_fmt(dateDay, "%d", day); diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.h b/src/displayapp/screens/WatchFacePineTimeStyle.h index 6f44f943..f584def1 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.h +++ b/src/displayapp/screens/WatchFacePineTimeStyle.h @@ -43,6 +43,7 @@ namespace Pinetime { private: uint8_t displayedHour = -1; uint8_t displayedMinute = -1; + uint8_t displayedSecond = -1; uint16_t currentYear = 1970; Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown; @@ -75,6 +76,7 @@ namespace Pinetime { lv_obj_t* sidebar; lv_obj_t* timeDD1; lv_obj_t* timeDD2; + lv_obj_t* timeDD3; lv_obj_t* timeAMPM; lv_obj_t* dateDayOfWeek; lv_obj_t* dateDay;