From e13172384b8ec3fcb1644ccc974bc64147f17610 Mon Sep 17 00:00:00 2001 From: Aidan Epstein Date: Thu, 9 Dec 2021 17:59:48 -0800 Subject: [PATCH 1/7] Wrap PineTimeStyle step counter This changes the PineTimeStyle step counter gauge continues counting with wraparound after you achieve your step goal. --- src/displayapp/screens/WatchFacePineTimeStyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index 63b421da..8689a98c 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -431,7 +431,7 @@ void WatchFacePineTimeStyle::Refresh() { stepCount = motionController.NbSteps(); motionSensorOk = motionController.IsSensorOk(); if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) { - lv_gauge_set_value(stepGauge, 0, (stepCount.Get() / (settingsController.GetStepsGoal() / 100))); + lv_gauge_set_value(stepGauge, 0, (stepCount.Get() / (settingsController.GetStepsGoal() / 100)) % 100); lv_obj_realign(stepGauge); if (stepCount.Get() > settingsController.GetStepsGoal()) { lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); From a0ba80882c55e5bd6e1636916fdbadd1c7c4a069 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Fri, 5 Aug 2022 00:33:24 +0200 Subject: [PATCH 2/7] Initial mockup --- src/displayapp/fonts/fonts.json | 2 +- src/displayapp/screens/Symbols.h | 1 + .../screens/WatchFacePineTimeStyle.cpp | 89 +++++++++++++++---- .../screens/WatchFacePineTimeStyle.h | 9 +- 4 files changed, 81 insertions(+), 20 deletions(-) diff --git a/src/displayapp/fonts/fonts.json b/src/displayapp/fonts/fonts.json index 9f228fb6..c0ea7439 100644 --- a/src/displayapp/fonts/fonts.json +++ b/src/displayapp/fonts/fonts.json @@ -58,7 +58,7 @@ "sources": [ { "file": "material-design-icons/MaterialIcons-Regular.ttf", - "range": "0xf00b, 0xe3aa-0xe3ac, 0xe7f6-0xe7f7, 0xe8b8" + "range": "0xf00b, 0xe3aa-0xe3ac, 0xe7f6-0xe7f7, 0xe8b8, 0xe40a" } ], "bpp": 1, diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h index c6e76e36..b21e9366 100644 --- a/src/displayapp/screens/Symbols.h +++ b/src/displayapp/screens/Symbols.h @@ -49,6 +49,7 @@ namespace Pinetime { static constexpr const char* notificationsOn = "\xEE\x9F\xB7"; static constexpr const char* flashlight = "\xEF\x80\x8B"; + static constexpr const char* paintbrushLg = "\xEE\x90\x8A"; } } } diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index 8689a98c..9658c1d6 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -191,6 +191,18 @@ 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); + stepValue = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_label_set_text_static(stepValue, "0"); + lv_obj_align(stepValue, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0); + lv_obj_set_hidden(stepValue, true); + + stepIcon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_label_set_text_static(stepIcon, Symbols::shoe); + lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_TOP_MID, 0, 0); + lv_obj_set_hidden(stepIcon, true); + btnNextTime = lv_btn_create(lv_scr_act(), nullptr); btnNextTime->user_data = this; lv_obj_set_size(btnNextTime, 60, 60); @@ -272,18 +284,38 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app, lv_obj_set_event_cb(btnClose, event_handler); lv_obj_set_hidden(btnClose, true); - btnSet = lv_btn_create(lv_scr_act(), nullptr); - btnSet->user_data = this; - lv_obj_set_height(btnSet, 150); - lv_obj_set_width(btnSet, 150); - lv_obj_align(btnSet, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); - lv_obj_set_style_local_radius(btnSet, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 30); - lv_obj_set_style_local_bg_opa(btnSet, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); - lv_obj_set_event_cb(btnSet, event_handler); - lbl_btnSet = lv_label_create(btnSet, nullptr); - lv_obj_set_style_local_text_font(lbl_btnSet, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); - lv_label_set_text_static(lbl_btnSet, Symbols::settings); - lv_obj_set_hidden(btnSet, true); + btnSteps = lv_btn_create(lv_scr_act(), nullptr); + btnSteps->user_data = this; + lv_obj_set_size(btnSteps, 120, 60); + lv_obj_align(btnSteps, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_bg_opa(btnSteps, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_style_local_value_str(btnSteps, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Toggle"); + lv_obj_set_event_cb(btnSteps, event_handler); + lv_obj_set_hidden(btnSteps, true); + + btnSetColor = lv_btn_create(lv_scr_act(), nullptr); + btnSetColor->user_data = this; + lv_obj_set_size(btnSetColor, 150, 60); + lv_obj_align(btnSetColor, lv_scr_act(), LV_ALIGN_CENTER, 0, -40); + lv_obj_set_style_local_radius(btnSetColor, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20); + lv_obj_set_style_local_bg_opa(btnSetColor, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_event_cb(btnSetColor, event_handler); + lbl_btnSetColor = lv_label_create(btnSetColor, nullptr); + lv_obj_set_style_local_text_font(lbl_btnSetColor, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); + lv_label_set_text_static(lbl_btnSetColor, Symbols::paintbrushLg); + lv_obj_set_hidden(btnSetColor, true); + + btnSetOpts = lv_btn_create(lv_scr_act(), nullptr); + btnSetOpts->user_data = this; + lv_obj_set_size(btnSetOpts, 150, 60); + lv_obj_align(btnSetOpts, lv_scr_act(), LV_ALIGN_CENTER, 0, 40); + lv_obj_set_style_local_radius(btnSetOpts, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20); + lv_obj_set_style_local_bg_opa(btnSetOpts, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_event_cb(btnSetOpts, event_handler); + lbl_btnSetOpts = lv_label_create(btnSetOpts, nullptr); + lv_obj_set_style_local_text_font(lbl_btnSetOpts, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); + lv_label_set_text_static(lbl_btnSetOpts, Symbols::settings); + lv_obj_set_hidden(btnSetOpts, true); taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); Refresh(); @@ -296,7 +328,8 @@ WatchFacePineTimeStyle::~WatchFacePineTimeStyle() { bool WatchFacePineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents event) { if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnRandom)) { - lv_obj_set_hidden(btnSet, false); + lv_obj_set_hidden(btnSetColor, false); + lv_obj_set_hidden(btnSetOpts, false); savedTick = lv_tick_get(); return true; } @@ -317,6 +350,7 @@ void WatchFacePineTimeStyle::CloseMenu() { lv_obj_set_hidden(btnReset, true); lv_obj_set_hidden(btnRandom, true); lv_obj_set_hidden(btnClose, true); + lv_obj_set_hidden(btnSteps, true); } bool WatchFacePineTimeStyle::OnButtonPushed() { @@ -433,14 +467,17 @@ void WatchFacePineTimeStyle::Refresh() { if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) { lv_gauge_set_value(stepGauge, 0, (stepCount.Get() / (settingsController.GetStepsGoal() / 100)) % 100); lv_obj_realign(stepGauge); + lv_label_set_text_fmt(stepValue, "%luK", (stepCount.Get() / 1000)); + lv_obj_realign(stepValue); if (stepCount.Get() > settingsController.GetStepsGoal()) { lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); lv_obj_set_style_local_scale_grad_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); } } - if (!lv_obj_get_hidden(btnSet)) { + if (!lv_obj_get_hidden(btnSetColor)) { if ((savedTick > 0) && (lv_tick_get() - savedTick > 3000)) { - lv_obj_set_hidden(btnSet, true); + lv_obj_set_hidden(btnSetColor, true); + lv_obj_set_hidden(btnSetOpts, true); savedTick = 0; } } @@ -552,8 +589,20 @@ void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) if (object == btnClose) { CloseMenu(); } - if (object == btnSet) { - lv_obj_set_hidden(btnSet, true); + if (object == btnSteps) { + if (!lv_obj_get_hidden(stepGauge)) { + lv_obj_set_hidden(stepGauge, true); + lv_obj_set_hidden(stepValue, false); + lv_obj_set_hidden(stepIcon, false); + } else { + lv_obj_set_hidden(stepGauge, false); + lv_obj_set_hidden(stepValue, true); + lv_obj_set_hidden(stepIcon, true); + } + } + if (object == btnSetColor) { + lv_obj_set_hidden(btnSetColor, true); + lv_obj_set_hidden(btnSetOpts, true); lv_obj_set_hidden(btnNextTime, false); lv_obj_set_hidden(btnPrevTime, false); lv_obj_set_hidden(btnNextBar, false); @@ -564,6 +613,12 @@ void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) lv_obj_set_hidden(btnRandom, false); lv_obj_set_hidden(btnClose, false); } + if (object == btnSetOpts) { + lv_obj_set_hidden(btnSetColor, true); + lv_obj_set_hidden(btnSetOpts, true); + lv_obj_set_hidden(btnSteps, false); + lv_obj_set_hidden(btnClose, false); + } } } diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.h b/src/displayapp/screens/WatchFacePineTimeStyle.h index 6f44f943..e769bfff 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.h +++ b/src/displayapp/screens/WatchFacePineTimeStyle.h @@ -71,6 +71,7 @@ namespace Pinetime { lv_obj_t* btnReset; lv_obj_t* btnRandom; lv_obj_t* btnClose; + lv_obj_t* btnSteps; lv_obj_t* timebar; lv_obj_t* sidebar; lv_obj_t* timeDD1; @@ -89,8 +90,12 @@ namespace Pinetime { lv_obj_t* calendarCrossBar2; lv_obj_t* notificationIcon; lv_obj_t* stepGauge; - lv_obj_t* btnSet; - lv_obj_t* lbl_btnSet; + lv_obj_t* btnSetColor; + lv_obj_t* btnSetOpts; + lv_obj_t* lbl_btnSetColor; + lv_obj_t* lbl_btnSetOpts; + lv_obj_t* stepIcon; + lv_obj_t* stepValue; lv_color_t needle_colors[1]; BatteryIcon batteryIcon; From 97140652d6b17908d385018746aec886941127b8 Mon Sep 17 00:00:00 2001 From: ialokim Date: Wed, 29 Dec 2021 03:17:46 +0100 Subject: [PATCH 3/7] 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; From a7c86786c3a56877a0343c58bc706acf131af30b Mon Sep 17 00:00:00 2001 From: ialokim Date: Sun, 7 Aug 2022 20:40:45 +0200 Subject: [PATCH 4/7] Apply suggestions from code review Co-authored-by: NeroBurner --- src/displayapp/screens/WatchFacePineTimeStyle.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index 53f8a1c2..6aaeeb96 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -192,7 +192,7 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app, // 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_obj_set_style_local_text_color(timeDD3, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); lv_label_set_text_static(timeDD3, ":00"); lv_obj_align(timeDD3, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0); @@ -423,7 +423,6 @@ void WatchFacePineTimeStyle::Refresh() { if (displayedSecond != second) { displayedSecond = second; - lv_label_set_text_fmt(timeDD3, ":%02d", second); } From b49fddd555849c207d6bb235b891b1da1ed99728 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Tue, 6 Sep 2022 11:37:12 +0200 Subject: [PATCH 5/7] Implement persistent settings --- src/components/settings/Settings.h | 15 ++++++- .../screens/WatchFacePineTimeStyle.cpp | 43 +++++++++++++++---- 2 files changed, 48 insertions(+), 10 deletions(-) diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 478408f6..cab909e7 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -36,10 +36,13 @@ namespace Pinetime { Purple, Orange }; + enum class PTSGaugeStyle : uint8_t { Full, Half, Numeric }; + struct PineTimeStyle { Colors ColorTime = Colors::Teal; Colors ColorBar = Colors::Teal; Colors ColorBG = Colors::Black; + PTSGaugeStyle gaugeStyle = PTSGaugeStyle::Full; }; Settings(Pinetime::Controllers::FS& fs); @@ -94,6 +97,15 @@ namespace Pinetime { return settings.PTS.ColorBG; }; + void SetPTSGaugeStyle(PTSGaugeStyle gaugeStyle) { + if (gaugeStyle != settings.PTS.gaugeStyle) + settingsChanged = true; + settings.PTS.gaugeStyle = gaugeStyle; + }; + PTSGaugeStyle GetPTSGaugeStyle() const { + return settings.PTS.gaugeStyle; + }; + void SetAppMenu(uint8_t menu) { appMenu = menu; }; @@ -212,7 +224,7 @@ namespace Pinetime { private: Pinetime::Controllers::FS& fs; - static constexpr uint32_t settingsVersion = 0x0003; + static constexpr uint32_t settingsVersion = 0x0004; struct SettingsData { uint32_t version = settingsVersion; uint32_t stepsGoal = 10000; @@ -225,6 +237,7 @@ namespace Pinetime { ChimesOption chimesOption = ChimesOption::None; PineTimeStyle PTS; + //PineTimeStyle::GaugeStyle gaugeStyle = PineTimeStyle::GaugeStyle::Full; std::bitset<4> wakeUpMode {0}; uint16_t shakeWakeThreshold = 150; diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index a387246b..161a2606 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -172,14 +172,24 @@ 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_gauge_set_range(stepGauge, 0, 100); lv_gauge_set_value(stepGauge, 0, 0); - + if (settingsController.GetPTSGaugeStyle() == Pinetime::Controllers::Settings::PTSGaugeStyle::Full) { + 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); + } else if (settingsController.GetPTSGaugeStyle() == Pinetime::Controllers::Settings::PTSGaugeStyle::Half) { + 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_angle_offset(stepGauge, 0); + lv_gauge_set_critical_value(stepGauge, 120); + } else if (settingsController.GetPTSGaugeStyle() == Pinetime::Controllers::Settings::PTSGaugeStyle::Numeric) { + lv_obj_set_hidden(stepGauge, true); + } + lv_obj_set_style_local_pad_right(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_pad_left(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_pad_bottom(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3); @@ -195,20 +205,32 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app, lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); lv_label_set_text_static(stepValue, "0"); lv_obj_align(stepValue, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0); - lv_obj_set_hidden(stepValue, true); + if (settingsController.GetPTSGaugeStyle() == Pinetime::Controllers::Settings::PTSGaugeStyle::Numeric) { + lv_obj_set_hidden(stepValue, false); + } else { + lv_obj_set_hidden(stepValue, true); + } stepIcon = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); lv_label_set_text_static(stepIcon, Symbols::shoe); lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_TOP_MID, 0, 0); - lv_obj_set_hidden(stepIcon, true); + if (settingsController.GetPTSGaugeStyle() == Pinetime::Controllers::Settings::PTSGaugeStyle::Numeric) { + lv_obj_set_hidden(stepIcon, false); + } else { + lv_obj_set_hidden(stepIcon, true); + } // 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_BLACK); lv_label_set_text_static(timeDD3, ":00"); lv_obj_align(timeDD3, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0); - lv_obj_set_hidden(timeDD3, true); + if (settingsController.GetPTSGaugeStyle() == Pinetime::Controllers::Settings::PTSGaugeStyle::Half) { + lv_obj_set_hidden(timeDD3, false); + } else { + lv_obj_set_hidden(timeDD3, true); + } btnNextTime = lv_btn_create(lv_scr_act(), nullptr); btnNextTime->user_data = this; @@ -611,12 +633,14 @@ void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) lv_gauge_set_scale(stepGauge, 180, 5, 0); lv_gauge_set_angle_offset(stepGauge, 0); lv_gauge_set_critical_value(stepGauge, 120); + settingsController.SetPTSGaugeStyle(Controllers::Settings::PTSGaugeStyle::Half); } else if (!lv_obj_get_hidden(timeDD3) && (lv_obj_get_hidden(stepValue))) { // show step count & icon lv_obj_set_hidden(timeDD3, true); lv_obj_set_hidden(stepGauge, true); lv_obj_set_hidden(stepValue, false); lv_obj_set_hidden(stepIcon, false); + settingsController.SetPTSGaugeStyle(Controllers::Settings::PTSGaugeStyle::Numeric); } else { // show full gauge lv_obj_set_hidden(stepGauge, false); @@ -627,6 +651,7 @@ void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) lv_gauge_set_scale(stepGauge, 360, 11, 0); lv_gauge_set_angle_offset(stepGauge, 180); lv_gauge_set_critical_value(stepGauge, 100); + settingsController.SetPTSGaugeStyle(Controllers::Settings::PTSGaugeStyle::Full); } } if (object == btnSetColor) { From fbc9f63308c0e9be90db387332cf60e3a117b7ee Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Tue, 6 Sep 2022 12:07:58 +0200 Subject: [PATCH 6/7] Relabel button --- src/displayapp/screens/WatchFacePineTimeStyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index 161a2606..0bbff30f 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -315,10 +315,10 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app, btnSteps = lv_btn_create(lv_scr_act(), nullptr); btnSteps->user_data = this; - lv_obj_set_size(btnSteps, 120, 60); + lv_obj_set_size(btnSteps, 160, 60); lv_obj_align(btnSteps, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_local_bg_opa(btnSteps, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); - lv_obj_set_style_local_value_str(btnSteps, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Toggle"); + lv_obj_set_style_local_value_str(btnSteps, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Steps style"); lv_obj_set_event_cb(btnSteps, event_handler); lv_obj_set_hidden(btnSteps, true); From 4fe834efda5f7c5a1f35c6ca3b07f4f2662fc4b8 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Tue, 6 Sep 2022 12:38:25 +0200 Subject: [PATCH 7/7] Cleanup --- src/components/settings/Settings.h | 3 +- .../screens/WatchFacePineTimeStyle.cpp | 50 +++++++++---------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index cab909e7..62586567 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -37,7 +37,7 @@ namespace Pinetime { Orange }; enum class PTSGaugeStyle : uint8_t { Full, Half, Numeric }; - + struct PineTimeStyle { Colors ColorTime = Colors::Teal; Colors ColorBar = Colors::Teal; @@ -237,7 +237,6 @@ namespace Pinetime { ChimesOption chimesOption = ChimesOption::None; PineTimeStyle PTS; - //PineTimeStyle::GaugeStyle gaugeStyle = PineTimeStyle::GaugeStyle::Full; std::bitset<4> wakeUpMode {0}; uint16_t shakeWakeThreshold = 150; diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index 0bbff30f..14030920 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -189,7 +189,7 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app, } else if (settingsController.GetPTSGaugeStyle() == Pinetime::Controllers::Settings::PTSGaugeStyle::Numeric) { lv_obj_set_hidden(stepGauge, true); } - + lv_obj_set_style_local_pad_right(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_pad_left(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_pad_bottom(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 3); @@ -626,32 +626,32 @@ void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) } if (object == btnSteps) { if (!lv_obj_get_hidden(stepGauge) && (lv_obj_get_hidden(timeDD3))) { - // show half gauge & seconds - lv_obj_set_hidden(timeDD3, false); - 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_angle_offset(stepGauge, 0); - lv_gauge_set_critical_value(stepGauge, 120); - settingsController.SetPTSGaugeStyle(Controllers::Settings::PTSGaugeStyle::Half); + // show half gauge & seconds + lv_obj_set_hidden(timeDD3, false); + 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_angle_offset(stepGauge, 0); + lv_gauge_set_critical_value(stepGauge, 120); + settingsController.SetPTSGaugeStyle(Controllers::Settings::PTSGaugeStyle::Half); } else if (!lv_obj_get_hidden(timeDD3) && (lv_obj_get_hidden(stepValue))) { - // show step count & icon - lv_obj_set_hidden(timeDD3, true); - lv_obj_set_hidden(stepGauge, true); - lv_obj_set_hidden(stepValue, false); - lv_obj_set_hidden(stepIcon, false); - settingsController.SetPTSGaugeStyle(Controllers::Settings::PTSGaugeStyle::Numeric); + // show step count & icon + lv_obj_set_hidden(timeDD3, true); + lv_obj_set_hidden(stepGauge, true); + lv_obj_set_hidden(stepValue, false); + lv_obj_set_hidden(stepIcon, false); + settingsController.SetPTSGaugeStyle(Controllers::Settings::PTSGaugeStyle::Numeric); } else { - // show full gauge - lv_obj_set_hidden(stepGauge, false); - lv_obj_set_hidden(stepValue, true); - lv_obj_set_hidden(stepIcon, true); - 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); - settingsController.SetPTSGaugeStyle(Controllers::Settings::PTSGaugeStyle::Full); + // show full gauge + lv_obj_set_hidden(stepGauge, false); + lv_obj_set_hidden(stepValue, true); + lv_obj_set_hidden(stepIcon, true); + 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); + settingsController.SetPTSGaugeStyle(Controllers::Settings::PTSGaugeStyle::Full); } } if (object == btnSetColor) {