diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 602de3a585..130fa5112a 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -36,6 +36,8 @@ namespace Pinetime { }; enum class PTSGaugeStyle : uint8_t { Full, Half, Numeric }; enum class PTSWeather : uint8_t { On, Off }; + enum class AClockStyle : uint8_t { H24, H12 }; + enum class ASecondHand : uint8_t { On, Off }; struct PineTimeStyle { Colors ColorTime = Colors::Teal; @@ -45,6 +47,11 @@ namespace Pinetime { PTSWeather weatherEnable = PTSWeather::Off; }; + struct Analog { + AClockStyle tfHourEnable = AClockStyle::H12; + ASecondHand secondHandEnable = ASecondHand::On; + }; + struct WatchFaceInfineat { bool showSideCover = true; int colorIndex = 0; @@ -154,6 +161,26 @@ namespace Pinetime { return settings.PTS.weatherEnable; }; + void SetAClockStyle(AClockStyle tfHourEnable) { + if (tfHourEnable != settings.A.tfHourEnable) + settingsChanged = true; + settings.A.tfHourEnable = tfHourEnable; + }; + + AClockStyle GetAClockStyle() const { + return settings.A.tfHourEnable; + }; + + void SetASecondHand(ASecondHand secondHandEnable) { + if (secondHandEnable != settings.A.secondHandEnable) + settingsChanged = true; + settings.A.secondHandEnable = secondHandEnable; + }; + + ASecondHand GetASecondHand() const { + return settings.A.secondHandEnable; + }; + void SetAppMenu(uint8_t menu) { appMenu = menu; }; @@ -301,7 +328,7 @@ namespace Pinetime { private: Pinetime::Controllers::FS& fs; - static constexpr uint32_t settingsVersion = 0x0008; + static constexpr uint32_t settingsVersion = 0x0009; struct SettingsData { uint32_t version = settingsVersion; @@ -318,6 +345,7 @@ namespace Pinetime { ChimesOption chimesOption = ChimesOption::None; PineTimeStyle PTS; + Analog A; WatchFaceInfineat watchFaceInfineat; diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index 80a1c8b9b5..e2754e84eb 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -39,6 +39,10 @@ namespace { .y = CoordinateYRelocate(radius * static_cast<int32_t>(Cosine(angle)) / LV_TRIG_SCALE)}; } + void event_handler(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast<WatchFaceAnalog*>(obj->user_data); + screen->UpdateSelected(obj, event); + } } WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController, @@ -57,11 +61,18 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController, sHour = 99; sMinute = 99; sSecond = 99; + sTfHourEnable = true; 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); + if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) { + lv_linemeter_set_scale(minor_scales, 360, 61); + lv_linemeter_set_angle_offset(minor_scales, 180); + lv_obj_set_size(minor_scales, 236, 236); + } else { + 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); @@ -69,31 +80,101 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController, 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); + if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) { + lv_linemeter_set_scale(major_scales, 360, 13); + lv_linemeter_set_angle_offset(major_scales, 30); + } else { + lv_linemeter_set_scale(major_scales, 300, 11); + lv_linemeter_set_angle_offset(major_scales, 180); + } + 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_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); + // create 12 hour style scales + large_scales_12 = lv_linemeter_create(lv_scr_act(), nullptr); + lv_linemeter_set_scale(large_scales_12, 180, 3); + lv_linemeter_set_angle_offset(large_scales_12, 180); + lv_obj_set_size(large_scales_12, 240, 240); + lv_obj_align(large_scales_12, nullptr, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_scale_width(large_scales_12, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 20); + lv_obj_set_style_local_scale_end_line_width(large_scales_12, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 4); + lv_obj_set_style_local_bg_opa(large_scales_12, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_obj_set_style_local_scale_end_color(large_scales_12, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); + + // create 24 hour style left hand scales + large_scales_24_a = lv_linemeter_create(lv_scr_act(), nullptr); + lv_linemeter_set_scale(large_scales_24_a, 150, 11); + lv_linemeter_set_angle_offset(large_scales_24_a, 270); + lv_obj_set_size(large_scales_24_a, 200, 200); + lv_obj_align(large_scales_24_a, nullptr, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_scale_width(large_scales_24_a, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 10); + lv_obj_set_style_local_scale_end_line_width(large_scales_24_a, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 2); + lv_obj_set_style_local_bg_opa(large_scales_24_a, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_obj_set_style_local_scale_end_color(large_scales_24_a, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); + + // create 24 hour style right hand scales + large_scales_24_b = lv_linemeter_create(lv_scr_act(), nullptr); + lv_linemeter_set_scale(large_scales_24_b, 150, 11); + lv_linemeter_set_angle_offset(large_scales_24_b, 90); + lv_obj_set_size(large_scales_24_b, 200, 200); + lv_obj_align(large_scales_24_b, nullptr, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_scale_width(large_scales_24_b, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 10); + lv_obj_set_style_local_scale_end_line_width(large_scales_24_b, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 2); + lv_obj_set_style_local_bg_opa(large_scales_24_b, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_obj_set_style_local_scale_end_color(large_scales_24_b, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); + + if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) { + lv_obj_set_hidden(large_scales_24_a, false); + lv_obj_set_hidden(large_scales_24_b, false); + lv_obj_set_hidden(large_scales_12, true); + } else { + lv_obj_set_hidden(large_scales_24_a, true); + lv_obj_set_hidden(large_scales_24_b, true); + lv_obj_set_hidden(large_scales_12, false); + } + + // create minute scales separation circle + circle = lv_obj_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_bg_opa(circle, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_obj_set_style_local_radius(circle, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 102); + lv_obj_set_size(circle, 204, 204); + lv_obj_align(circle, nullptr, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_border_width(circle, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 1); + lv_obj_set_style_local_border_color(circle, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); + + // create digits + zero = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_align(zero, LV_LABEL_ALIGN_CENTER); + lv_label_set_text_static(zero, "0"); + lv_obj_set_pos(zero, 113, 25); + lv_obj_set_style_local_text_color(zero, LV_LABEL_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); + if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) { + lv_obj_set_pos(twelve, 107, 188); + } else { + lv_obj_set_pos(twelve, 107, 10); + } lv_obj_set_style_local_text_color(twelve, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_AQUA); + if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) { + lv_obj_set_hidden(circle, false); + lv_obj_set_hidden(zero, false); + lv_obj_set_pos(twelve, 107, 188); + tfHourEnable = true; + } else { + lv_obj_set_hidden(circle, true); + lv_obj_set_hidden(zero, true); + lv_obj_set_pos(twelve, 107, 10); + tfHourEnable = false; + } + batteryIcon.Create(lv_scr_act()); lv_obj_align(batteryIcon.GetObject(), nullptr, LV_ALIGN_IN_TOP_RIGHT, 0, 0); @@ -111,17 +192,18 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController, 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); + if (settingsController.GetAClockStyle() == Pinetime::Controllers::Settings::AClockStyle::H24) { + lv_obj_align(label_date_day, nullptr, LV_ALIGN_CENTER, 40, 0); + } else { + 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); @@ -129,30 +211,53 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController, 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); + if (settingsController.GetASecondHand() == Pinetime::Controllers::Settings::ASecondHand::On) { + lv_obj_set_hidden(second_body, false); + } else { + lv_obj_set_hidden(second_body, true); + } 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); - 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_width(&hour_line_style, LV_STATE_DEFAULT, 5); 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); + btnClose = lv_btn_create(lv_scr_act(), nullptr); + btnClose->user_data = this; + lv_obj_set_size(btnClose, 60, 60); + lv_obj_align(btnClose, lv_scr_act(), LV_ALIGN_CENTER, 0, -80); + lv_obj_set_style_local_bg_opa(btnClose, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_t* lblClose = lv_label_create(btnClose, nullptr); + lv_label_set_text_static(lblClose, "X"); + lv_obj_set_event_cb(btnClose, event_handler); + lv_obj_set_hidden(btnClose, true); + + btnClockStyle = lv_btn_create(lv_scr_act(), nullptr); + btnClockStyle->user_data = this; + lv_obj_set_size(btnClockStyle, 160, 60); + lv_obj_align(btnClockStyle, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); + lv_obj_set_style_local_bg_opa(btnClockStyle, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_t* lblClockStyle = lv_label_create(btnClockStyle, nullptr); + lv_label_set_text_static(lblClockStyle, "12h/24h"); + lv_obj_set_event_cb(btnClockStyle, event_handler); + lv_obj_set_hidden(btnClockStyle, true); + + btnSecondHand = lv_btn_create(lv_scr_act(), nullptr); + btnSecondHand->user_data = this; + lv_obj_set_size(btnSecondHand, 160, 60); + lv_obj_align(btnSecondHand, lv_scr_act(), LV_ALIGN_CENTER, 0, 60); + lv_obj_set_style_local_bg_opa(btnSecondHand, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_t* lblSecondHand = lv_label_create(btnSecondHand, nullptr); + lv_label_set_text_static(lblSecondHand, "seconds"); + lv_obj_set_event_cb(btnSecondHand, event_handler); + lv_obj_set_hidden(btnSecondHand, true); taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); @@ -163,14 +268,41 @@ WatchFaceAnalog::~WatchFaceAnalog() { 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()); } +bool WatchFaceAnalog::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnClose)) { + lv_obj_set_hidden(btnClose, false); + lv_obj_set_hidden(btnClockStyle, false); + lv_obj_set_hidden(btnSecondHand, false); + savedTick = lv_tick_get(); + return true; + } + if ((event == Pinetime::Applications::TouchEvents::DoubleTap) && (lv_obj_get_hidden(btnClose) == false)) { + return true; + } + return false; +} + +void WatchFaceAnalog::CloseMenu() { + settingsController.SaveSettings(); + lv_obj_set_hidden(btnClose, true); + lv_obj_set_hidden(btnClockStyle, true); + lv_obj_set_hidden(btnSecondHand, true); +} + +bool WatchFaceAnalog::OnButtonPushed() { + if (!lv_obj_get_hidden(btnClose)) { + CloseMenu(); + return true; + } + return false; +} + void WatchFaceAnalog::UpdateClock() { uint8_t hour = dateTimeController.Hours(); uint8_t minute = dateTimeController.Minutes(); @@ -178,29 +310,27 @@ void WatchFaceAnalog::UpdateClock() { if (sMinute != minute) { auto const angle = minute * 6; - minute_point[0] = CoordinateRelocate(30, angle); + minute_point[0] = CoordinateRelocate(-15, 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) { + if (sHour != hour || sMinute != minute || sTfHourEnable != tfHourEnable) { sHour = hour; sMinute = minute; - auto const angle = (hour * 30 + minute / 2); + sTfHourEnable = tfHourEnable; - hour_point[0] = CoordinateRelocate(30, angle); - hour_point[1] = CoordinateRelocate(HourLength, angle); + auto angle = (hour * 30 + minute / 2); - hour_point_trace[0] = CoordinateRelocate(5, angle); - hour_point_trace[1] = CoordinateRelocate(31, angle); + if (tfHourEnable == true) { + angle = angle / 2; + } + + hour_point[0] = CoordinateRelocate(-10, angle); + hour_point[1] = CoordinateRelocate(HourLength, angle); lv_line_set_points(hour_body, hour_point, 2); - lv_line_set_points(hour_body_trace, hour_point_trace, 2); } if (sSecond != second) { @@ -262,3 +392,77 @@ void WatchFaceAnalog::Refresh() { } } } + +void WatchFaceAnalog::UpdateSelected(lv_obj_t* object, lv_event_t event) { + if (event == LV_EVENT_CLICKED) { + if (object == btnClose) { + CloseMenu(); + } + + if (object == btnClockStyle) { + if (tfHourEnable == false) { + // set clockstyle to 24 hours + tfHourEnable = true; + + // (un)hide clockstyle elements + lv_obj_set_hidden(large_scales_12, true); + lv_obj_set_hidden(large_scales_24_a, false); + lv_obj_set_hidden(large_scales_24_b, false); + lv_obj_set_hidden(circle, false); + lv_obj_set_hidden(zero, false); + + // reposition 12 + lv_obj_set_pos(twelve, 107, 188); + // reposition date + lv_obj_align(label_date_day, nullptr, LV_ALIGN_CENTER, 40, 0); + + // changes to minor and major scales + lv_linemeter_set_scale(minor_scales, 360, 61); + lv_obj_set_size(minor_scales, 236, 236); + lv_obj_align(minor_scales, nullptr, LV_ALIGN_CENTER, 0, 0); + + lv_linemeter_set_scale(major_scales, 360, 13); + lv_linemeter_set_angle_offset(major_scales, 30); + + // save settings + settingsController.SetAClockStyle(Controllers::Settings::AClockStyle::H24); + } else { + // set clockstyle to 12 hours + tfHourEnable = false; + + // (un)hide clockstyle elements + lv_obj_set_hidden(large_scales_12, false); + lv_obj_set_hidden(large_scales_24_a, true); + lv_obj_set_hidden(large_scales_24_b, true); + lv_obj_set_hidden(circle, true); + lv_obj_set_hidden(zero, true); + + // reposition 12 + lv_obj_set_pos(twelve, 107, 10); + // reposition date + lv_obj_align(label_date_day, nullptr, LV_ALIGN_CENTER, 50, 0); + + // changes to minor and major scales + lv_linemeter_set_scale(minor_scales, 300, 51); + lv_obj_set_size(minor_scales, 240, 240); + lv_obj_align(minor_scales, nullptr, LV_ALIGN_CENTER, 0, 0); + + lv_linemeter_set_scale(major_scales, 300, 11); + lv_linemeter_set_angle_offset(major_scales, 180); + + // save settings + settingsController.SetAClockStyle(Controllers::Settings::AClockStyle::H12); + } + } + + if (object == btnSecondHand) { + if (lv_obj_get_hidden(second_body)) { + lv_obj_set_hidden(second_body, false); + settingsController.SetASecondHand(Controllers::Settings::ASecondHand::On); + } else { + lv_obj_set_hidden(second_body, true); + settingsController.SetASecondHand(Controllers::Settings::ASecondHand::Off); + } + } + } +} diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h index 958ff64dc4..aa91088363 100644 --- a/src/displayapp/screens/WatchFaceAnalog.h +++ b/src/displayapp/screens/WatchFaceAnalog.h @@ -33,10 +33,16 @@ namespace Pinetime { ~WatchFaceAnalog() override; + bool OnTouchEvent(TouchEvents event) override; + bool OnButtonPushed() override; + void Refresh() override; + void UpdateSelected(lv_obj_t* object, lv_event_t event); + private: uint8_t sHour, sMinute, sSecond; + uint32_t savedTick = 0; Utility::DirtyValue<uint8_t> batteryPercentRemaining {0}; Utility::DirtyValue<bool> isCharging {}; @@ -45,27 +51,30 @@ namespace Pinetime { Utility::DirtyValue<bool> notificationState {false}; Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate; + bool tfHourEnable, sTfHourEnable; + + lv_obj_t* btnClose; + lv_obj_t* btnClockStyle; + lv_obj_t* btnSecondHand; lv_obj_t* minor_scales; lv_obj_t* major_scales; - lv_obj_t* large_scales; + lv_obj_t* large_scales_12; + lv_obj_t* large_scales_24_a; + lv_obj_t* large_scales_24_b; + lv_obj_t* circle; + lv_obj_t* zero; 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; @@ -83,6 +92,7 @@ namespace Pinetime { void UpdateClock(); void SetBatteryIcon(); + void CloseMenu(); lv_task_t* taskRefresh; };