InfiniTime firmware for pinetime with a new watchface. Note that some other watchfaces are disabled from compilation to save memory space, in case. The WatchFaceMeow, named Meow in the interface, displays the status of the alarm on the screen

This commit is contained in:
ecarlett 2024-05-27 14:13:30 +02:00 committed by Eve C
parent 91fb716ea3
commit 55866d4470
5 changed files with 47 additions and 26 deletions

View file

@ -1,9 +1,16 @@
# [InfiniTime](https://github.com/InfiniTimeOrg/InfiniTime)
# Infinitime with a new watchface
![InfiniTime logo](doc/logo/infinitime-logo-small.jpg "InfiniTime Logo")
Fast open-source firmware for the [PineTime smartwatch](https://pine64.org/devices/pinetime/) with many features, written in modern C++.
## Quick notes on this InfiniTime version
- I copied the source code from this git repo : [InfiniTime](https://github.com/InfiniTimeOrg/InfiniTime)
- I added a watch face "WatchFaceMeow" whose main features are to be pink and have info about the alarm status
- I stored the compile commands in scripts compile.sh to run from InfiniTime/ folder, and make_pine_mcu.sh to build the image must be run from InfiniTime/build/ (compile.sh copies make_pine_mcu.sh to build/
- The file to flash to the pinetime is InfiniTime/build/pinetime-mcuboot-app-dfu-1.14.0.zip : I didn't change the version compared to the one I downloaded from [InfiniTime](https://github.com/InfiniTimeOrg/InfiniTime) so make sure not to keep keep a copy of it
## New to InfiniTime?
- [Getting started with InfiniTime](doc/gettingStarted/gettingStarted-1.0.md)

Binary file not shown.

View file

@ -1,8 +1,10 @@
to edit with new watch face :
# Add a new watchface :
## Modify the following files with the names of your source files :
- /src/displayapp/apps/Apps.h.in
- /src/components/settings/Settings.h
- /src/displayapp/UserApps.h
- /src/displayapp/apps/CMakeLists.txt
- CMakelists.txt
/src/displayapp/apps/Apps.h.in
/src/components/settings/Settings.h
/src/displayapp/UserApps.h
/src/displayapp/apps/CMakeLists.txt
CMakelists.txt

View file

@ -1,3 +1,15 @@
/*********************************************************/
/*
* I modified the watchface Infineat :
* - added alarm info on the screen
* - modified the colors
* - modified step count icon
* Except colors, modifications are at line 254 and 500
*/
/*********************************************************/
#include "displayapp/screens/WatchFaceMeow.h"
#include <lvgl/lvgl.h>
@ -61,15 +73,18 @@ namespace {
LV_COLOR_MAKE(0xff, 0xff, 0xff),
LV_COLOR_MAKE(0x62, 0xd5, 0x15),
LV_COLOR_MAKE(0x00, 0x74, 0x00)};
constexpr std::array<lv_color_t, nLines> 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
//added comments to say which color is which triangle
constexpr std::array<lv_color_t, nLines> rainbowColors = {LV_COLOR_MAKE(0x2d, 0xa4, 0x00), //green, small triangle on top
LV_COLOR_MAKE(0xac, 0x09, 0xc4), //purple, smalltriangle in the bottom half part on the clock display side
LV_COLOR_MAKE(0xfe, 0x03, 0x03), //red, the two small triangles above and below the battery
LV_COLOR_MAKE(0x0d, 0x57, 0xff), //blue, the small triangle at the bottom
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
LV_COLOR_MAKE(0xe0, 0xb9, 0x00), //Yellow, large triangle on top left
LV_COLOR_MAKE(0xe8, 0x51, 0x02)}; //orange, large triangle on bottom left
// Add new colors, still rainbow but more pastel like
constexpr std::array<lv_color_t, nLines> rainbowVividColors ={LV_COLOR_MAKE(0xa5, 0xeb, 0x64),
LV_COLOR_MAKE(0xfc, 0x42, 0xb5),
LV_COLOR_MAKE(0xe7, 0xc1, 0xff),
@ -100,8 +115,8 @@ namespace {
LV_COLOR_MAKE(0x11, 0x70, 0x5a)};
//define colors for texts and symbols
// gray is used for text symbols and time. I changed it to pink, because I can.
//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<lv_color_t, nLines>* returnColor(colors color) {
@ -243,12 +258,16 @@ WatchFaceMeow::WatchFaceMeow(Controllers::DateTime& dateTimeController,
lv_obj_align(bleIcon, dateContainer, LV_ALIGN_OUT_TOP_MID, 0, -10);
//version par defaut de l'icône avant qu'il aie regardé le statut de l'alarme ?
// Based on existing code, I understand that items on the screen (date, bluteooth status..)
// are declared here with default states, and later below the state (date, ...) is assigned
// So I do the same to add the alarm status : I put a symbol that has a default value
// and a text that has a default value
// symbol
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, 0);
//version par defaut de l'icône avant qu'il aie regardé le statut de l'alarme ?
// text
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);
@ -481,8 +500,9 @@ void WatchFaceMeow::Refresh() {
lv_obj_align(bleIcon, dateContainer, LV_ALIGN_OUT_TOP_MID, 0, -10);
}
//Add alarm state and time
// Add alarm state and time
// AlarmState is an enum type in class AlarmController that is in namespace controllers
// Not sure if it can handle automatically am / pm format (TODO)
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, 0);
@ -495,14 +515,6 @@ void WatchFaceMeow::Refresh() {
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()) {