Skip to content

Commit 8c225ce

Browse files
committed
feat: remove lvgl examples and demos
1 parent 365a419 commit 8c225ce

File tree

8 files changed

+1994
-325
lines changed

8 files changed

+1994
-325
lines changed

display.go

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,7 @@ var (
3333

3434
func updateDisplay() {
3535
nativeInstance.UpdateLabelIfChanged("home_info_ipv4_addr", networkState.IPv4String())
36-
ipv6 := networkState.IPv6String()
37-
if ipv6 != "" {
38-
nativeInstance.UpdateLabelIfChanged("home_info_ipv6_addr", ipv6)
39-
nativeInstance.ObjShow("home_info_ipv6_addr")
40-
} else {
41-
nativeInstance.UpdateLabelIfChanged("home_info_ipv6_addr", "")
42-
nativeInstance.ObjHide("home_info_ipv6_addr")
43-
}
36+
nativeInstance.UpdateLabelAndChangeVisibility("home_info_ipv6_addr", networkState.IPv6String())
4437

4538
nativeInstance.ObjHide("menu_btn_network")
4639
nativeInstance.ObjHide("menu_btn_access")
@@ -52,14 +45,14 @@ func updateDisplay() {
5245
_, _ = nativeInstance.ObjSetState("usb_status", "LV_STATE_DEFAULT")
5346
} else {
5447
nativeInstance.UpdateLabelIfChanged("usb_status_label", "Disconnected")
55-
_, _ = nativeInstance.ObjSetState("usb_status", "LV_STATE_USER_2")
48+
_, _ = nativeInstance.ObjSetState("usb_status", "LV_STATE_DISABLED")
5649
}
5750
if lastVideoState.Ready {
5851
nativeInstance.UpdateLabelIfChanged("hdmi_status_label", "Connected")
5952
_, _ = nativeInstance.ObjSetState("hdmi_status", "LV_STATE_DEFAULT")
6053
} else {
6154
nativeInstance.UpdateLabelIfChanged("hdmi_status_label", "Disconnected")
62-
_, _ = nativeInstance.ObjSetState("hdmi_status", "LV_STATE_USER_2")
55+
_, _ = nativeInstance.ObjSetState("hdmi_status", "LV_STATE_DISABLED")
6356
}
6457
nativeInstance.UpdateLabelIfChanged("cloud_status_label", fmt.Sprintf("%d active", actionSessions))
6558

@@ -164,8 +157,8 @@ func updateStaticContents() {
164157
if err == nil {
165158
nativeInstance.UpdateLabelIfChanged("boot_screen_version", systemVersion.String())
166159
nativeInstance.UpdateLabelIfChanged("boot_screen_app_version", appVersion.String())
167-
nativeInstance.UpdateLabelIfChanged("system_version_label", systemVersion.String())
168-
nativeInstance.UpdateLabelIfChanged("app_version_label", appVersion.String())
160+
nativeInstance.UpdateLabelAndChangeVisibility("system_version", systemVersion.String())
161+
nativeInstance.UpdateLabelAndChangeVisibility("app_version", appVersion.String())
169162
}
170163

171164
// get cpu info
@@ -174,7 +167,7 @@ func updateStaticContents() {
174167
for _, line := range strings.Split(string(cpuInfo), "\n") {
175168
if strings.HasPrefix(line, "Serial") {
176169
serial := strings.SplitN(line, ":", 2)[1]
177-
nativeInstance.UpdateLabelIfChanged("cpu_serial_label", strings.TrimSpace(serial))
170+
nativeInstance.UpdateLabelAndChangeVisibility("cpu_serial", strings.TrimSpace(serial))
178171
break
179172
}
180173
}
@@ -184,14 +177,14 @@ func updateStaticContents() {
184177
if err == nil {
185178
kernelVersion := strings.TrimPrefix(string(kernelVersion), "Linux version ")
186179
kernelVersion = strings.SplitN(kernelVersion, " ", 2)[0]
187-
nativeInstance.UpdateLabelIfChanged("kernel_version_label", kernelVersion)
180+
nativeInstance.UpdateLabelAndChangeVisibility("kernel_version", kernelVersion)
188181
}
189182

190-
nativeInstance.UpdateLabelIfChanged("build_branch_label", version.Branch)
191-
nativeInstance.UpdateLabelIfChanged("build_date_label", version.BuildDate)
192-
nativeInstance.UpdateLabelIfChanged("golang_version_label", version.GoVersion)
183+
nativeInstance.UpdateLabelAndChangeVisibility("build_branch", version.Branch)
184+
nativeInstance.UpdateLabelAndChangeVisibility("build_date", version.BuildDate)
185+
nativeInstance.UpdateLabelAndChangeVisibility("golang_version", version.GoVersion)
193186

194-
nativeInstance.UpdateLabelIfChanged("boot_screen_device_id", GetDeviceID())
187+
// nativeInstance.UpdateLabelAndChangeVisibility("boot_screen_device_id", GetDeviceID())
195188
}
196189

197190
// setDisplayBrightness sets /sys/class/backlight/backlight/brightness to alter

internal/native/cgo/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ set(RK_MEDIA_OUTPUT "${RK_SDK_BASE}/media/out")
2424
set(RK_MEDIA_INCLUDE_PATH "${RK_MEDIA_OUTPUT}/include")
2525
set(RK_APP_MEDIA_LIBS_PATH "${RK_MEDIA_OUTPUT}/lib")
2626

27+
set(LV_BUILD_EXAMPLES 0 CACHE BOOL "" FORCE)
28+
2729
# Fetch LVGL from GitHub
2830
FetchContent_Declare(
2931
lvgl
3032
GIT_REPOSITORY https://github.com/lvgl/lvgl.git
3133
GIT_TAG v8.3.11
34+
GIT_SHALLOW 1
35+
PATCH_COMMAND git apply ${CMAKE_CURRENT_SOURCE_DIR}/lvgl-no-examples.patch
3236
)
3337
FetchContent_MakeAvailable(lvgl)
3438

internal/native/cgo/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ VERBOSE=1 cmake -B build \
1414
-DCMAKE_CROSSCOMPILING=1 \
1515
-DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE \
1616
-DSKIP_GLIBC_NAMES=ON \
17+
-DMAKE_BUILD_TYPE=Release
1718

1819
cmake --build build

internal/native/cgo/lv_conf.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
428428

429429
#define LV_USE_CHECKBOX 1
430430

431-
#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/
431+
#define LV_USE_DROPDOWN 0 /*Requires: lv_label*/
432432

433433
#define LV_USE_IMG 1 /*Requires: lv_label*/
434434

@@ -440,7 +440,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
440440

441441
#define LV_USE_LINE 1
442442

443-
#define LV_USE_ROLLER 1 /*Requires: lv_label*/
443+
#define LV_USE_ROLLER 0 /*Requires: lv_label*/
444444
#if LV_USE_ROLLER
445445
# define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/
446446
#endif
@@ -454,7 +454,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
454454
# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
455455
#endif
456456

457-
#define LV_USE_TABLE 1
457+
#define LV_USE_TABLE 0
458458

459459
/*==================
460460
* EXTRA COMPONENTS
@@ -463,7 +463,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
463463
/*-----------
464464
* Widgets
465465
*----------*/
466-
#define LV_USE_CALENDAR 1
466+
#define LV_USE_CALENDAR 0
467467
#if LV_USE_CALENDAR
468468
# define LV_CALENDAR_WEEK_STARTS_MONDAY 0
469469
# if LV_CALENDAR_WEEK_STARTS_MONDAY
@@ -531,7 +531,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
531531
#define LV_USE_THEME_BASIC 1
532532

533533
/*A theme designed for monochrome displays*/
534-
#define LV_USE_THEME_MONO 1
534+
#define LV_USE_THEME_MONO 0
535535

536536
/*-----------
537537
* Layouts
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
diff --git a/env_support/cmake/custom.cmake b/env_support/cmake/custom.cmake
2+
index 7da68124b..1fbe2d3de 100644
3+
--- a/env_support/cmake/custom.cmake
4+
+++ b/env_support/cmake/custom.cmake
5+
@@ -15,8 +15,6 @@ get_filename_component(LV_CONF_DIR ${LV_CONF_PATH} DIRECTORY)
6+
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
7+
8+
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c)
9+
-file(GLOB_RECURSE EXAMPLE_SOURCES ${LVGL_ROOT_DIR}/examples/*.c)
10+
-file(GLOB_RECURSE DEMO_SOURCES ${LVGL_ROOT_DIR}/demos/*.c)
11+
12+
if (BUILD_SHARED_LIBS)
13+
add_library(lvgl SHARED ${SOURCES})
14+
@@ -25,10 +23,6 @@ else()
15+
endif()
16+
17+
add_library(lvgl::lvgl ALIAS lvgl)
18+
-add_library(lvgl_examples STATIC ${EXAMPLE_SOURCES})
19+
-add_library(lvgl::examples ALIAS lvgl_examples)
20+
-add_library(lvgl_demos STATIC ${DEMO_SOURCES})
21+
-add_library(lvgl::demos ALIAS lvgl_demos)
22+
23+
target_compile_definitions(
24+
lvgl PUBLIC $<$<BOOL:${LV_LVGL_H_INCLUDE_SIMPLE}>:LV_LVGL_H_INCLUDE_SIMPLE>
25+
@@ -37,15 +31,6 @@ target_compile_definitions(
26+
# Include root and optional parent path of LV_CONF_PATH
27+
target_include_directories(lvgl SYSTEM PUBLIC ${LVGL_ROOT_DIR} ${LV_CONF_DIR})
28+
29+
-# Include /examples folder
30+
-target_include_directories(lvgl_examples SYSTEM
31+
- PUBLIC ${LVGL_ROOT_DIR}/examples)
32+
-target_include_directories(lvgl_demos SYSTEM
33+
- PUBLIC ${LVGL_ROOT_DIR}/demos)
34+
-
35+
-target_link_libraries(lvgl_examples PUBLIC lvgl)
36+
-target_link_libraries(lvgl_demos PUBLIC lvgl)
37+
-
38+
# Lbrary and headers can be installed to system using make install
39+
file(GLOB LVGL_PUBLIC_HEADERS "${CMAKE_SOURCE_DIR}/lv_conf.h"
40+
"${CMAKE_SOURCE_DIR}/lvgl.h")
41+
diff --git a/lvgl.mk b/lvgl.mk
42+
index 0ea126daa..300fb6cbe 100644
43+
--- a/lvgl.mk
44+
+++ b/lvgl.mk
45+
@@ -1,5 +1,3 @@
46+
-include $(LVGL_DIR)/$(LVGL_DIR_NAME)/demos/lv_demos.mk
47+
-include $(LVGL_DIR)/$(LVGL_DIR_NAME)/examples/lv_examples.mk
48+
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/core/lv_core.mk
49+
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/lv_draw.mk
50+
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/extra/lv_extra.mk
51+
diff --git a/src/font/lv_font.h b/src/font/lv_font.h
52+
index e3b670c87..4cceffc45 100644
53+
--- a/src/font/lv_font.h
54+
+++ b/src/font/lv_font.h
55+
@@ -132,114 +132,10 @@ static inline lv_coord_t lv_font_get_line_height(const lv_font_t * font_p)
56+
57+
#define LV_FONT_DECLARE(font_name) extern const lv_font_t font_name;
58+
59+
-#if LV_FONT_MONTSERRAT_8
60+
-LV_FONT_DECLARE(lv_font_montserrat_8)
61+
-#endif
62+
-
63+
-#if LV_FONT_MONTSERRAT_10
64+
-LV_FONT_DECLARE(lv_font_montserrat_10)
65+
-#endif
66+
-
67+
-#if LV_FONT_MONTSERRAT_12
68+
-LV_FONT_DECLARE(lv_font_montserrat_12)
69+
-#endif
70+
-
71+
#if LV_FONT_MONTSERRAT_14
72+
LV_FONT_DECLARE(lv_font_montserrat_14)
73+
#endif
74+
75+
-#if LV_FONT_MONTSERRAT_16
76+
-LV_FONT_DECLARE(lv_font_montserrat_16)
77+
-#endif
78+
-
79+
-#if LV_FONT_MONTSERRAT_18
80+
-LV_FONT_DECLARE(lv_font_montserrat_18)
81+
-#endif
82+
-
83+
-#if LV_FONT_MONTSERRAT_20
84+
-LV_FONT_DECLARE(lv_font_montserrat_20)
85+
-#endif
86+
-
87+
-#if LV_FONT_MONTSERRAT_22
88+
-LV_FONT_DECLARE(lv_font_montserrat_22)
89+
-#endif
90+
-
91+
-#if LV_FONT_MONTSERRAT_24
92+
-LV_FONT_DECLARE(lv_font_montserrat_24)
93+
-#endif
94+
-
95+
-#if LV_FONT_MONTSERRAT_26
96+
-LV_FONT_DECLARE(lv_font_montserrat_26)
97+
-#endif
98+
-
99+
-#if LV_FONT_MONTSERRAT_28
100+
-LV_FONT_DECLARE(lv_font_montserrat_28)
101+
-#endif
102+
-
103+
-#if LV_FONT_MONTSERRAT_30
104+
-LV_FONT_DECLARE(lv_font_montserrat_30)
105+
-#endif
106+
-
107+
-#if LV_FONT_MONTSERRAT_32
108+
-LV_FONT_DECLARE(lv_font_montserrat_32)
109+
-#endif
110+
-
111+
-#if LV_FONT_MONTSERRAT_34
112+
-LV_FONT_DECLARE(lv_font_montserrat_34)
113+
-#endif
114+
-
115+
-#if LV_FONT_MONTSERRAT_36
116+
-LV_FONT_DECLARE(lv_font_montserrat_36)
117+
-#endif
118+
-
119+
-#if LV_FONT_MONTSERRAT_38
120+
-LV_FONT_DECLARE(lv_font_montserrat_38)
121+
-#endif
122+
-
123+
-#if LV_FONT_MONTSERRAT_40
124+
-LV_FONT_DECLARE(lv_font_montserrat_40)
125+
-#endif
126+
-
127+
-#if LV_FONT_MONTSERRAT_42
128+
-LV_FONT_DECLARE(lv_font_montserrat_42)
129+
-#endif
130+
-
131+
-#if LV_FONT_MONTSERRAT_44
132+
-LV_FONT_DECLARE(lv_font_montserrat_44)
133+
-#endif
134+
-
135+
-#if LV_FONT_MONTSERRAT_46
136+
-LV_FONT_DECLARE(lv_font_montserrat_46)
137+
-#endif
138+
-
139+
-#if LV_FONT_MONTSERRAT_48
140+
-LV_FONT_DECLARE(lv_font_montserrat_48)
141+
-#endif
142+
-
143+
-#if LV_FONT_MONTSERRAT_12_SUBPX
144+
-LV_FONT_DECLARE(lv_font_montserrat_12_subpx)
145+
-#endif
146+
-
147+
-#if LV_FONT_MONTSERRAT_28_COMPRESSED
148+
-LV_FONT_DECLARE(lv_font_montserrat_28_compressed)
149+
-#endif
150+
-
151+
-#if LV_FONT_DEJAVU_16_PERSIAN_HEBREW
152+
-LV_FONT_DECLARE(lv_font_dejavu_16_persian_hebrew)
153+
-#endif
154+
-
155+
-#if LV_FONT_SIMSUN_16_CJK
156+
-LV_FONT_DECLARE(lv_font_simsun_16_cjk)
157+
-#endif
158+
-
159+
-#if LV_FONT_UNSCII_8
160+
-LV_FONT_DECLARE(lv_font_unscii_8)
161+
-#endif
162+
-
163+
-#if LV_FONT_UNSCII_16
164+
-LV_FONT_DECLARE(lv_font_unscii_16)
165+
-#endif
166+
-
167+
/*Declare the custom (user defined) fonts*/
168+
#ifdef LV_FONT_CUSTOM_DECLARE
169+
LV_FONT_CUSTOM_DECLARE
170+
diff --git a/src/font/lv_font.mk b/src/font/lv_font.mk
171+
index 2201b73f2..7b2707da4 100644
172+
--- a/src/font/lv_font.mk
173+
+++ b/src/font/lv_font.mk
174+
@@ -2,33 +2,7 @@ CSRCS += lv_font.c
175+
CSRCS += lv_font_fmt_txt.c
176+
CSRCS += lv_font_loader.c
177+
178+
-CSRCS += lv_font_dejavu_16_persian_hebrew.c
179+
-CSRCS += lv_font_montserrat_8.c
180+
-CSRCS += lv_font_montserrat_10.c
181+
-CSRCS += lv_font_montserrat_12.c
182+
-CSRCS += lv_font_montserrat_12_subpx.c
183+
CSRCS += lv_font_montserrat_14.c
184+
-CSRCS += lv_font_montserrat_16.c
185+
-CSRCS += lv_font_montserrat_18.c
186+
-CSRCS += lv_font_montserrat_20.c
187+
-CSRCS += lv_font_montserrat_22.c
188+
-CSRCS += lv_font_montserrat_24.c
189+
-CSRCS += lv_font_montserrat_26.c
190+
-CSRCS += lv_font_montserrat_28.c
191+
-CSRCS += lv_font_montserrat_28_compressed.c
192+
-CSRCS += lv_font_montserrat_30.c
193+
-CSRCS += lv_font_montserrat_32.c
194+
-CSRCS += lv_font_montserrat_34.c
195+
-CSRCS += lv_font_montserrat_36.c
196+
-CSRCS += lv_font_montserrat_38.c
197+
-CSRCS += lv_font_montserrat_40.c
198+
-CSRCS += lv_font_montserrat_42.c
199+
-CSRCS += lv_font_montserrat_44.c
200+
-CSRCS += lv_font_montserrat_46.c
201+
-CSRCS += lv_font_montserrat_48.c
202+
-CSRCS += lv_font_simsun_16_cjk.c
203+
-CSRCS += lv_font_unscii_8.c
204+
-CSRCS += lv_font_unscii_16.c
205+
206+
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/font
207+
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/font

internal/native/ctrl_linux.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ func (n *Native) StartNativeVideo() {
124124
setLogHandler()
125125
setVideoHandler()
126126

127+
C.jetkvm_set_app_version(C.CString(n.appVersion.String()))
128+
127129
C.jetkvm_ui_init()
128130

129131
n.UpdateLabelIfChanged("boot_screen_version", n.appVersion.String())

internal/native/display.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ func (n *Native) UpdateLabelIfChanged(objName string, newText string) {
1818
}
1919
}
2020

21+
func (n *Native) UpdateLabelAndChangeVisibility(objName string, newText string) {
22+
containerName := objName + "_container"
23+
if newText == "" {
24+
_, _ = n.ObjHide(objName)
25+
_, _ = n.ObjHide(containerName)
26+
} else {
27+
_, _ = n.ObjShow(objName)
28+
_, _ = n.ObjShow(containerName)
29+
}
30+
31+
n.UpdateLabelIfChanged(objName, newText)
32+
}
33+
2134
func (n *Native) SwitchToScreenIf(screenName string, shouldSwitch []string) {
2235
currentScreen := n.GetCurrentScreen()
2336
if currentScreen == screenName {

0 commit comments

Comments
 (0)