diff --git a/make_pine_mcu.sh b/make_pine_mcu.sh index d7af1cb8..87c00ff2 100755 --- a/make_pine_mcu.sh +++ b/make_pine_mcu.sh @@ -2,5 +2,5 @@ #cp ./displayapp/apps/Apps.h ../src/displayapp/apps/Apps.h -make -j4 pinetime-mcuboot-app +make clean -j4 pinetime-mcuboot-app diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b7f50de1..9a579eff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -371,7 +371,11 @@ list(APPEND SOURCE_FILES displayapp/screens/StopWatch.cpp displayapp/screens/BatteryIcon.cpp displayapp/screens/BleIcon.cpp +<<<<<<< HEAD displayapp/screens/AlarmIcon.cpp +======= + displayapp/screens/AlarmIcon.cpp +>>>>>>> f5dfbc44 (added symbols for alarm states, added alarm state and hour to watchface meow, changed steps to paw. Need to align everythign nicely and find where to change release number) displayapp/screens/NotificationIcon.cpp displayapp/screens/SystemInfo.cpp displayapp/screens/Label.cpp @@ -427,6 +431,7 @@ list(APPEND SOURCE_FILES displayapp/screens/WatchFaceTerminal.cpp displayapp/screens/WatchFacePineTimeStyle.cpp displayapp/screens/WatchFaceInfineatColors.cpp + displayapp/screens/WatchFaceMeow.cpp #displayapp/screens/WatchFaceCasioStyleG7710.cpp ## @@ -597,6 +602,7 @@ set(INCLUDE_FILES displayapp/screens/Paddle.h displayapp/screens/BatteryIcon.h displayapp/screens/BleIcon.h + displayapp/screens/AlarmIcon.h displayapp/screens/NotificationIcon.h displayapp/screens/SystemInfo.h displayapp/screens/ScreenList.h diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 099f0dcf..16dcdfd2 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -56,7 +56,11 @@ namespace Pinetime { int colorIndex = 0; }; - + struct WatchFaceMeow { + bool showSideCover = true; + int colorIndex = 0; + }; + Settings(Pinetime::Controllers::FS& fs); Settings(const Settings&) = delete; @@ -322,6 +326,7 @@ namespace Pinetime { WatchFaceInfineat watchFaceInfineat; WatchFaceInfineatColors watchFaceInfineatColors; + WatchFaceMeow watchFaceMeow; std::bitset<5> wakeUpMode {0}; uint16_t shakeWakeThreshold = 150; diff --git a/src/displayapp/UserApps.h b/src/displayapp/UserApps.h index 76ffa684..f76af024 100644 --- a/src/displayapp/UserApps.h +++ b/src/displayapp/UserApps.h @@ -13,6 +13,7 @@ #include "displayapp/screens/WatchFaceCasioStyleG7710.h" #include "displayapp/screens/WatchFaceInfineat.h" #include "displayapp/screens/WatchFaceInfineatColors.h" +#include "displayapp/screens/WatchFaceMeow.h" #include "displayapp/screens/WatchFacePineTimeStyle.h" #include "displayapp/screens/WatchFaceTerminal.h" diff --git a/src/displayapp/apps/Apps.h.in b/src/displayapp/apps/Apps.h.in index a591497b..e12a1ab9 100644 --- a/src/displayapp/apps/Apps.h.in +++ b/src/displayapp/apps/Apps.h.in @@ -52,6 +52,7 @@ namespace Pinetime { Terminal, Infineat, InfineatColors, + Meow, CasioStyleG7710, }; diff --git a/src/displayapp/apps/CMakeLists.txt b/src/displayapp/apps/CMakeLists.txt index 8925b246..ae6b1a46 100644 --- a/src/displayapp/apps/CMakeLists.txt +++ b/src/displayapp/apps/CMakeLists.txt @@ -14,7 +14,7 @@ else () set(DEFAULT_USER_APP_TYPES "${DEFAULT_USER_APP_TYPES}, Apps::Metronome") set(DEFAULT_USER_APP_TYPES "${DEFAULT_USER_APP_TYPES}, Apps::Navigation") set(DEFAULT_USER_APP_TYPES "${DEFAULT_USER_APP_TYPES}, Apps::Weather") - #set(DEFAULT_USER_APP_TYPES "${DEFAULT_USER_APP_TYPES}, Apps::Motion") + set(DEFAULT_USER_APP_TYPES "${DEFAULT_USER_APP_TYPES}, Apps::Motion") set(USERAPP_TYPES "${DEFAULT_USER_APP_TYPES}" CACHE STRING "List of user apps to build into the firmware") endif () @@ -22,11 +22,12 @@ if(DEFINED ENABLE_WATCHFACES) set(WATCHFACE_TYPES ${ENABLE_WATCHFACES} CACHE STRING "List of watch faces to build into the firmware") else() set(DEFAULT_WATCHFACE_TYPES "WatchFace::Digital") - set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Analog") + #set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Analog") set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::PineTimeStyle") - set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Terminal") - set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Infineat") + #set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Terminal") + #set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Infineat") set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::InfineatColors") + set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::Meow") #set(DEFAULT_WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}, WatchFace::CasioStyleG7710") set(WATCHFACE_TYPES "${DEFAULT_WATCHFACE_TYPES}" CACHE STRING "List of watch faces to build into the firmware") endif() diff --git a/src/displayapp/fonts/fonts.json b/src/displayapp/fonts/fonts.json index 793b8851..2a9eea43 100644 --- a/src/displayapp/fonts/fonts.json +++ b/src/displayapp/fonts/fonts.json @@ -7,7 +7,11 @@ }, { "file": "FontAwesome5-Solid+Brands+Regular.woff", +<<<<<<< HEAD "range": "0xf294, 0xf242, 0xf54b, 0xf21e, 0xf1e6, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf06e, 0xf015, 0xf00c, 0xf0f3, 0xf522, 0xf743, 0xf0f3, 0xf1f6" +======= + "range": "0xf294, 0xf242, 0xf54b, 0xf1b0, 0xf21e, 0xf1e6, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf06e, 0xf015, 0xf00c, 0xf0f3, 0xf522, 0xf743, 0xf4ba, 0xf236" +>>>>>>> f5dfbc44 (added symbols for alarm states, added alarm state and hour to watchface meow, changed steps to paw. Need to align everythign nicely and find where to change release number) } ], "bpp": 1, diff --git a/src/displayapp/screens/AlarmIcon.cpp b/src/displayapp/screens/AlarmIcon.cpp index fda87130..0ea1a8cb 100644 --- a/src/displayapp/screens/AlarmIcon.cpp +++ b/src/displayapp/screens/AlarmIcon.cpp @@ -4,8 +4,15 @@ using namespace Pinetime::Applications::Screens; const char* AlarmIcon::GetIcon(bool isSet) { if (isSet) { +<<<<<<< HEAD return Symbols::bell; } return Symbols::notbell; +======= + return Symbols::bird; + } + + return Symbols::zzz; +>>>>>>> f5dfbc44 (added symbols for alarm states, added alarm state and hour to watchface meow, changed steps to paw. Need to align everythign nicely and find where to change release number) } diff --git a/src/displayapp/screens/README.md b/src/displayapp/screens/README.md new file mode 100644 index 00000000..4f785766 --- /dev/null +++ b/src/displayapp/screens/README.md @@ -0,0 +1,8 @@ + to edit with new watch face : + +/src/displayapp/apps/Apps.h.in +/src/components/settings/Settings.h +/src/displayapp/UserApps.h +/src/displayapp/apps/CMakeLists.txt +CMakelists.txt + diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h index cf1b8aad..d392d72a 100644 --- a/src/displayapp/screens/Symbols.h +++ b/src/displayapp/screens/Symbols.h @@ -1,5 +1,5 @@ #pragma once - +//check https://github.com/InfiniTimeOrg/InfiniTime/blob/main/src/displayapp/fonts/README.md to add new symbols namespace Pinetime { namespace Applications { namespace Screens { @@ -10,6 +10,7 @@ namespace Pinetime { static constexpr const char* bluetooth = "\xEF\x8A\x94"; static constexpr const char* plug = "\xEF\x87\xA6"; static constexpr const char* shoe = "\xEF\x95\x8B"; + static constexpr const char* paw = "\xEF\x86\xB0"; static constexpr const char* clock = "\xEF\x80\x97"; static constexpr const char* bell = "\xEF\x83\xB3"; static constexpr const char* notbell = "\xEF\x87\xB6"; @@ -40,6 +41,8 @@ namespace Pinetime { static constexpr const char* eye = "\xEF\x81\xAE"; static constexpr const char* home = "\xEF\x80\x95"; static constexpr const char* sleep = "\xEE\xBD\x84"; + static constexpr const char* bird = "\xEF\x92\xBA"; + static constexpr const char* zzz = "\xEF\x88\xB6"; // fontawesome_weathericons.c // static constexpr const char* sun = "\xEF\x86\x85"; diff --git a/src/displayapp/screens/WatchFaceInfineatColors.cpp b/src/displayapp/screens/WatchFaceInfineatColors.cpp index 88241942..ab963493 100644 --- a/src/displayapp/screens/WatchFaceInfineatColors.cpp +++ b/src/displayapp/screens/WatchFaceInfineatColors.cpp @@ -96,7 +96,10 @@ namespace { LV_COLOR_MAKE(0xff, 0xff, 0xff), LV_COLOR_MAKE(0x2f, 0xb8, 0xa2), LV_COLOR_MAKE(0x11, 0x70, 0x5a)}; - + //define colors for texts and symbols + //static constexpr lv_color_t grayColor = LV_COLOR_MAKE(0x99, 0x99, 0x99); + static constexpr lv_color_t pinkColor = LV_COLOR_MAKE(0xff, 0x93, 0xaf); + constexpr const std::array* returnColor(colors color) { if (color == colors::orange) { return &orangeColors; @@ -201,15 +204,18 @@ WatchFaceInfineatColors::WatchFaceInfineatColors(Controllers::DateTime& dateTime labelHour = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text_static(labelHour, "01"); lv_obj_set_style_local_text_font(labelHour, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_bebas); + lv_obj_set_style_local_text_color(labelHour, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); lv_obj_align(labelHour, timeContainer, LV_ALIGN_IN_TOP_MID, 0, 0); labelMinutes = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(labelMinutes, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_bebas); + lv_obj_set_style_local_text_color(labelMinutes, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); lv_label_set_text_static(labelMinutes, "00"); lv_obj_align(labelMinutes, timeContainer, LV_ALIGN_IN_BOTTOM_MID, 0, 0); labelTimeAmPm = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(labelTimeAmPm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_teko); + lv_obj_set_style_local_text_color(labelTimeAmPm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); lv_label_set_text_static(labelTimeAmPm, ""); lv_obj_align(labelTimeAmPm, timeContainer, LV_ALIGN_OUT_RIGHT_TOP, 0, 15); @@ -219,29 +225,29 @@ WatchFaceInfineatColors::WatchFaceInfineatColors(Controllers::DateTime& dateTime lv_obj_set_size(dateContainer, 60, 30); lv_obj_align(dateContainer, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, 5); - static constexpr lv_color_t grayColor = LV_COLOR_MAKE(0x99, 0x99, 0x99); labelDate = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(labelDate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, grayColor); + lv_obj_set_style_local_text_color(labelDate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); lv_obj_set_style_local_text_font(labelDate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_teko); lv_obj_align(labelDate, dateContainer, LV_ALIGN_IN_TOP_MID, 0, 0); lv_label_set_text_static(labelDate, "Mon 01"); bleIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, grayColor); + lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); lv_label_set_text_static(bleIcon, Symbols::bluetooth); lv_obj_align(bleIcon, dateContainer, LV_ALIGN_OUT_BOTTOM_MID, 0, 0); stepValue = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, grayColor); + lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); lv_obj_set_style_local_text_font(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_teko); lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, 10, 0); lv_label_set_text_static(stepValue, "0"); stepIcon = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, grayColor); - lv_label_set_text_static(stepIcon, Symbols::shoe); + lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); + lv_label_set_text_static(stepIcon, Symbols::paw); lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); + // Setting buttons btnClose = lv_btn_create(lv_scr_act(), nullptr); btnClose->user_data = this; diff --git a/src/displayapp/screens/WatchFaceInfineatColors.h b/src/displayapp/screens/WatchFaceInfineatColors.h index 3a164278..27557c2d 100644 --- a/src/displayapp/screens/WatchFaceInfineatColors.h +++ b/src/displayapp/screens/WatchFaceInfineatColors.h @@ -72,6 +72,7 @@ namespace Pinetime { lv_obj_t* labelDate; lv_obj_t* bleIcon; lv_obj_t* stepIcon; + lv_obj_t* pawIcon; lv_obj_t* stepValue; lv_obj_t* notificationIcon; lv_obj_t* btnClose; diff --git a/src/displayapp/screens/WatchFaceMeow.cpp b/src/displayapp/screens/WatchFaceMeow.cpp new file mode 100644 index 00000000..e8324534 --- /dev/null +++ b/src/displayapp/screens/WatchFaceMeow.cpp @@ -0,0 +1,561 @@ +#include "displayapp/screens/WatchFaceMeow.h" + +#include +#include +#include "displayapp/screens/Symbols.h" +#include "displayapp/screens/BleIcon.h" +#include "displayapp/screens/AlarmIcon.h" +#include "components/settings/Settings.h" +#include "components/battery/BatteryController.h" +#include "components/ble/BleController.h" +#include "components/alarm/AlarmController.h" +#include "components/ble/NotificationManager.h" +#include "components/motion/MotionController.h" + +using namespace Pinetime::Applications::Screens; + +namespace { + void event_handler(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast(obj->user_data); + screen->UpdateSelected(obj, event); + } + + enum class colors { + orange, + blue, + green, + rainbow, + vivid, + pink, + nordGreen, + }; + + constexpr int nColors = 7; // must match number of colors in InfineatColorsColors + + constexpr int nLines = WatchFaceMeow::nLines; + + constexpr std::array orangeColors = {LV_COLOR_MAKE(0xfd, 0x87, 0x2b), + LV_COLOR_MAKE(0xdb, 0x33, 0x16), + LV_COLOR_MAKE(0x6f, 0x10, 0x00), + LV_COLOR_MAKE(0xfd, 0x7a, 0x0a), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xe8, 0x51, 0x02), + LV_COLOR_MAKE(0xea, 0x1c, 0x00)}; + constexpr std::array blueColors = {LV_COLOR_MAKE(0xe7, 0xf8, 0xff), + LV_COLOR_MAKE(0x22, 0x32, 0xd0), + LV_COLOR_MAKE(0x18, 0x2a, 0x8b), + LV_COLOR_MAKE(0xe7, 0xf8, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0x59, 0x91, 0xff), + LV_COLOR_MAKE(0x16, 0x36, 0xff)}; + constexpr std::array greenColors = {LV_COLOR_MAKE(0xb8, 0xff, 0x9b), + LV_COLOR_MAKE(0x08, 0x86, 0x08), + LV_COLOR_MAKE(0x00, 0x4a, 0x00), + LV_COLOR_MAKE(0xb8, 0xff, 0x9b), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0x62, 0xd5, 0x15), + LV_COLOR_MAKE(0x00, 0x74, 0x00)}; + constexpr std::array rainbowColors = {LV_COLOR_MAKE(0x2d, 0xa4, 0x00), //vert petit triangle le plus haut + LV_COLOR_MAKE(0xac, 0x09, 0xc4), //purple petit triangle bas côté horloge + LV_COLOR_MAKE(0xfe, 0x03, 0x03), //rouge 2 petits triangles à côté de batterie + LV_COLOR_MAKE(0x0d, 0x57, 0xff), //bleu petit triangle le plus bas + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xe0, 0xb9, 0x00), //jaune gd triangle haut + LV_COLOR_MAKE(0xe8, 0x51, 0x02)}; //orange gd triangle bas + constexpr std::array rainbowVividColors ={LV_COLOR_MAKE(0xa5, 0xeb, 0x64), + LV_COLOR_MAKE(0xfc, 0x42, 0xb5), + LV_COLOR_MAKE(0xe7, 0xc1, 0xff), + LV_COLOR_MAKE(0x11, 0xdf, 0xfa), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xec, 0x5d), + LV_COLOR_MAKE(0xff, 0x93, 0xaf)}; + + constexpr std::array pinkColors = {LV_COLOR_MAKE(0xff, 0xe5, 0xec), + LV_COLOR_MAKE(0xff, 0xb3, 0xc6), + LV_COLOR_MAKE(0xfb, 0x6f, 0x92), + LV_COLOR_MAKE(0xff, 0xe5, 0xec), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xc2, 0xd1), + LV_COLOR_MAKE(0xff, 0x8f, 0xab)}; + constexpr std::array nordGreenColors = {LV_COLOR_MAKE(0xd5, 0xf0, 0xe9), + LV_COLOR_MAKE(0x23, 0x83, 0x73), + LV_COLOR_MAKE(0x1d, 0x41, 0x3f), + LV_COLOR_MAKE(0xd5, 0xf0, 0xe9), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0xff, 0xff, 0xff), + LV_COLOR_MAKE(0x2f, 0xb8, 0xa2), + LV_COLOR_MAKE(0x11, 0x70, 0x5a)}; + + //define colors for texts and symbols + //static constexpr lv_color_t grayColor = LV_COLOR_MAKE(0x99, 0x99, 0x99); + static constexpr lv_color_t grayColor = LV_COLOR_MAKE(0x99, 0x99, 0x99); + static constexpr lv_color_t pinkColor = LV_COLOR_MAKE(0xfc, 0x42, 0xb5); + + constexpr const std::array* returnColor(colors color) { + if (color == colors::orange) { + return &orangeColors; + } + if (color == colors::blue) { + return &blueColors; + } + if (color == colors::green) { + return &greenColors; + } + if (color == colors::rainbow) { + return &rainbowColors; + } + if (color == colors::vivid) { + return &rainbowVividColors; + } + if (color == colors::pink) { + return &pinkColors; + } + return &nordGreenColors; + } +} + +WatchFaceMeow::WatchFaceMeow(Controllers::DateTime& dateTimeController, + const Controllers::Battery& batteryController, + const Controllers::Ble& bleController, + Controllers::AlarmController& alarmController, + Controllers::NotificationManager& notificationManager, + Controllers::Settings& settingsController, + Controllers::MotionController& motionController, + Controllers::FS& filesystem) + : currentDateTime {{}}, + dateTimeController {dateTimeController}, + batteryController {batteryController}, + bleController {bleController}, + alarmController {alarmController}, + notificationManager {notificationManager}, + settingsController {settingsController}, + motionController {motionController} { + lfs_file f = {}; + if (filesystem.FileOpen(&f, "/fonts/teko.bin", LFS_O_RDONLY) >= 0) { + filesystem.FileClose(&f); + font_teko = lv_font_load("F:/fonts/teko.bin"); + } + + if (filesystem.FileOpen(&f, "/fonts/bebas.bin", LFS_O_RDONLY) >= 0) { + filesystem.FileClose(&f); + font_bebas = lv_font_load("F:/fonts/bebas.bin"); + } + + // Side Cover + static constexpr lv_point_t linePoints[nLines][2] = {{{30, 25}, {68, -8}}, + {{26, 167}, {43, 216}}, + {{27, 40}, {27, 196}}, + {{12, 182}, {65, 249}}, + {{17, 99}, {17, 144}}, + {{14, 81}, {40, 127}}, + {{14, 163}, {40, 118}}, + {{-20, 124}, {25, -11}}, + {{-29, 89}, {27, 254}}}; + + static constexpr lv_style_int_t lineWidths[nLines] = {18, 15, 14, 22, 20, 18, 18, 52, 48}; + + const std::array* colors = returnColor(static_cast(settingsController.GetInfineatColorIndex())); + for (int i = 0; i < nLines; i++) { + lines[i] = lv_line_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_line_width(lines[i], LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lineWidths[i]); + lv_color_t color = (*colors)[i]; + lv_obj_set_style_local_line_color(lines[i], LV_LINE_PART_MAIN, LV_STATE_DEFAULT, color); + lv_line_set_points(lines[i], linePoints[i], 2); + } + + logoPine = lv_img_create(lv_scr_act(), nullptr); + lv_img_set_src(logoPine, "F:/images/pine_small.bin"); + lv_obj_set_pos(logoPine, 15, 106); + + lineBattery = lv_line_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_line_width(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 24); + lv_obj_set_style_local_line_color(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, (*colors)[4]); + lv_obj_set_style_local_line_opa(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 190); + lineBatteryPoints[0] = {27, 105}; + lineBatteryPoints[1] = {27, 106}; + lv_line_set_points(lineBattery, lineBatteryPoints, 2); + lv_obj_move_foreground(lineBattery); + + notificationIcon = lv_obj_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_bg_color(notificationIcon, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, (*colors)[7]); + lv_obj_set_style_local_radius(notificationIcon, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_obj_set_size(notificationIcon, 13, 13); + lv_obj_set_hidden(notificationIcon, true); + + if (!settingsController.GetInfineatShowSideCover()) { + ToggleBatteryIndicatorColor(false); + for (auto& line : lines) { + lv_obj_set_hidden(line, true); + } + } + + timeContainer = lv_obj_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_bg_opa(timeContainer, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_obj_set_size(timeContainer, 185, 185); + lv_obj_align(timeContainer, lv_scr_act(), LV_ALIGN_CENTER, 0, -10); + + labelHour = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(labelHour, "01"); + lv_obj_set_style_local_text_font(labelHour, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_bebas); + lv_obj_set_style_local_text_color(labelHour, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); + lv_obj_align(labelHour, timeContainer, LV_ALIGN_IN_TOP_MID, 0, 0); + + labelMinutes = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_font(labelMinutes, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_bebas); + lv_obj_set_style_local_text_color(labelMinutes, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); + lv_label_set_text_static(labelMinutes, "00"); + lv_obj_align(labelMinutes, timeContainer, LV_ALIGN_IN_BOTTOM_MID, 0, 0); + + labelTimeAmPm = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_font(labelTimeAmPm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_teko); + lv_obj_set_style_local_text_color(labelTimeAmPm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); + + lv_label_set_text_static(labelTimeAmPm, ""); + lv_obj_align(labelTimeAmPm, timeContainer, LV_ALIGN_OUT_RIGHT_TOP, 0, 15); + + dateContainer = lv_obj_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_bg_opa(dateContainer, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_obj_set_size(dateContainer, 60, 30); + lv_obj_align(dateContainer, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, 5); + + labelDate = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(labelDate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); + lv_obj_set_style_local_text_font(labelDate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_teko); + lv_obj_align(labelDate, dateContainer, LV_ALIGN_IN_TOP_MID, 0, 0); + lv_label_set_text_static(labelDate, "Mon 01"); + + bleIcon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); + lv_label_set_text_static(bleIcon, Symbols::bluetooth); + lv_obj_align(bleIcon, dateContainer, LV_ALIGN_OUT_BOTTOM_MID, 0, 0); + + + //version par defaut de l'icône avant qu'il aie regardé le statut de l'alarme ? + alarmIcon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(alarmIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); + lv_label_set_text_static(alarmIcon, Symbols::paw); + lv_obj_align(alarmIcon, dateContainer, LV_ALIGN_OUT_BOTTOM_MID, 0, -10); + //version par defaut de l'icône avant qu'il aie regardé le statut de l'alarme ? + labelAlarm = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(labelAlarm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); + lv_obj_set_style_local_text_font(labelAlarm, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_teko); + lv_obj_align(labelAlarm, alarmIcon, LV_ALIGN_OUT_BOTTOM_MID, -15, 10); + lv_label_set_text_static(labelAlarm, "00:00"); + + + stepValue = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); + lv_obj_set_style_local_text_font(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, font_teko); + lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, 10, 0); + lv_label_set_text_static(stepValue, "0"); + + stepIcon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pinkColor); + lv_label_set_text_static(stepIcon, Symbols::paw); + lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); + + + // Setting buttons + 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_70); + 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); + + btnNextColor = lv_btn_create(lv_scr_act(), nullptr); + btnNextColor->user_data = this; + lv_obj_set_size(btnNextColor, 60, 60); + lv_obj_align(btnNextColor, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -15, 0); + lv_obj_set_style_local_bg_opa(btnNextColor, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_70); + lv_obj_t* lblNextColor = lv_label_create(btnNextColor, nullptr); + lv_label_set_text_static(lblNextColor, ">"); + lv_obj_set_event_cb(btnNextColor, event_handler); + lv_obj_set_hidden(btnNextColor, true); + + btnPrevColor = lv_btn_create(lv_scr_act(), nullptr); + btnPrevColor->user_data = this; + lv_obj_set_size(btnPrevColor, 60, 60); + lv_obj_align(btnPrevColor, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 15, 0); + lv_obj_set_style_local_bg_opa(btnPrevColor, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_70); + lv_obj_t* lblPrevColor = lv_label_create(btnPrevColor, nullptr); + lv_label_set_text_static(lblPrevColor, "<"); + lv_obj_set_event_cb(btnPrevColor, event_handler); + lv_obj_set_hidden(btnPrevColor, true); + + btnToggleCover = lv_btn_create(lv_scr_act(), nullptr); + btnToggleCover->user_data = this; + lv_obj_set_size(btnToggleCover, 60, 60); + lv_obj_align(btnToggleCover, lv_scr_act(), LV_ALIGN_CENTER, 0, 80); + lv_obj_set_style_local_bg_opa(btnToggleCover, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_70); + const char* labelToggle = settingsController.GetInfineatShowSideCover() ? "ON" : "OFF"; + lblToggle = lv_label_create(btnToggleCover, nullptr); + lv_label_set_text_static(lblToggle, labelToggle); + lv_obj_set_event_cb(btnToggleCover, event_handler); + lv_obj_set_hidden(btnToggleCover, true); + + // Button to access the settings + btnSettings = lv_btn_create(lv_scr_act(), nullptr); + btnSettings->user_data = this; + lv_obj_set_size(btnSettings, 150, 150); + lv_obj_align(btnSettings, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_radius(btnSettings, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 30); + lv_obj_set_style_local_bg_opa(btnSettings, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_70); + lv_obj_set_event_cb(btnSettings, event_handler); + labelBtnSettings = lv_label_create(btnSettings, nullptr); + lv_obj_set_style_local_text_font(labelBtnSettings, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); + lv_label_set_text_static(labelBtnSettings, Symbols::settings); + lv_obj_set_hidden(btnSettings, true); + + taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); + Refresh(); +} + +WatchFaceMeow::~WatchFaceMeow() { + lv_task_del(taskRefresh); + + if (font_bebas != nullptr) { + lv_font_free(font_bebas); + } + if (font_teko != nullptr) { + lv_font_free(font_teko); + } + + lv_obj_clean(lv_scr_act()); +} + +bool WatchFaceMeow::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnSettings)) { + lv_obj_set_hidden(btnSettings, false); + savedTick = lv_tick_get(); + return true; + } + // Prevent screen from sleeping when double tapping with settings on + if ((event == Pinetime::Applications::TouchEvents::DoubleTap) && !lv_obj_get_hidden(btnClose)) { + return true; + } + return false; +} + +void WatchFaceMeow::CloseMenu() { + settingsController.SaveSettings(); + lv_obj_set_hidden(btnClose, true); + lv_obj_set_hidden(btnNextColor, true); + lv_obj_set_hidden(btnPrevColor, true); + lv_obj_set_hidden(btnToggleCover, true); +} + +bool WatchFaceMeow::OnButtonPushed() { + if (!lv_obj_get_hidden(btnClose)) { + CloseMenu(); + return true; + } + return false; +} + +void WatchFaceMeow::UpdateSelected(lv_obj_t* object, lv_event_t event) { + if (event == LV_EVENT_CLICKED) { + bool showSideCover = settingsController.GetInfineatShowSideCover(); + int colorIndex = settingsController.GetInfineatColorIndex(); + + if (object == btnSettings) { + lv_obj_set_hidden(btnSettings, true); + lv_obj_set_hidden(btnClose, false); + lv_obj_set_hidden(btnNextColor, !showSideCover); + lv_obj_set_hidden(btnPrevColor, !showSideCover); + lv_obj_set_hidden(btnToggleCover, false); + } + if (object == btnClose) { + CloseMenu(); + } + if (object == btnToggleCover) { + settingsController.SetInfineatShowSideCover(!showSideCover); + ToggleBatteryIndicatorColor(!showSideCover); + for (auto& line : lines) { + lv_obj_set_hidden(line, showSideCover); + } + lv_obj_set_hidden(btnNextColor, showSideCover); + lv_obj_set_hidden(btnPrevColor, showSideCover); + const char* labelToggle = showSideCover ? "OFF" : "ON"; + lv_label_set_text_static(lblToggle, labelToggle); + } + if (object == btnNextColor) { + colorIndex = (colorIndex + 1) % nColors; + settingsController.SetInfineatColorIndex(colorIndex); + } + if (object == btnPrevColor) { + colorIndex -= 1; + if (colorIndex < 0) + colorIndex = nColors - 1; + settingsController.SetInfineatColorIndex(colorIndex); + } + if (object == btnNextColor || object == btnPrevColor) { + const std::array* colors = returnColor(static_cast(settingsController.GetInfineatColorIndex())); + for (int i = 0; i < nLines; i++) { + lv_color_t color = (*colors)[i]; + lv_obj_set_style_local_line_color(lines[i], LV_LINE_PART_MAIN, LV_STATE_DEFAULT, color); + } + lv_obj_set_style_local_line_color(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, (*colors)[4]); + lv_obj_set_style_local_bg_color(notificationIcon, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, (*colors)[7]); + } + } +} + +void WatchFaceMeow::Refresh() { + notificationState = notificationManager.AreNewNotificationsAvailable(); + if (notificationState.IsUpdated()) { + lv_obj_set_hidden(notificationIcon, !notificationState.Get()); + lv_obj_align(notificationIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0); + } + + currentDateTime = std::chrono::time_point_cast(dateTimeController.CurrentDateTime()); + if (currentDateTime.IsUpdated()) { + uint8_t hour = dateTimeController.Hours(); + uint8_t minute = dateTimeController.Minutes(); + + if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { + char ampmChar[3] = "AM"; + if (hour == 0) { + hour = 12; + } else if (hour == 12) { + ampmChar[0] = 'P'; + } else if (hour > 12) { + hour = hour - 12; + ampmChar[0] = 'P'; + } + lv_label_set_text(labelTimeAmPm, ampmChar); + } + lv_label_set_text_fmt(labelHour, "%02d", hour); + lv_label_set_text_fmt(labelMinutes, "%02d", minute); + + if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { + lv_obj_align(labelTimeAmPm, timeContainer, LV_ALIGN_OUT_RIGHT_TOP, 0, 10); + lv_obj_align(labelHour, timeContainer, LV_ALIGN_IN_TOP_MID, 0, 5); + lv_obj_align(labelMinutes, timeContainer, LV_ALIGN_IN_BOTTOM_MID, 0, 0); + } + + currentDate = std::chrono::time_point_cast(currentDateTime.Get()); + if (currentDate.IsUpdated()) { + uint8_t day = dateTimeController.Day(); + Controllers::DateTime::Days dayOfWeek = dateTimeController.DayOfWeek(); + lv_label_set_text_fmt(labelDate, "%s %02d", dateTimeController.DayOfWeekShortToStringLow(dayOfWeek), day); + lv_obj_realign(labelDate); + } + } + + batteryPercentRemaining = batteryController.PercentRemaining(); + isCharging = batteryController.IsCharging(); + if (batteryController.IsCharging()) { // Charging battery animation + chargingBatteryPercent += 1; + if (chargingBatteryPercent > 100) { + chargingBatteryPercent = batteryPercentRemaining.Get(); + } + SetBatteryLevel(chargingBatteryPercent); + } else if (isCharging.IsUpdated() || batteryPercentRemaining.IsUpdated()) { + chargingBatteryPercent = batteryPercentRemaining.Get(); + SetBatteryLevel(chargingBatteryPercent); + } + + bleState = bleController.IsConnected(); + bleRadioEnabled = bleController.IsRadioEnabled(); + if (bleState.IsUpdated()) { + //bleState.Get : in displayapp/widgets/StatusIcons.cpp: bleState = bleController.IsConnected(); + //dynamic icons have their definitions in displayApp/screens/BleIcon.h / cpp + lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get())); + lv_obj_align(bleIcon, dateContainer, LV_ALIGN_OUT_BOTTOM_MID, 0, 3); + } + + //Add alarm state and time + // AlarmState is an enum type in class AlarmController that is in namespace controllers + alarmState = alarmController.State()==Pinetime::Controllers::AlarmController::AlarmState::Set; + lv_label_set_text_static(alarmIcon, AlarmIcon::GetIcon(alarmState)); + lv_obj_align(alarmIcon, dateContainer, LV_ALIGN_OUT_BOTTOM_MID, 0, -3); + if (alarmState) { + uint8_t alarmHours = alarmController.Hours(); + uint8_t alarmMinutes = alarmController.Minutes(); + lv_label_set_text_fmt(labelAlarm, "%02d:%02d", alarmHours, alarmMinutes); + } + else { + lv_label_set_text_static(labelAlarm, Symbols::none); + } + + //lv_label_set_text_fmt(labelMinutes, "%02d", minute); +/* + if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { + lv_obj_align(labelHour, timeContainer, LV_ALIGN_IN_TOP_MID, 0, 5); + lv_obj_align(labelMinutes, timeContainer, LV_ALIGN_IN_BOTTOM_MID, 0, 0); + } + */ + + + stepCount = motionController.NbSteps(); + if (stepCount.IsUpdated()) { + lv_label_set_text_fmt(stepValue, "%lu", stepCount.Get()); + lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 10, 0); + lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); + } + + if (!lv_obj_get_hidden(btnSettings)) { + if ((savedTick > 0) && (lv_tick_get() - savedTick > 3000)) { + lv_obj_set_hidden(btnSettings, true); + savedTick = 0; + } + } +} + +void WatchFaceMeow::SetBatteryLevel(uint8_t batteryPercent) { + // starting point (y) + Pine64 logo height * (100 - batteryPercent) / 100 + lineBatteryPoints[1] = {27, static_cast(105 + 32 * (100 - batteryPercent) / 100)}; + lv_line_set_points(lineBattery, lineBatteryPoints, 2); +} + +void WatchFaceMeow::ToggleBatteryIndicatorColor(bool showSideCover) { + if (!showSideCover) { // make indicator and notification icon color white + lv_obj_set_style_local_image_recolor_opa(logoPine, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_100); + lv_obj_set_style_local_image_recolor(logoPine, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_local_line_color(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_local_bg_color(notificationIcon, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); + } else { + lv_obj_set_style_local_image_recolor_opa(logoPine, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_0); + const std::array* colors = returnColor(static_cast(settingsController.GetInfineatColorIndex())); + lv_obj_set_style_local_line_color(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, (*colors)[4]); + lv_obj_set_style_local_bg_color(notificationIcon, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, (*colors)[7]); + } +} + +bool WatchFaceMeow::IsAvailable(Pinetime::Controllers::FS& filesystem) { + lfs_file file = {}; + + if (filesystem.FileOpen(&file, "/fonts/teko.bin", LFS_O_RDONLY) < 0) { + return false; + } + + filesystem.FileClose(&file); + if (filesystem.FileOpen(&file, "/fonts/bebas.bin", LFS_O_RDONLY) < 0) { + return false; + } + + filesystem.FileClose(&file); + if (filesystem.FileOpen(&file, "/images/pine_small.bin", LFS_O_RDONLY) < 0) { + return false; + } + + filesystem.FileClose(&file); + return true; +} diff --git a/src/displayapp/screens/WatchFaceMeow.h b/src/displayapp/screens/WatchFaceMeow.h new file mode 100644 index 00000000..8978f5bf --- /dev/null +++ b/src/displayapp/screens/WatchFaceMeow.h @@ -0,0 +1,130 @@ +#pragma once + +#include +#include +#include +#include +#include +#include "displayapp/screens/Screen.h" +#include "components/datetime/DateTimeController.h" +#include "utility/DirtyValue.h" +#include "displayapp/apps/Apps.h" + +namespace Pinetime { + namespace Controllers { + class Settings; + class Battery; + class Ble; + class NotificationManager; + class MotionController; + } + + namespace Applications { + namespace Screens { + + class WatchFaceMeow : public Screen { + public: + static constexpr int nLines = 9; + WatchFaceMeow(Controllers::DateTime& dateTimeController, + const Controllers::Battery& batteryController, + const Controllers::Ble& bleController, + Controllers::AlarmController& alarmController, + Controllers::NotificationManager& notificationManager, + Controllers::Settings& settingsController, + Controllers::MotionController& motionController, + Controllers::FS& fs); + + ~WatchFaceMeow() override; + + bool OnTouchEvent(TouchEvents event) override; + bool OnButtonPushed() override; + void UpdateSelected(lv_obj_t* object, lv_event_t event); + void CloseMenu(); + + void Refresh() override; + + static bool IsAvailable(Pinetime::Controllers::FS& filesystem); + + private: + uint32_t savedTick = 0; + uint8_t chargingBatteryPercent = 101; // not a mistake ;) + + Utility::DirtyValue batteryPercentRemaining {}; + Utility::DirtyValue isCharging {}; + Utility::DirtyValue bleState {}; + Utility::DirtyValue bleRadioEnabled {}; + bool alarmState {}; + Utility::DirtyValue> currentDateTime {}; + Utility::DirtyValue stepCount {}; + Utility::DirtyValue notificationState {}; + Utility::DirtyValue> currentDate; + + // Lines making up the side cover + lv_obj_t* lineBattery; + + lv_point_t lineBatteryPoints[2]; + + lv_obj_t* logoPine; + + lv_obj_t* timeContainer; + lv_obj_t* labelHour; + lv_obj_t* labelMinutes; + lv_obj_t* labelTimeAmPm; + lv_obj_t* dateContainer; + lv_obj_t* labelDate; + lv_obj_t* bleIcon; + lv_obj_t* labelAlarm; + lv_obj_t* alarmIcon; + lv_obj_t* stepIcon; + lv_obj_t* pawIcon; + lv_obj_t* stepValue; + lv_obj_t* notificationIcon; + lv_obj_t* btnClose; + lv_obj_t* btnNextColor; + lv_obj_t* btnToggleCover; + lv_obj_t* btnPrevColor; + lv_obj_t* btnSettings; + lv_obj_t* labelBtnSettings; + lv_obj_t* lblToggle; + + lv_obj_t* lines[nLines]; + + Controllers::DateTime& dateTimeController; + const Controllers::Battery& batteryController; + const Controllers::Ble& bleController; + Controllers::AlarmController& alarmController; + Controllers::NotificationManager& notificationManager; + Controllers::Settings& settingsController; + Controllers::MotionController& motionController; + + void SetBatteryLevel(uint8_t batteryPercent); + void ToggleBatteryIndicatorColor(bool showSideCover); + + lv_task_t* taskRefresh; + lv_font_t* font_teko = nullptr; + lv_font_t* font_bebas = nullptr; + }; + } + + template <> + struct WatchFaceTraits { + static constexpr WatchFace watchFace = WatchFace::Meow; + static constexpr const char* name = "Meow face"; + + static Screens::Screen* Create(AppControllers& controllers) { + return new Screens::WatchFaceMeow(controllers.dateTimeController, + controllers.batteryController, + controllers.bleController, + controllers.alarmController, + controllers.notificationManager, + controllers.settingsController, + controllers.motionController, + controllers.filesystem); + }; + + static bool IsAvailable(Pinetime::Controllers::FS& filesystem) { + return Screens::WatchFaceMeow::IsAvailable(filesystem); + } + }; + } +} diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h index 1ff03e22..4425bdcd 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.h +++ b/src/displayapp/screens/settings/SettingWatchFace.h @@ -11,8 +11,11 @@ #include "displayapp/screens/CheckboxList.h" #include "displayapp/screens/WatchFaceInfineat.h" #include "displayapp/screens/WatchFaceInfineatColors.h" +#include "displayapp/screens/WatchFaceMeow.h" #include "displayapp/screens/WatchFaceCasioStyleG7710.h" + + namespace Pinetime { namespace Applications {