From ce136ea148397f42581c95e835e07d4ada717df4 Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 22 Oct 2023 22:37:53 -0400 Subject: [PATCH 1/6] Added duplicate of analog face --- src/CMakeLists.txt | 1 + src/displayapp/WatchFaces.h | 1 + src/displayapp/screens/Clock.cpp | 13 + src/displayapp/screens/Clock.h | 1 + src/displayapp/screens/WatchFaceFace.cpp | 264 ++++++++++++++++++ src/displayapp/screens/WatchFaceFace.h | 92 ++++++ .../screens/settings/SettingWatchFace.h | 6 +- 7 files changed, 376 insertions(+), 2 deletions(-) create mode 100644 src/displayapp/screens/WatchFaceFace.cpp create mode 100644 src/displayapp/screens/WatchFaceFace.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 68f94328..9c8dd1ee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -435,6 +435,7 @@ list(APPEND SOURCE_FILES displayapp/screens/WatchFaceTerminal.cpp displayapp/screens/WatchFacePineTimeStyle.cpp displayapp/screens/WatchFaceCasioStyleG7710.cpp + displayapp/screens/WatchFaceFace.cpp ## diff --git a/src/displayapp/WatchFaces.h b/src/displayapp/WatchFaces.h index 2982347a..8f065285 100644 --- a/src/displayapp/WatchFaces.h +++ b/src/displayapp/WatchFaces.h @@ -9,6 +9,7 @@ namespace Pinetime { Terminal = 3, Infineat = 4, CasioStyleG7710 = 5, + Face = 6, }; } } diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index eeb7f0e1..747bcab3 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -13,6 +13,7 @@ #include "displayapp/screens/WatchFaceAnalog.h" #include "displayapp/screens/WatchFacePineTimeStyle.h" #include "displayapp/screens/WatchFaceCasioStyleG7710.h" +#include "displayapp/screens/WatchFaceFace.h" using namespace Pinetime::Applications::Screens; using namespace Pinetime::Applications; @@ -55,6 +56,9 @@ Clock::Clock(Controllers::DateTime& dateTimeController, case WatchFace::CasioStyleG7710: return WatchFaceCasioStyleG7710(); break; + case WatchFace::Face: + return WatchFaceFaceScreen(); + break; } return WatchFaceDigitalScreen(); }()} { @@ -130,3 +134,12 @@ std::unique_ptr Clock::WatchFaceCasioStyleG7710() { motionController, filesystem); } + + +std::unique_ptr Clock::WatchFaceFaceScreen() { + return std::make_unique(dateTimeController, + batteryController, + bleController, + notificationManager, + settingsController); +} diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h index f3591f43..9e484867 100644 --- a/src/displayapp/screens/Clock.h +++ b/src/displayapp/screens/Clock.h @@ -54,6 +54,7 @@ namespace Pinetime { std::unique_ptr WatchFaceTerminalScreen(); std::unique_ptr WatchFaceInfineatScreen(); std::unique_ptr WatchFaceCasioStyleG7710(); + std::unique_ptr WatchFaceFaceScreen(); }; } } diff --git a/src/displayapp/screens/WatchFaceFace.cpp b/src/displayapp/screens/WatchFaceFace.cpp new file mode 100644 index 00000000..1109643c --- /dev/null +++ b/src/displayapp/screens/WatchFaceFace.cpp @@ -0,0 +1,264 @@ +#include "displayapp/screens/WatchFaceAnalog.h" +#include +#include +#include "displayapp/screens/BatteryIcon.h" +#include "displayapp/screens/BleIcon.h" +#include "displayapp/screens/Symbols.h" +#include "displayapp/screens/NotificationIcon.h" +#include "components/settings/Settings.h" +#include "displayapp/InfiniTimeTheme.h" + +using namespace Pinetime::Applications::Screens; + +namespace { + constexpr int16_t HourLength = 70; + constexpr int16_t MinuteLength = 90; + constexpr int16_t SecondLength = 110; + + // sin(90) = 1 so the value of _lv_trigo_sin(90) is the scaling factor + const auto LV_TRIG_SCALE = _lv_trigo_sin(90); + + int16_t Cosine(int16_t angle) { + return _lv_trigo_sin(angle + 90); + } + + int16_t Sine(int16_t angle) { + return _lv_trigo_sin(angle); + } + + int16_t CoordinateXRelocate(int16_t x) { + return (x + LV_HOR_RES / 2); + } + + int16_t CoordinateYRelocate(int16_t y) { + return std::abs(y - LV_HOR_RES / 2); + } + + lv_point_t CoordinateRelocate(int16_t radius, int16_t angle) { + return lv_point_t {.x = CoordinateXRelocate(radius * static_cast(Sine(angle)) / LV_TRIG_SCALE), + .y = CoordinateYRelocate(radius * static_cast(Cosine(angle)) / LV_TRIG_SCALE)}; + } + +} + +WatchFaceAnalog::WatchFaceFace(Controllers::DateTime& dateTimeController, + const Controllers::Battery& batteryController, + const Controllers::Ble& bleController, + Controllers::NotificationManager& notificationManager, + Controllers::Settings& settingsController) + : currentDateTime {{}}, + batteryIcon(true), + dateTimeController {dateTimeController}, + batteryController {batteryController}, + bleController {bleController}, + notificationManager {notificationManager}, + settingsController {settingsController} { + + sHour = 99; + sMinute = 99; + sSecond = 99; + + minor_scales = lv_linemeter_create(lv_scr_act(), nullptr); + lv_linemeter_set_scale(minor_scales, 300, 51); + lv_linemeter_set_angle_offset(minor_scales, 180); + lv_obj_set_size(minor_scales, 240, 240); + lv_obj_align(minor_scales, nullptr, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_bg_opa(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_obj_set_style_local_scale_width(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4); + lv_obj_set_style_local_scale_end_line_width(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 1); + lv_obj_set_style_local_scale_end_color(minor_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); + + major_scales = lv_linemeter_create(lv_scr_act(), nullptr); + lv_linemeter_set_scale(major_scales, 300, 11); + lv_linemeter_set_angle_offset(major_scales, 180); + lv_obj_set_size(major_scales, 240, 240); + lv_obj_align(major_scales, nullptr, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_bg_opa(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_obj_set_style_local_scale_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 6); + lv_obj_set_style_local_scale_end_line_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4); + lv_obj_set_style_local_scale_end_color(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + + large_scales = lv_linemeter_create(lv_scr_act(), nullptr); + lv_linemeter_set_scale(large_scales, 180, 3); + lv_linemeter_set_angle_offset(large_scales, 180); + lv_obj_set_size(large_scales, 240, 240); + lv_obj_align(large_scales, nullptr, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_bg_opa(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_obj_set_style_local_scale_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 20); + lv_obj_set_style_local_scale_end_line_width(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4); + lv_obj_set_style_local_scale_end_color(large_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); + + twelve = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_align(twelve, LV_LABEL_ALIGN_CENTER); + lv_label_set_text_static(twelve, "12"); + lv_obj_set_pos(twelve, 110, 10); + lv_obj_set_style_local_text_color(twelve, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); + + batteryIcon.Create(lv_scr_act()); + lv_obj_align(batteryIcon.GetObject(), nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0); + + plugIcon = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(plugIcon, Symbols::plug); + lv_obj_align(plugIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0); + + bleIcon = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(bleIcon, ""); + lv_obj_align(bleIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, -30, 0); + + notificationIcon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_LIME); + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(false)); + lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0); + + // Date - Day / Week day + + label_date_day = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::orange); + lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day()); + lv_label_set_align(label_date_day, LV_LABEL_ALIGN_CENTER); + lv_obj_align(label_date_day, nullptr, LV_ALIGN_CENTER, 50, 0); + + minute_body = lv_line_create(lv_scr_act(), nullptr); + minute_body_trace = lv_line_create(lv_scr_act(), nullptr); + hour_body = lv_line_create(lv_scr_act(), nullptr); + hour_body_trace = lv_line_create(lv_scr_act(), nullptr); + second_body = lv_line_create(lv_scr_act(), nullptr); + + lv_style_init(&second_line_style); + lv_style_set_line_width(&second_line_style, LV_STATE_DEFAULT, 3); + lv_style_set_line_color(&second_line_style, LV_STATE_DEFAULT, LV_COLOR_RED); + lv_style_set_line_rounded(&second_line_style, LV_STATE_DEFAULT, true); + lv_obj_add_style(second_body, LV_LINE_PART_MAIN, &second_line_style); + + lv_style_init(&minute_line_style); + lv_style_set_line_width(&minute_line_style, LV_STATE_DEFAULT, 7); + lv_style_set_line_color(&minute_line_style, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_line_rounded(&minute_line_style, LV_STATE_DEFAULT, true); + lv_obj_add_style(minute_body, LV_LINE_PART_MAIN, &minute_line_style); + + lv_style_init(&minute_line_style_trace); + lv_style_set_line_width(&minute_line_style_trace, LV_STATE_DEFAULT, 3); + lv_style_set_line_color(&minute_line_style_trace, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_line_rounded(&minute_line_style_trace, LV_STATE_DEFAULT, false); + lv_obj_add_style(minute_body_trace, LV_LINE_PART_MAIN, &minute_line_style_trace); + + lv_style_init(&hour_line_style); + lv_style_set_line_width(&hour_line_style, LV_STATE_DEFAULT, 7); + lv_style_set_line_color(&hour_line_style, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_line_rounded(&hour_line_style, LV_STATE_DEFAULT, true); + lv_obj_add_style(hour_body, LV_LINE_PART_MAIN, &hour_line_style); + + lv_style_init(&hour_line_style_trace); + lv_style_set_line_width(&hour_line_style_trace, LV_STATE_DEFAULT, 3); + lv_style_set_line_color(&hour_line_style_trace, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_line_rounded(&hour_line_style_trace, LV_STATE_DEFAULT, false); + lv_obj_add_style(hour_body_trace, LV_LINE_PART_MAIN, &hour_line_style_trace); + + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); + + Refresh(); +} + +WatchFaceFace::~WatchFaceFace() { + lv_task_del(taskRefresh); + + lv_style_reset(&hour_line_style); + lv_style_reset(&hour_line_style_trace); + lv_style_reset(&minute_line_style); + lv_style_reset(&minute_line_style_trace); + lv_style_reset(&second_line_style); + + lv_obj_clean(lv_scr_act()); +} + +void WatchFaceAnalog::UpdateClock() { + uint8_t hour = dateTimeController.Hours(); + uint8_t minute = dateTimeController.Minutes(); + uint8_t second = dateTimeController.Seconds(); + + if (sMinute != minute) { + auto const angle = minute * 6; + minute_point[0] = CoordinateRelocate(30, angle); + minute_point[1] = CoordinateRelocate(MinuteLength, angle); + + minute_point_trace[0] = CoordinateRelocate(5, angle); + minute_point_trace[1] = CoordinateRelocate(31, angle); + + lv_line_set_points(minute_body, minute_point, 2); + lv_line_set_points(minute_body_trace, minute_point_trace, 2); + } + + if (sHour != hour || sMinute != minute) { + sHour = hour; + sMinute = minute; + auto const angle = (hour * 30 + minute / 2); + + hour_point[0] = CoordinateRelocate(30, angle); + hour_point[1] = CoordinateRelocate(HourLength, angle); + + hour_point_trace[0] = CoordinateRelocate(5, angle); + hour_point_trace[1] = CoordinateRelocate(31, angle); + + lv_line_set_points(hour_body, hour_point, 2); + lv_line_set_points(hour_body_trace, hour_point_trace, 2); + } + + if (sSecond != second) { + sSecond = second; + auto const angle = second * 6; + + second_point[0] = CoordinateRelocate(-20, angle); + second_point[1] = CoordinateRelocate(SecondLength, angle); + lv_line_set_points(second_body, second_point, 2); + } +} + +void WatchFaceAnalog::SetBatteryIcon() { + auto batteryPercent = batteryPercentRemaining.Get(); + batteryIcon.SetBatteryPercentage(batteryPercent); +} + +void WatchFaceAnalog::Refresh() { + isCharging = batteryController.IsCharging(); + if (isCharging.IsUpdated()) { + if (isCharging.Get()) { + lv_obj_set_hidden(batteryIcon.GetObject(), true); + lv_obj_set_hidden(plugIcon, false); + } else { + lv_obj_set_hidden(batteryIcon.GetObject(), false); + lv_obj_set_hidden(plugIcon, true); + SetBatteryIcon(); + } + } + if (!isCharging.Get()) { + batteryPercentRemaining = batteryController.PercentRemaining(); + if (batteryPercentRemaining.IsUpdated()) { + SetBatteryIcon(); + } + } + + bleState = bleController.IsConnected(); + if (bleState.IsUpdated()) { + if (bleState.Get()) { + lv_label_set_text_static(bleIcon, Symbols::bluetooth); + } else { + lv_label_set_text_static(bleIcon, ""); + } + } + + notificationState = notificationManager.AreNewNotificationsAvailable(); + + if (notificationState.IsUpdated()) { + lv_label_set_text_static(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); + } + + currentDateTime = dateTimeController.CurrentDateTime(); + if (currentDateTime.IsUpdated()) { + UpdateClock(); + + currentDate = std::chrono::time_point_cast(currentDateTime.Get()); + if (currentDate.IsUpdated()) { + lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day()); + } + } +} diff --git a/src/displayapp/screens/WatchFaceFace.h b/src/displayapp/screens/WatchFaceFace.h new file mode 100644 index 00000000..fb2ae36d --- /dev/null +++ b/src/displayapp/screens/WatchFaceFace.h @@ -0,0 +1,92 @@ +#pragma once + +#include +#include +#include +#include +#include "displayapp/screens/Screen.h" +#include "components/datetime/DateTimeController.h" +#include "components/battery/BatteryController.h" +#include "components/ble/BleController.h" +#include "components/ble/NotificationManager.h" +#include "displayapp/screens/BatteryIcon.h" +#include "utility/DirtyValue.h" + +namespace Pinetime { + namespace Controllers { + class Settings; + class Battery; + class Ble; + class NotificationManager; + } + + namespace Applications { + namespace Screens { + + class WatchFaceFace : public Screen { + public: + WatchFaceFace(Controllers::DateTime& dateTimeController, + const Controllers::Battery& batteryController, + const Controllers::Ble& bleController, + Controllers::NotificationManager& notificationManager, + Controllers::Settings& settingsController); + + ~WatchFaceFace() override; + + void Refresh() override; + + private: + uint8_t sHour, sMinute, sSecond; + + Utility::DirtyValue batteryPercentRemaining {0}; + Utility::DirtyValue isCharging {}; + Utility::DirtyValue bleState {}; + Utility::DirtyValue> currentDateTime; + Utility::DirtyValue notificationState {false}; + using days = std::chrono::duration>; // TODO: days is standard in c++20 + Utility::DirtyValue> currentDate; + + lv_obj_t* minor_scales; + lv_obj_t* major_scales; + lv_obj_t* large_scales; + lv_obj_t* twelve; + + lv_obj_t* hour_body; + lv_obj_t* hour_body_trace; + lv_obj_t* minute_body; + lv_obj_t* minute_body_trace; + lv_obj_t* second_body; + + lv_point_t hour_point[2]; + lv_point_t hour_point_trace[2]; + lv_point_t minute_point[2]; + lv_point_t minute_point_trace[2]; + lv_point_t second_point[2]; + + lv_style_t hour_line_style; + lv_style_t hour_line_style_trace; + lv_style_t minute_line_style; + lv_style_t minute_line_style_trace; + lv_style_t second_line_style; + + lv_obj_t* label_date_day; + lv_obj_t* plugIcon; + lv_obj_t* notificationIcon; + lv_obj_t* bleIcon; + + BatteryIcon batteryIcon; + + const Controllers::DateTime& dateTimeController; + const Controllers::Battery& batteryController; + const Controllers::Ble& bleController; + Controllers::NotificationManager& notificationManager; + Controllers::Settings& settingsController; + + void UpdateClock(); + void SetBatteryIcon(); + + lv_task_t* taskRefresh; + }; + } + } +} diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h index 45a50e3d..d1db546e 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.h +++ b/src/displayapp/screens/settings/SettingWatchFace.h @@ -11,6 +11,7 @@ #include "displayapp/screens/CheckboxList.h" #include "displayapp/screens/WatchFaceInfineat.h" #include "displayapp/screens/WatchFaceCasioStyleG7710.h" +#include "displayapp/screens/WatchFaceFace.h" namespace Pinetime { @@ -47,8 +48,9 @@ namespace Pinetime { {"Terminal", true}, {"Infineat face", Applications::Screens::WatchFaceInfineat::IsAvailable(filesystem)}, {"Casio G7710", Applications::Screens::WatchFaceCasioStyleG7710::IsAvailable(filesystem)}, - {"", false}, - {"", false}}}; + {"Face face", true}, + {"", false} + }}; ScreenList screens; }; } From cbfd82959e55799fe580047ab9a0da90fda4ac4c Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 22 Oct 2023 23:31:15 -0400 Subject: [PATCH 2/6] Update reademe todo --- README.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index bde614d3..7a696936 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # TODO ## Completed +### Pending version + +### v1.13.1 - [x] Make $s in terminal watch face green - [x] Swipe left to access music control - [x] Flashlight starts on @@ -9,6 +12,8 @@ - [x] Swipe left/right goes to watchface/another app - [x] Rearrange quick acces and apps - [x] Exponent button on calculator +- [x] Seconds on digital watchface +- [x] Add quick ring settings ## Pending merge @@ -17,18 +22,17 @@ - [ ] Countdown timer presistant buzz ### Josh -- [ ] Seconds on digital watchface -- [ ] Battery on digital watchface -- [ ] Remap button double click (to music app) +- [ ] Smiley face watchface :) +- [ ] Remap button double click ### Moses -- [ ] Add quick ring settings ## Medium priority -- [ ] Temp sensor w/ arduino -- [ ] Homeassistant control +- [ ] Battery on digital watchface +- [ ] More watchfaces! ## Lower priority -- [ ] Maybe some prank watchfaces +- [ ] Temp sensor w/ arduino +- [ ] Homeassistant control From 2cb36d6e80cb2191eba6a5f558923ab48e303fc5 Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 22 Oct 2023 23:34:22 -0400 Subject: [PATCH 3/6] Working face watchface --- src/displayapp/screens/WatchFaceFace.cpp | 52 ++++++++++++++---------- src/displayapp/screens/WatchFaceFace.h | 9 ++-- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/displayapp/screens/WatchFaceFace.cpp b/src/displayapp/screens/WatchFaceFace.cpp index 1109643c..502f7cb5 100644 --- a/src/displayapp/screens/WatchFaceFace.cpp +++ b/src/displayapp/screens/WatchFaceFace.cpp @@ -1,4 +1,4 @@ -#include "displayapp/screens/WatchFaceAnalog.h" +#include "displayapp/screens/WatchFaceFace.h" #include #include #include "displayapp/screens/BatteryIcon.h" @@ -11,7 +11,7 @@ using namespace Pinetime::Applications::Screens; namespace { - constexpr int16_t HourLength = 70; + constexpr int16_t HourLength = 100; constexpr int16_t MinuteLength = 90; constexpr int16_t SecondLength = 110; @@ -41,7 +41,7 @@ namespace { } -WatchFaceAnalog::WatchFaceFace(Controllers::DateTime& dateTimeController, +WatchFaceFace::WatchFaceFace(Controllers::DateTime& dateTimeController, const Controllers::Battery& batteryController, const Controllers::Ble& bleController, Controllers::NotificationManager& notificationManager, @@ -58,6 +58,23 @@ WatchFaceAnalog::WatchFaceFace(Controllers::DateTime& dateTimeController, sMinute = 99; sSecond = 99; + mouth = lv_arc_create(lv_scr_act(), nullptr); + lv_arc_set_angles(mouth, 30, 110); + lv_arc_set_bg_angles(mouth, 45, 135); + lv_obj_set_size(mouth, 130, 130); + lv_obj_align(mouth, nullptr, LV_ALIGN_CENTER, 0, 0); + + leye = lv_arc_create(lv_scr_act(), nullptr); + lv_arc_set_angles(leye, 0, 360); + lv_obj_set_size(leye, 30, 30); + lv_obj_align(leye, nullptr, LV_ALIGN_CENTER, -35, -35); + + reye = lv_arc_create(lv_scr_act(), nullptr); + lv_arc_set_angles(reye, 0, 360); + lv_obj_set_size(reye, 30, 30); + lv_obj_align(reye, nullptr, LV_ALIGN_CENTER, 35, -35); + + minor_scales = lv_linemeter_create(lv_scr_act(), nullptr); lv_linemeter_set_scale(minor_scales, 300, 51); lv_linemeter_set_angle_offset(minor_scales, 180); @@ -116,7 +133,7 @@ WatchFaceAnalog::WatchFaceFace(Controllers::DateTime& dateTimeController, lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::orange); lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day()); lv_label_set_align(label_date_day, LV_LABEL_ALIGN_CENTER); - lv_obj_align(label_date_day, nullptr, LV_ALIGN_CENTER, 50, 0); + lv_obj_align(label_date_day, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); minute_body = lv_line_create(lv_scr_act(), nullptr); minute_body_trace = lv_line_create(lv_scr_act(), nullptr); @@ -131,7 +148,7 @@ WatchFaceAnalog::WatchFaceFace(Controllers::DateTime& dateTimeController, lv_obj_add_style(second_body, LV_LINE_PART_MAIN, &second_line_style); lv_style_init(&minute_line_style); - lv_style_set_line_width(&minute_line_style, LV_STATE_DEFAULT, 7); + lv_style_set_line_width(&minute_line_style, LV_STATE_DEFAULT, 3); lv_style_set_line_color(&minute_line_style, LV_STATE_DEFAULT, LV_COLOR_WHITE); lv_style_set_line_rounded(&minute_line_style, LV_STATE_DEFAULT, true); lv_obj_add_style(minute_body, LV_LINE_PART_MAIN, &minute_line_style); @@ -171,21 +188,18 @@ WatchFaceFace::~WatchFaceFace() { lv_obj_clean(lv_scr_act()); } -void WatchFaceAnalog::UpdateClock() { +void WatchFaceFace::UpdateClock() { uint8_t hour = dateTimeController.Hours(); uint8_t minute = dateTimeController.Minutes(); uint8_t second = dateTimeController.Seconds(); if (sMinute != minute) { auto const angle = minute * 6; - minute_point[0] = CoordinateRelocate(30, angle); + minute_point[0] = CoordinateRelocate(10, angle - 90); minute_point[1] = CoordinateRelocate(MinuteLength, angle); + minute_point[2] = CoordinateRelocate(10, angle + 90); - minute_point_trace[0] = CoordinateRelocate(5, angle); - minute_point_trace[1] = CoordinateRelocate(31, angle); - - lv_line_set_points(minute_body, minute_point, 2); - lv_line_set_points(minute_body_trace, minute_point_trace, 2); + lv_line_set_points(minute_body, minute_point, 3); } if (sHour != hour || sMinute != minute) { @@ -193,32 +207,28 @@ void WatchFaceAnalog::UpdateClock() { sMinute = minute; auto const angle = (hour * 30 + minute / 2); - hour_point[0] = CoordinateRelocate(30, angle); + hour_point[0] = CoordinateRelocate(90, angle); hour_point[1] = CoordinateRelocate(HourLength, angle); - hour_point_trace[0] = CoordinateRelocate(5, angle); - hour_point_trace[1] = CoordinateRelocate(31, angle); - lv_line_set_points(hour_body, hour_point, 2); - lv_line_set_points(hour_body_trace, hour_point_trace, 2); } if (sSecond != second) { sSecond = second; auto const angle = second * 6; - second_point[0] = CoordinateRelocate(-20, angle); + second_point[0] = CoordinateRelocate(105, angle); second_point[1] = CoordinateRelocate(SecondLength, angle); lv_line_set_points(second_body, second_point, 2); - } + }//TODO: redo seconds } -void WatchFaceAnalog::SetBatteryIcon() { +void WatchFaceFace::SetBatteryIcon() { auto batteryPercent = batteryPercentRemaining.Get(); batteryIcon.SetBatteryPercentage(batteryPercent); } -void WatchFaceAnalog::Refresh() { +void WatchFaceFace::Refresh() { isCharging = batteryController.IsCharging(); if (isCharging.IsUpdated()) { if (isCharging.Get()) { diff --git a/src/displayapp/screens/WatchFaceFace.h b/src/displayapp/screens/WatchFaceFace.h index fb2ae36d..448ef327 100644 --- a/src/displayapp/screens/WatchFaceFace.h +++ b/src/displayapp/screens/WatchFaceFace.h @@ -58,9 +58,7 @@ namespace Pinetime { lv_obj_t* second_body; lv_point_t hour_point[2]; - lv_point_t hour_point_trace[2]; - lv_point_t minute_point[2]; - lv_point_t minute_point_trace[2]; + lv_point_t minute_point[3]; lv_point_t second_point[2]; lv_style_t hour_line_style; @@ -74,6 +72,11 @@ namespace Pinetime { lv_obj_t* notificationIcon; lv_obj_t* bleIcon; + lv_obj_t* mouth; + lv_obj_t* leye; + lv_obj_t* reye; + + BatteryIcon batteryIcon; const Controllers::DateTime& dateTimeController; From 1ff782cb0e7daebb8833609a174d802ecc357c0e Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 22 Oct 2023 23:41:43 -0400 Subject: [PATCH 4/6] Update version to 1.13.1 (cherry picked from commit 5d7e1ae1f32b235bd44c7f3978cb2cacf7e8175d) --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83c6e98d..91c3dd53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose Debug or Release") -project(pinetime VERSION 1.13.0 LANGUAGES C CXX ASM) +project(pinetime VERSION 1.13.1 LANGUAGES C CXX ASM) set(CMAKE_C_STANDARD 99) set(CMAKE_CXX_STANDARD 14) From 79820669b64fd22bfadd1ef1757c7dd86cdf9113 Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 25 Oct 2023 22:32:28 -0400 Subject: [PATCH 5/6] Small rename --- src/displayapp/WatchFaces.h | 2 +- src/displayapp/screens/Clock.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/displayapp/WatchFaces.h b/src/displayapp/WatchFaces.h index 8f065285..b3a13f43 100644 --- a/src/displayapp/WatchFaces.h +++ b/src/displayapp/WatchFaces.h @@ -9,7 +9,7 @@ namespace Pinetime { Terminal = 3, Infineat = 4, CasioStyleG7710 = 5, - Face = 6, + FaceFace = 6, }; } } diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index 747bcab3..a2280a43 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -56,7 +56,7 @@ Clock::Clock(Controllers::DateTime& dateTimeController, case WatchFace::CasioStyleG7710: return WatchFaceCasioStyleG7710(); break; - case WatchFace::Face: + case WatchFace::FaceFace: return WatchFaceFaceScreen(); break; } From e24323b4548d9831b67229d0faeccbb71769ec01 Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 25 Oct 2023 22:33:30 -0400 Subject: [PATCH 6/6] Incriment version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91c3dd53..0a31c732 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose Debug or Release") -project(pinetime VERSION 1.13.1 LANGUAGES C CXX ASM) +project(pinetime VERSION 1.13.1.1 LANGUAGES C CXX ASM) set(CMAKE_C_STANDARD 99) set(CMAKE_CXX_STANDARD 14)