Skip to content

Commit

Permalink
Add fonts, remove Digital
Browse files Browse the repository at this point in the history
  • Loading branch information
zyphlar committed Jan 17, 2024
1 parent cf4f54d commit 5510bfe
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 401 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ jobs:
- name: Remove Terminal from InfiniSim
run: patch -i docker/infinisim-terminal.patch InfiniSim/littlefs-do-main.cpp

- name: Remove Digital from InfiniSim
run: patch -i docker/infinisim-main.patch InfiniSim/main.cpp

- name: CMake
# disable BUILD_RESOURCES as this is already done when building the firmware
run: |
Expand Down
20 changes: 20 additions & 0 deletions docker/infinisim-main.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/main.cpp b/main.cpp
index 8070db7..530ff4b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -823,14 +823,10 @@ public:
void switch_to_screen(uint8_t screen_idx)
{
if (screen_idx == 1) {
- settingsController.SetWatchFace(Pinetime::Applications::WatchFace::Digital);
- displayApp.StartApp(Pinetime::Applications::Apps::Clock, Pinetime::Applications::DisplayApp::FullRefreshDirections::None);
- }
- else if (screen_idx == 2) {
settingsController.SetWatchFace(Pinetime::Applications::WatchFace::Analog);
displayApp.StartApp(Pinetime::Applications::Apps::Clock, Pinetime::Applications::DisplayApp::FullRefreshDirections::None);
}
- else if (screen_idx == 3) {
+ else if (screen_idx == 2) {
settingsController.SetWatchFace(Pinetime::Applications::WatchFace::PineTimeStyle);
displayApp.StartApp(Pinetime::Applications::Apps::Clock, Pinetime::Applications::DisplayApp::FullRefreshDirections::None);
}
10 changes: 7 additions & 3 deletions docker/infinisim-terminal.patch
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
diff --git a/littlefs-do-main.cpp b/littlefs-do-main.cpp
index 0a5dfbd..5d902f8 100644
index 0a5dfbd..3e818af 100644
--- a/littlefs-do-main.cpp
+++ b/littlefs-do-main.cpp
@@ -540,7 +540,7 @@ int command_settings(const std::string &program_name, const std::vector<std::str
if (val == Pinetime::Applications::WatchFace::Digital) return "Digital";
@@ -537,10 +537,10 @@ int command_settings(const std::string &program_name, const std::vector<std::str
{
auto clockface = settingsController.GetWatchFace();
auto clockface_str = [](auto val) {
- if (val == Pinetime::Applications::WatchFace::Digital) return "Digital";
+ //if (val == Pinetime::Applications::WatchFace::Digital) return "Digital";
if (val == Pinetime::Applications::WatchFace::Analog) return "Analog";
if (val == Pinetime::Applications::WatchFace::PineTimeStyle) return "PineTimeStyle";
- if (val == Pinetime::Applications::WatchFace::Terminal) return "Terminal";
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ list(APPEND SOURCE_FILES

## Watch faces
displayapp/screens/WatchFaceAnalog.cpp
displayapp/screens/WatchFaceDigital.cpp
#displayapp/screens/WatchFaceDigital.cpp
#displayapp/screens/WatchFaceInfineat.cpp
#displayapp/screens/WatchFaceTerminal.cpp
displayapp/screens/WatchFacePineTimeStyle.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/components/settings/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ namespace Pinetime {
WeatherFormat weatherFormat = WeatherFormat::Metric;
Notification notificationStatus = Notification::On;

Pinetime::Applications::WatchFace watchFace = Pinetime::Applications::WatchFace::Digital;
Pinetime::Applications::WatchFace watchFace = Pinetime::Applications::WatchFace::Analog; //Digital
ChimesOption chimesOption = ChimesOption::None;

PineTimeStyle PTS;
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/UserApps.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "displayapp/screens/Twos.h"
#include "displayapp/screens/Tile.h"
#include "displayapp/screens/ApplicationList.h"
#include "displayapp/screens/WatchFaceDigital.h"
//#include "displayapp/screens/WatchFaceDigital.h"
#include "displayapp/screens/WatchFaceAnalog.h"
// #include "displayapp/screens/WatchFaceCasioStyleG7710.h"
// #include "displayapp/screens/WatchFaceInfineat.h"
Expand Down
4 changes: 1 addition & 3 deletions src/displayapp/apps/Apps.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ namespace Pinetime {
};

enum class WatchFace : uint8_t {
Digital,
Analog,
PineTimeStyle,
};
Expand All @@ -69,8 +68,7 @@ namespace Pinetime {
static constexpr size_t Count = sizeof...(Ws);
};

using UserWatchFaceTypes = WatchFaceTypeList<WatchFace::Digital,
WatchFace::Analog,
using UserWatchFaceTypes = WatchFaceTypeList<WatchFace::Analog,
WatchFace::PineTimeStyle>;

static_assert(UserWatchFaceTypes::Count >= 1);
Expand Down
11 changes: 6 additions & 5 deletions src/displayapp/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
if(DEFINED ENABLE_USERAPPS)
set(USERAPP_TYPES ${ENABLE_USERAPPS} CACHE STRING "List of user apps to build into the firmware")
else ()
set(USERAPP_TYPES "Apps::Navigation, Apps::Alarm, Apps::Steps, Apps::HeartRate, Apps::Music, Apps::Twos" CACHE STRING "List of user apps to build into the firmware")
#if(DEFINED ENABLE_USERAPPS)
# set(USERAPP_TYPES ${ENABLE_USERAPPS} CACHE STRING "List of user apps to build into the firmware")
#else ()
set(USERAPP_TYPES "Apps::Timer" CACHE STRING "List of user apps to build into the firmware")
#Apps::Paint, Apps::Metronome, Apps::Paddle, Apps::StopWatch, Apps::Timer,
endif ()
#Apps::Navigation, Apps::Alarm, Apps::Steps, Apps::HeartRate, Apps::Music, Apps::Twos
#endif ()

add_library(infinitime_apps INTERFACE)
target_sources(infinitime_apps INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/Apps.h")
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/fonts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(FONTS jetbrains_mono_42 jetbrains_mono_76 jetbrains_mono_bold_20
set(FONTS jetbrains_mono_42 noto_serif_cjk_20 noto_serif_cjk_15 jetbrains_mono_76 jetbrains_mono_bold_20
jetbrains_mono_extrabold_compressed lv_font_sys_48
open_sans_light fontawesome_weathericons)
find_program(LV_FONT_CONV "lv_font_conv" NO_CACHE REQUIRED
Expand Down
Binary file added src/displayapp/fonts/NotoSerifCJKjp-VF.ttf
Binary file not shown.
20 changes: 20 additions & 0 deletions src/displayapp/fonts/fonts.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@
"size": 20,
"patches": ["jetbrains_mono_bold_20.c_zero.patch", "jetbrains_mono_bold_20.c_M.patch"]
},
"noto_serif_cjk_20": {
"sources": [
{
"file": "NotoSerifCJKjp-VF.ttf",
"symbols": "丑寅卯辰巳午未申酉戌亥子四五六七八九"
}
],
"bpp": 1,
"size": 20
},
"noto_serif_cjk_15": {
"sources": [
{
"file": "NotoSerifCJKjp-VF.ttf",
"symbols": "四五六七八九"
}
],
"bpp": 1,
"size": 15
},
"jetbrains_mono_42": {
"sources": [
{
Expand Down
54 changes: 36 additions & 18 deletions src/displayapp/screens/WatchFaceAnalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ namespace {
.y = CoordinateYRelocate(radius * static_cast<int32_t>(Cosine(angle)) / LV_TRIG_SCALE)};
}

void printKoku(const char* str, uint8_t i, bool big){
lv_obj_t* koku = lv_label_create(lv_scr_act(), NULL);
lv_label_set_align(koku, LV_LABEL_ALIGN_CENTER);
lv_label_set_text(koku, str);
lv_point_t pt;
if (big) {
pt = CoordinateRelocate(LV_HOR_RES/2-20, i*30);
lv_obj_set_style_local_text_font(koku, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &noto_serif_cjk_20);
} else {
pt = CoordinateRelocate(LV_HOR_RES/2-45, i*30);
lv_obj_set_style_local_text_font(koku, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &noto_serif_cjk_15);
}
lv_obj_align(koku, NULL, LV_ALIGN_CENTER, LV_HOR_RES/2-pt.x-10, LV_HOR_RES/2-pt.y);
lv_obj_set_style_local_text_color(koku, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
}

}

WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
Expand Down Expand Up @@ -73,27 +89,24 @@ WatchFaceAnalog::WatchFaceAnalog(Controllers::DateTime& dateTimeController,
lv_obj_set_size(major_scales, 240, 240);
lv_obj_align(major_scales, nullptr, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style_local_bg_opa(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_scale_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 40);
lv_obj_set_style_local_scale_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 60);
lv_obj_set_style_local_scale_end_line_width(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 1);
lv_obj_set_style_local_scale_end_color(major_scales, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);

axis = lv_arc_create(lv_scr_act(), NULL);
lv_obj_set_size(axis, 40, 40);
lv_arc_set_bg_angles(axis, 0, 360);
lv_arc_set_end_angle(axis, 360);
lv_obj_align(axis, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style_local_bg_color(axis, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);

one = lv_label_create(lv_scr_act(), NULL);
lv_label_set_align(one, LV_LABEL_ALIGN_LEFT);
lv_label_set_text(one, "I");
lv_obj_align(one, NULL, LV_ALIGN_IN_TOP_LEFT, 20, 0);
lv_obj_set_style_local_text_color(one, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);

twelve = lv_label_create(lv_scr_act(), NULL);
lv_label_set_align(twelve, LV_LABEL_ALIGN_RIGHT);
lv_label_set_text(twelve, "XII");
lv_obj_align(twelve, NULL, LV_ALIGN_IN_TOP_RIGHT, -20, 0);
lv_obj_set_style_local_text_color(twelve, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_obj_set_style_local_line_color(axis, LV_ARC_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_WHITE);

const char* kokuZodiac[] = {"","","","","","","","","","","",""};
const char* kokuNums[] = {"","","","","",""};

for (int i=0;i<12;i++) {
printKoku(kokuZodiac[i], i, true);
printKoku(kokuNums[i%6], i, false);
}
} else {
minor_scales = lv_linemeter_create(lv_scr_act(), nullptr);
lv_linemeter_set_scale(minor_scales, 300, 51);
Expand Down Expand Up @@ -258,14 +271,19 @@ void WatchFaceAnalog::drawWatchFaceWadokei(){
sHour = hour;
sMinute = minute;

hour_point_trace[0] = CoordinateRelocate(HourLength*.75, angle);
hour_point_trace[1] = CoordinateRelocate(HourLength, angle);
// hour_point_trace[0] = CoordinateRelocate(HourLength*.75, angle);
// hour_point_trace[1] = CoordinateRelocate(HourLength, angle);

hour_point[0] = CoordinateRelocate(0, angle);
hour_point[1] = CoordinateRelocate(HourLength*.75, angle);

lv_line_set_points(hour_body, hour_point, 2);
lv_line_set_points(hour_body_trace, hour_point_trace, 2);
// lv_line_set_points(hour_body_trace, hour_point_trace, 2);

lv_label_set_align(twelve, LV_LABEL_ALIGN_CENTER);
lv_label_set_text_fmt(twelve, "%2d:%02d", hour, minute);
lv_obj_set_pos(twelve, 0, 0);
lv_obj_set_style_local_text_color(twelve, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
}
}

Expand Down Expand Up @@ -370,7 +388,7 @@ void WatchFaceAnalog::Refresh() {
DaysString[static_cast<uint8_t>(dateTimeController.DayOfWeek())],
RomanNumeralsString[static_cast<uint8_t>(dateTimeController.Day())],
MonthsString[static_cast<uint8_t>(dateTimeController.Month())]);
lv_obj_align(label_date_day, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, -20);
lv_obj_align(label_date_day, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, -2000);
} else {
lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day());
}
Expand Down
Loading

0 comments on commit 5510bfe

Please sign in to comment.