diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-03-24 06:09:54 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-03-24 10:15:57 (GMT) |
| commit | 22bbf46a12c65275a14aeddb1941b0fec0eb0b5b (patch) | |
| tree | 08110be72491ac1c472c8a4dd6cd9e43d2b95053 | |
| parent | 7d4592a8e95566b7e2d3adecef8ed0349905759f (diff) | |
sans paddle and analog watchface
| -rw-r--r-- | src/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/displayapp/Apps.h | 1 | ||||
| -rw-r--r-- | src/displayapp/DisplayApp.cpp | 4 | ||||
| -rw-r--r-- | src/displayapp/screens/ApplicationList.cpp | 1 | ||||
| -rw-r--r-- | src/displayapp/screens/Clock.cpp | 9 | ||||
| -rw-r--r-- | src/displayapp/screens/Clock.h | 1 | ||||
| -rw-r--r-- | src/displayapp/screens/Paddle.cpp | 91 | ||||
| -rw-r--r-- | src/displayapp/screens/Paddle.h | 48 | ||||
| -rw-r--r-- | src/displayapp/screens/Symbols.h | 1 | ||||
| -rw-r--r-- | src/displayapp/screens/WatchFaceAnalog.cpp | 231 | ||||
| -rw-r--r-- | src/displayapp/screens/WatchFaceAnalog.h | 83 | ||||
| -rw-r--r-- | src/displayapp/screens/settings/SettingWatchFace.h | 2 |
12 files changed, 1 insertions, 475 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e5d71ca..c3457ab 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -406,7 +406,6 @@ list(APPEND SOURCE_FILES displayapp/screens/Tile.cpp displayapp/screens/Meter.cpp displayapp/screens/InfiniPaint.cpp - displayapp/screens/Paddle.cpp displayapp/screens/StopWatch.cpp displayapp/screens/BatteryIcon.cpp displayapp/screens/BleIcon.cpp @@ -452,8 +451,6 @@ list(APPEND SOURCE_FILES displayapp/screens/settings/SettingAirplaneMode.cpp ## Watch faces - displayapp/icons/bg_clock.c - displayapp/screens/WatchFaceAnalog.cpp displayapp/screens/WatchFaceDigital.cpp displayapp/screens/PineTimeStyle.cpp @@ -628,7 +625,6 @@ set(INCLUDE_FILES displayapp/screens/Meter.h displayapp/screens/InfiniPaint.h displayapp/screens/StopWatch.h - displayapp/screens/Paddle.h displayapp/screens/BatteryIcon.h displayapp/screens/BleIcon.h displayapp/screens/NotificationIcon.h diff --git a/src/displayapp/Apps.h b/src/displayapp/Apps.h index dc9e625..1f815cb 100644 --- a/src/displayapp/Apps.h +++ b/src/displayapp/Apps.h @@ -17,7 +17,6 @@ namespace Pinetime { BatteryInfo, Music, Paint, - Paddle, Twos, HeartRate, Navigation, diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index fdc6376..cc46e82 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -16,7 +16,6 @@ #include "displayapp/screens/FirmwareUpdate.h" #include "displayapp/screens/FirmwareValidation.h" #include "displayapp/screens/InfiniPaint.h" -#include "displayapp/screens/Paddle.h" #include "displayapp/screens/StopWatch.h" #include "displayapp/screens/Meter.h" #include "displayapp/screens/Metronome.h" @@ -460,9 +459,6 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) case Apps::Paint: currentScreen = std::make_unique<Screens::InfiniPaint>(this, lvgl, motorController); break; - case Apps::Paddle: - currentScreen = std::make_unique<Screens::Paddle>(this, lvgl); - break; case Apps::Music: currentScreen = std::make_unique<Screens::Music>(this, systemTask->nimble().music()); break; diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp index 29c8aff..fa0c26b 100644 --- a/src/displayapp/screens/ApplicationList.cpp +++ b/src/displayapp/screens/ApplicationList.cpp @@ -54,7 +54,6 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen1() { std::unique_ptr<Screen> ApplicationList::CreateScreen2() { std::array<Screens::Tile::Applications, 6> applications {{ {Symbols::paintbrush, Apps::Paint}, - {Symbols::paddle, Apps::Paddle}, {"2", Apps::Twos}, {Symbols::chartLine, Apps::Motion}, {Symbols::drum, Apps::Metronome}, diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index d27b0a2..41a612d 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -9,7 +9,6 @@ #include "components/settings/Settings.h" #include "displayapp/DisplayApp.h" #include "displayapp/screens/WatchFaceDigital.h" -#include "displayapp/screens/WatchFaceAnalog.h" #include "displayapp/screens/PineTimeStyle.h" using namespace Pinetime::Applications::Screens; @@ -36,9 +35,6 @@ Clock::Clock(DisplayApp* app, return WatchFaceDigitalScreen(); break; case 1: - return WatchFaceAnalogScreen(); - break; - case 2: return PineTimeStyleScreen(); break; } @@ -70,11 +66,6 @@ std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() { motionController); } -std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() { - return std::make_unique<Screens::WatchFaceAnalog>( - app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); -} - std::unique_ptr<Screen> Clock::PineTimeStyleScreen() { return std::make_unique<Screens::PineTimeStyle>( app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, motionController); diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h index 50996a7..c9b0286 100644 --- a/src/displayapp/screens/Clock.h +++ b/src/displayapp/screens/Clock.h @@ -45,7 +45,6 @@ namespace Pinetime { std::unique_ptr<Screen> screen; std::unique_ptr<Screen> WatchFaceDigitalScreen(); - std::unique_ptr<Screen> WatchFaceAnalogScreen(); std::unique_ptr<Screen> PineTimeStyleScreen(); std::unique_ptr<Screen> WatchFaceTerminalScreen(); }; diff --git a/src/displayapp/screens/Paddle.cpp b/src/displayapp/screens/Paddle.cpp deleted file mode 100644 index 608eb64..0000000 --- a/src/displayapp/screens/Paddle.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "displayapp/screens/Paddle.h" -#include "displayapp/DisplayApp.h" -#include "displayapp/LittleVgl.h" - -#include <cstdlib> // for rand() - -using namespace Pinetime::Applications::Screens; - -Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl {lvgl} { - background = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_size(background, LV_HOR_RES + 1, LV_VER_RES); - lv_obj_set_pos(background, -1, 0); - lv_obj_set_style_local_radius(background, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); - lv_obj_set_style_local_bg_color(background, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_border_color(background, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_obj_set_style_local_border_width(background, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 1); - - points = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(points, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42); - lv_label_set_text(points, "0000"); - lv_obj_align(points, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 10); - - paddle = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(paddle, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_obj_set_style_local_radius(paddle, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0); - lv_obj_set_size(paddle, 4, 60); - - ball = lv_obj_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_bg_color(ball, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_obj_set_style_local_radius(ball, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_obj_set_size(ball, ballSize, ballSize); - - taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); -} - -Paddle::~Paddle() { - lv_task_del(taskRefresh); - lv_obj_clean(lv_scr_act()); -} - -void Paddle::Refresh() { - ballX += dx; - ballY += dy; - - lv_obj_set_pos(ball, ballX, ballY); - - // checks if it has touched the sides (floor and ceiling) - if (ballY <= 1 || ballY >= LV_VER_RES - ballSize - 2) { - dy *= -1; - } - - // checks if it has touched the side (right side) - if (ballX >= LV_HOR_RES - ballSize - 1) { - dx *= -1; - dy += rand() % 3 - 1; // add a little randomization in wall bounce direction, one of [-1, 0, 1] - if (dy > 5) { // limit dy to be in range [-5 to 5] - dy = 5; - } - if (dy < -5) { - dy = -5; - } - } - - // checks if it is in the position of the paddle - if (dx < 0 && ballX <= 4) { - if (ballX >= -ballSize / 4) { - if (ballY <= (paddlePos + 30 - ballSize / 4) && ballY >= (paddlePos - 30 - ballSize + ballSize / 4)) { - dx *= -1; - score++; - } - } - // checks if it has gone behind the paddle - else if (ballX <= -ballSize * 2) { - ballX = (LV_HOR_RES - ballSize) / 2; - ballY = (LV_VER_RES - ballSize) / 2; - score = 0; - } - } - lv_label_set_text_fmt(points, "%04d", score); -} - -bool Paddle::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - return true; -} - -bool Paddle::OnTouchEvent(uint16_t x, uint16_t y) { - // sets the center paddle pos. (30px offset) with the the y_coordinate of the finger - lv_obj_set_pos(paddle, 0, y - 30); - paddlePos = y; - return true; -} diff --git a/src/displayapp/screens/Paddle.h b/src/displayapp/screens/Paddle.h deleted file mode 100644 index 3a30eee..0000000 --- a/src/displayapp/screens/Paddle.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include <lvgl/lvgl.h> -#include <cstdint> -#include "displayapp/screens/Screen.h" - -namespace Pinetime { - namespace Components { - class LittleVgl; - } - namespace Applications { - namespace Screens { - - class Paddle : public Screen { - public: - Paddle(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl); - ~Paddle() override; - - void Refresh() override; - - bool OnTouchEvent(TouchEvents event) override; - bool OnTouchEvent(uint16_t x, uint16_t y) override; - - private: - Pinetime::Components::LittleVgl& lvgl; - - const uint8_t ballSize = 16; - - uint16_t paddlePos = 30; // Paddle center - - int16_t ballX = (LV_HOR_RES - ballSize) / 2; - int16_t ballY = (LV_VER_RES - ballSize) / 2; - - int8_t dx = 2; // Velocity of the ball in the x_coordinate - int8_t dy = 3; // Velocity of the ball in the y_coordinate - - uint16_t score = 0; - - lv_obj_t* points; - lv_obj_t* paddle; - lv_obj_t* ball; - lv_obj_t* background; - - lv_task_t* taskRefresh; - }; - } - } -} diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h index 5ba8f95..928bcd7 100644 --- a/src/displayapp/screens/Symbols.h +++ b/src/displayapp/screens/Symbols.h @@ -24,7 +24,6 @@ namespace Pinetime { static constexpr const char* tachometer = "\xEF\x8F\xBD"; static constexpr const char* asterisk = "\xEF\x81\xA9"; static constexpr const char* paintbrush = "\xEF\x87\xBC"; - static constexpr const char* paddle = "\xEF\x91\x9D"; static constexpr const char* map = "\xEF\x96\xa0"; static constexpr const char* qrcode = "\xEF\x80\xa9"; static constexpr const char* phone = "\xEF\x82\x95"; diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp deleted file mode 100644 index 6104281..0000000 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ /dev/null @@ -1,231 +0,0 @@ -#include "displayapp/screens/WatchFaceAnalog.h" -#include <cmath> -#include <lvgl/lvgl.h> -#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" - -LV_IMG_DECLARE(bg_clock); - -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<int32_t>(Sine(angle)) / LV_TRIG_SCALE), - .y = CoordinateYRelocate(radius * static_cast<int32_t>(Cosine(angle)) / LV_TRIG_SCALE) - }; -} - -} - -WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController, - Controllers::NotificationManager& notificationManager, - Controllers::Settings& settingsController) - : Screen(app), - currentDateTime {{}}, - dateTimeController {dateTimeController}, - batteryController {batteryController}, - bleController {bleController}, - notificationManager {notificationManager}, - settingsController {settingsController} { - - sHour = 99; - sMinute = 99; - sSecond = 99; - - lv_obj_t* bg_clock_img = lv_img_create(lv_scr_act(), NULL); - lv_img_set_src(bg_clock_img, &bg_clock); - lv_obj_align(bg_clock_img, NULL, LV_ALIGN_CENTER, 0, 0); - - batteryIcon = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(batteryIcon, Symbols::batteryHalf); - lv_obj_align(batteryIcon, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0); - lv_obj_set_auto_realign(batteryIcon, true); - - notificationIcon = lv_label_create(lv_scr_act(), NULL); - lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); - lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); - lv_obj_align(notificationIcon, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0); - - // Date - Day / Week day - - label_date_day = lv_label_create(lv_scr_act(), NULL); - lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xf0a500)); - 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, NULL, LV_ALIGN_CENTER, 50, 0); - - minute_body = lv_line_create(lv_scr_act(), NULL); - minute_body_trace = lv_line_create(lv_scr_act(), NULL); - hour_body = lv_line_create(lv_scr_act(), NULL); - hour_body_trace = lv_line_create(lv_scr_act(), NULL); - second_body = lv_line_create(lv_scr_act(), NULL); - - 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); - UpdateClock(); -} - -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()); -} - -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(); - if (batteryPercent == 100) { - lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); - } else { - lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); - } - lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); -} - -void WatchFaceAnalog::Refresh() { - isCharging = batteryController.IsCharging(); - if (isCharging.IsUpdated()) { - if (isCharging.Get()) { - lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); - lv_label_set_text(batteryIcon, Symbols::plug); - } else { - SetBatteryIcon(); - } - } - if (!isCharging.Get()) { - batteryPercentRemaining = batteryController.PercentRemaining(); - if (batteryPercentRemaining.IsUpdated()) { - SetBatteryIcon(); - } - } - - notificationState = notificationManager.AreNewNotificationsAvailable(); - - if (notificationState.IsUpdated()) { - lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(notificationState.Get())); - } - - currentDateTime = dateTimeController.CurrentDateTime(); - - if (currentDateTime.IsUpdated()) { - Pinetime::Controllers::DateTime::Months month = dateTimeController.Month(); - uint8_t day = dateTimeController.Day(); - Pinetime::Controllers::DateTime::Days dayOfWeek = dateTimeController.DayOfWeek(); - - UpdateClock(); - - if ((month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) { - lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), day); - - currentMonth = month; - currentDayOfWeek = dayOfWeek; - currentDay = day; - } - } -} diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h deleted file mode 100644 index 4d76298..0000000 --- a/src/displayapp/screens/WatchFaceAnalog.h +++ /dev/null @@ -1,83 +0,0 @@ -#pragma once - -#include <lvgl/src/lv_core/lv_obj.h> -#include <chrono> -#include <cstdint> -#include <memory> -#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" - -namespace Pinetime { - namespace Controllers { - class Settings; - class Battery; - class Ble; - class NotificationManager; - } - namespace Applications { - namespace Screens { - - class WatchFaceAnalog : public Screen { - public: - WatchFaceAnalog(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController, - Controllers::NotificationManager& notificationManager, - Controllers::Settings& settingsController); - - ~WatchFaceAnalog() override; - - void Refresh() override; - - private: - uint8_t sHour, sMinute, sSecond; - - Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown; - Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown; - uint8_t currentDay = 0; - - DirtyValue<uint8_t> batteryPercentRemaining {0}; - DirtyValue<bool> isCharging {}; - DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime; - DirtyValue<bool> notificationState {false}; - - 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* batteryIcon; - lv_obj_t* notificationIcon; - - const Controllers::DateTime& dateTimeController; - Controllers::Battery& batteryController; - 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 62427b4..6fd7a52 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.h +++ b/src/displayapp/screens/settings/SettingWatchFace.h @@ -20,7 +20,7 @@ namespace Pinetime { void UpdateSelected(lv_obj_t* object, lv_event_t event); private: - static constexpr std::array<const char*, 4> options = {" Digital face", " Analog face", " PineTimeStyle", " Terminal"}; + static constexpr std::array<const char*, 4> options = {" Digital face", " PineTimeStyle"}; Controllers::Settings& settingsController; lv_obj_t* cbOption[options.size()]; |
