Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add color picker for PineTimeStyle watchface #458

Merged
merged 53 commits into from
Aug 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
378fa6b
Reset
kieranc May 18, 2021
a4968b5
PineTimeStyle
kieranc May 18, 2021
6a92529
Revert "Reset"
kieranc May 18, 2021
108bbc3
Fix it again..
kieranc May 18, 2021
5daaa5c
Tidying/formatting fixes
kieranc May 19, 2021
249b6db
Remove newline modifications
kieranc May 19, 2021
5c41301
Move GPL license header
kieranc May 19, 2021
565601e
Merge remote-tracking branch 'upstream/develop' into pinetimestyle
kieranc May 21, 2021
f2d0116
Merge remote-tracking branch 'upstream/develop' into pinetimestyle
kieranc Jun 4, 2021
ab1a390
Merge branch 'develop' into pinetimestyle
JF002 Jun 12, 2021
f5d7569
Merge remote-tracking branch 'upstream/develop' into pinetimestyle
kieranc Jun 16, 2021
d7b73f1
Merge branch 'pinetimestyle' of github.com:kieranc/InfiniTime into pi…
kieranc Jun 16, 2021
b130ffa
Merge remote-tracking branch 'upstream/develop' into pinetimestyle
kieranc Jun 20, 2021
607af27
Add step count gauge - replaces heartrate in sidebar
kieranc Jun 20, 2021
266573d
Enable 12/24h functionality
kieranc Jun 20, 2021
be505fc
Set step gauge outer to be white when step goal is reached
kieranc Jun 21, 2021
c3f854b
Add font source file
kieranc Jun 22, 2021
14721e8
Move static needle_colors array to member variable
kieranc Jun 23, 2021
38ab0ad
PineTimeStyle color picker initial commit
kieranc Jun 24, 2021
7edfc53
PineTimeStyle color picker add settings integration
kieranc Jun 24, 2021
8f16574
PineTimeStyle color picker tidying
kieranc Jun 24, 2021
d5d8438
Merge remote-tracking branch 'upstream/develop' into pinetimestyle-co…
kieranc Jun 25, 2021
50b92e5
Move array to member variable, retrieve colors from settings for display
kieranc Jun 25, 2021
878dd1a
Use colors from settings for PineTimeStyle watchface
kieranc Jun 25, 2021
be22a9b
Fix off-by-one error, reduce step gauge needle width
kieranc Jun 25, 2021
f3b40cb
Make it loop around when you get to the end of the list of colors
kieranc Jun 25, 2021
800daec
Add a check to set default colors if all colors are white
kieranc Jun 25, 2021
6889cf1
Fix the fix, whoops
kieranc Jun 25, 2021
660a859
Add reset button, reduce button opacity
kieranc Jun 27, 2021
4f21748
Merge remote-tracking branch 'upstream/develop' into pinetimestyle-co…
kieranc Jun 29, 2021
9bd1808
Replace font file
kieranc Jun 29, 2021
2edf41b
Fix bad merge
kieranc Jun 29, 2021
f5639db
Change step gauge to use percentage of goal for progress
kieranc Jul 6, 2021
f970dc9
Merge remote-tracking branch 'upstream/develop' into pinetimestyle-co…
kieranc Jul 11, 2021
db99ac8
Merge remote-tracking branch 'upstream/develop' into pinetimestyle-co…
kieranc Jul 12, 2021
5c183be
Merge branch 'pinetimestyle-colorpicker' of github.com:kieranc/Infini…
kieranc Jul 12, 2021
db784fc
Merge remote-tracking branch 'upstream/develop' into pinetimestyle-co…
kieranc Jul 20, 2021
5e4d3c8
Remove .gitignore
kieranc Jul 22, 2021
1ddb1f0
Merge remote-tracking branch 'upstream/develop' into pinetimestyle-co…
kieranc Jul 23, 2021
547b5a8
Restore .gitignore
kieranc Jul 23, 2021
b3e3d75
Add extra screen in settings to show scrollbar correctly
kieranc Jul 24, 2021
e6bc485
Increment settings value, remove old hacky fix
kieranc Jul 25, 2021
12aeb46
Merge remote-tracking branch 'upstream/develop' into pinetimestyle-co…
kieranc Jul 28, 2021
52ee25e
Merge remote-tracking branch 'upstream/develop' into pinetimestyle-co…
kieranc Aug 12, 2021
6bffc7d
Tidying
kieranc Aug 12, 2021
477ff32
Add randomise button to color picker
kieranc Aug 15, 2021
c0bb887
Add check for randomise button in case colors clash
kieranc Aug 15, 2021
16ea069
Remove duplicate code, minor fixes
kieranc Aug 15, 2021
5789f15
Avoid setting the sidebar black
kieranc Aug 15, 2021
639fd3a
More tidying following review
kieranc Aug 15, 2021
9851ed3
Fix potential edge case of sidebar being set black
kieranc Aug 15, 2021
30b32e4
Merge remote-tracking branch 'upstream/develop' into pinetimestyle-co…
kieranc Aug 15, 2021
8ac1ae7
Merge remote-tracking branch 'upstream/develop' into pinetimestyle-co…
kieranc Aug 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ list(APPEND SOURCE_FILES
displayapp/screens/settings/SettingWakeUp.cpp
displayapp/screens/settings/SettingDisplay.cpp
displayapp/screens/settings/SettingSteps.cpp
displayapp/screens/settings/SettingPineTimeStyle.cpp

## Watch faces
displayapp/icons/bg_clock.c
Expand Down
33 changes: 32 additions & 1 deletion src/components/settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,33 @@ namespace Pinetime {
return settings.clockFace;
};

void SetPTSColorTime(uint8_t colorTime) {
if (colorTime != settings.PTSColorTime)
settingsChanged = true;
settings.PTSColorTime = colorTime;
};
uint8_t GetPTSColorTime() const {
return settings.PTSColorTime;
};

void SetPTSColorBar(uint8_t colorBar) {
if (colorBar != settings.PTSColorBar)
settingsChanged = true;
settings.PTSColorBar = colorBar;
};
uint8_t GetPTSColorBar() const {
return settings.PTSColorBar;
};

void SetPTSColorBG(uint8_t colorBG) {
if (colorBG != settings.PTSColorBG)
settingsChanged = true;
settings.PTSColorBG = colorBG;
};
uint8_t GetPTSColorBG() const {
return settings.PTSColorBG;
};

void SetAppMenu(uint8_t menu) {
appMenu = menu;
};
Expand Down Expand Up @@ -127,7 +154,7 @@ namespace Pinetime {
private:
Pinetime::Controllers::FS& fs;

static constexpr uint32_t settingsVersion = 0x0001;
static constexpr uint32_t settingsVersion = 0x0002;
struct SettingsData {

uint32_t version = settingsVersion;
Expand All @@ -139,6 +166,10 @@ namespace Pinetime {

uint8_t clockFace = 0;

uint8_t PTSColorTime = 11;
uint8_t PTSColorBar = 11;
uint8_t PTSColorBG = 3;

std::bitset<3> wakeUpMode {0};

Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium;
Expand Down
3 changes: 2 additions & 1 deletion src/displayapp/Apps.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ namespace Pinetime {
SettingTimeFormat,
SettingDisplay,
SettingWakeUp,
SettingSteps
SettingSteps,
SettingPineTimeStyle
};
}
}
5 changes: 5 additions & 0 deletions src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "displayapp/screens/settings/SettingWakeUp.h"
#include "displayapp/screens/settings/SettingDisplay.h"
#include "displayapp/screens/settings/SettingSteps.h"
#include "displayapp/screens/settings/SettingPineTimeStyle.h"

#include "libs/lv_conf.h"

Expand Down Expand Up @@ -378,6 +379,10 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction)
currentScreen = std::make_unique<Screens::SettingSteps>(this, settingsController);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::SettingPineTimeStyle:
currentScreen = std::make_unique<Screens::SettingPineTimeStyle>(this, settingsController);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
break;
case Apps::BatteryInfo:
currentScreen = std::make_unique<Screens::BatteryInfo>(this, batteryController);
ReturnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown);
Expand Down
27 changes: 14 additions & 13 deletions src/displayapp/screens/PineTimeStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
notificatioManager {notificatioManager},
settingsController {settingsController},
motionController {motionController} {
/* This sets the watchface number to return to after leaving the menu */

// This sets the watchface number to return to after leaving the menu
settingsController.SetClockFace(2);

displayedChar[0] = 0;
Expand All @@ -60,40 +61,40 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
displayedChar[3] = 0;
displayedChar[4] = 0;

/* Create a 200px wide background rectangle */
//Create a 200px wide background rectangle
timebar = lv_obj_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorBG()]);
lv_obj_set_style_local_radius(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
lv_obj_set_size(timebar, 200, 240);
lv_obj_align(timebar, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 0);

/* Display the time */
// Display the time
timeDD1 = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light);
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080));
lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]);
lv_label_set_text(timeDD1, "12");
lv_obj_align(timeDD1, timebar, LV_ALIGN_IN_TOP_MID, 5, 5);

timeDD2 = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light);
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080));
lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]);
lv_label_set_text(timeDD2, "34");
lv_obj_align(timeDD2, timebar, LV_ALIGN_IN_BOTTOM_MID, 5, -5);

timeAMPM = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080));
lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]);
lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3);
lv_label_set_text(timeAMPM, "");
lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20);

/* Create a 40px wide bar down the right side of the screen */
// Create a 40px wide bar down the right side of the screen
sidebar = lv_obj_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x008080));
lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorBar()]);
lv_obj_set_style_local_radius(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
lv_obj_set_size(sidebar, 40, 240);
lv_obj_align(sidebar, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0);

/* Display icons */
// Display icons
batteryIcon = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(batteryIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
lv_label_set_text(batteryIcon, Symbols::batteryFull);
Expand All @@ -111,7 +112,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 40);

/* Calendar icon */
// Calendar icon
calendarOuter = lv_obj_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_bg_color(calendarOuter, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
lv_obj_set_style_local_radius(calendarOuter, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
Expand Down Expand Up @@ -148,7 +149,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
lv_obj_set_size(calendarCrossBar2, 8, 3);
lv_obj_align(calendarCrossBar2, calendarBar2, LV_ALIGN_IN_BOTTOM_MID, 0, 0);

/* Display date */
// Display date
dateDayOfWeek = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(dateDayOfWeek, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000));
lv_label_set_text(dateDayOfWeek, "THU");
Expand Down Expand Up @@ -184,7 +185,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, 4);
lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
lv_obj_set_style_local_line_opa(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4);
lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 3);
lv_obj_set_style_local_pad_inner(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4);

backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
Expand Down
5 changes: 5 additions & 0 deletions src/displayapp/screens/PineTimeStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ namespace Pinetime {
lv_obj_t* notificationIcon;
lv_obj_t* stepGauge;
lv_color_t needle_colors[1];
lv_color_t pts_colors[17] = {LV_COLOR_WHITE, LV_COLOR_SILVER, LV_COLOR_GRAY, LV_COLOR_BLACK,
LV_COLOR_RED, LV_COLOR_MAROON, LV_COLOR_YELLOW, LV_COLOR_OLIVE,
LV_COLOR_LIME, LV_COLOR_GREEN, LV_COLOR_CYAN, LV_COLOR_TEAL,
LV_COLOR_BLUE, LV_COLOR_NAVY, LV_COLOR_MAGENTA, LV_COLOR_PURPLE,
LV_COLOR_ORANGE};

Controllers::DateTime& dateTimeController;
Controllers::Battery& batteryController;
Expand Down
Loading