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

UI size setting #555

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion 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/SettingInterfaceSize.cpp

## Watch faces
displayapp/icons/bg_clock.c
Expand Down Expand Up @@ -482,7 +483,7 @@ list(APPEND SOURCE_FILES
displayapp/fonts/jetbrains_mono_extrabold_compressed.c
displayapp/fonts/jetbrains_mono_bold_20.c
displayapp/fonts/jetbrains_mono_76.c
displayapp/fonts/jetbrains_mono_42.c
displayapp/fonts/jetbrains_mono_40.c
displayapp/fonts/lv_font_sys_48.c
displayapp/fonts/open_sans_light.c
displayapp/lv_pinetime_theme.c
Expand Down
28 changes: 22 additions & 6 deletions src/components/settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace Pinetime {
DoubleTap = 1,
RaiseWrist = 2,
};
enum class InterfaceSize : uint8_t { Normal, Large };

Settings(Pinetime::Controllers::FS& fs);

Expand Down Expand Up @@ -115,19 +116,32 @@ namespace Pinetime {
return settings.brightLevel;
};

void SetStepsGoal( uint32_t goal ) {
if ( goal != settings.stepsGoal ) {
void SetStepsGoal(uint32_t goal) {
if (goal != settings.stepsGoal) {
settingsChanged = true;
}
settings.stepsGoal = goal;
settings.stepsGoal = goal;
};

uint32_t GetStepsGoal() const { return settings.stepsGoal; };

uint32_t GetStepsGoal() const {
return settings.stepsGoal;
};

void SetInterfaceSize(InterfaceSize size) {
if (size != settings.interfaceSize) {
settingsChanged = true;
}
settings.interfaceSize = size;
}

InterfaceSize GetInterfaceSize() const {
return settings.interfaceSize;
}

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 @@ -142,6 +156,8 @@ namespace Pinetime {
std::bitset<3> wakeUpMode {0};

Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium;

InterfaceSize interfaceSize = InterfaceSize::Normal;
};

SettingsData settings;
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,
SettingInterfaceSize,
};
}
}
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/SettingInterfaceSize.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::SettingInterfaceSize:
currentScreen = std::make_unique<Screens::SettingInterfaceSize>(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
Binary file added src/displayapp/fonts/JetBrainsMono-Regular.ttf
Binary file not shown.
12 changes: 10 additions & 2 deletions src/displayapp/fonts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Load the file `JetBrainsMono-Bold.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x20-0x7f, 0x410-0x44f`
* Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following
range : `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024, 0xf252, 0xf569, 0xf201, 0xf06e, 0xf015`
* Click on Convert, and download the file `jetbrains_mono_bold_20.c` and copy it in `src/DisplayApp/Fonts`
* Click on Convert, and download the file `jetbrains_mono_bold_20.c` and copy it in `src/displayapp/fonts`
* Add the font .c file path to src/CMakeLists.txt
* Add an LV_FONT_DECLARE line in src/libs/lv_conf.h

Expand All @@ -31,6 +31,14 @@ Add new symbols:
static constexpr const char* newSymbol = "\xEF\x86\x85";
```

## Settings for the 40px font

* Name : jetbrains_mono_40
* Size : 40
* Bpp : 1 bit-per-pixel
* Do not enable font compression and horizontal subpixel hinting
* Load the file `JetBrainsMono-Regular.tff` (use the file in this repo to ensure the version matches) and specify the following range : `0x20, 0x2D, 0x30-0x39, 0x41-0x5A, 0x61-0x7A`

## Simple method to generate a font

If you want to generate a basic font containing only numbers and letters, you can use the above settings but instead of specifying a range, simply list the characters you need in the Symbols field and leave the range blank. This is the approach used for the PineTimeStyle watchface.
Expand All @@ -42,7 +50,7 @@ This works well for fonts which will only be used to display numbers, but will f
* Bpp : 1 bit-per-pixel
* Do not enable font compression and horizontal subpixel hinting
* Load the file `open_sans_light.tff` (use the file in this repo to ensure the version matches) and specify the following symbols : `0123456789`
* Click on Convert, and download the file `open_sans_light.c` and copy it in `src/DisplayApp/Fonts`
* Click on Convert, and download the file `open_sans_light.c` and copy it in `src/displayapp/fonts`
* Add the font .c file path to src/CMakeLists.txt (search for jetbrains to find the appropriate location/format)
* Add an LV_FONT_DECLARE line in src/libs/lv_conf.h (as above)

Expand Down
Loading