Skip to content

Commit ca63198

Browse files
committed
Add variables and MAC address to device screen
Also cleaned up all the scrolling and click/gesture handling so all the menus work correctly.
1 parent 478a5ef commit ca63198

File tree

16 files changed

+1004
-2880
lines changed

16 files changed

+1004
-2880
lines changed

display.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,16 @@ func switchToMainScreen() {
4141

4242
func updateDisplay() {
4343
if networkManager != nil {
44-
nativeInstance.UpdateLabelAndChangeVisibility("home_info_ipv4_addr", networkManager.IPv4String())
45-
nativeInstance.UpdateLabelAndChangeVisibility("home_info_ipv6_addr", networkManager.IPv6String())
46-
nativeInstance.UpdateLabelIfChanged("home_info_mac_addr", networkManager.MACString())
47-
nativeInstance.UpdateLabelIfChanged("home_info_hostname", networkManager.Hostname())
44+
ipv4 := networkManager.IPv4String()
45+
nativeInstance.UISetVar("ip_v4_address", ipv4)
46+
nativeInstance.ChangeVisibility("home_info_ipv4_addr", ipv4 != "")
47+
48+
ipv6 := networkManager.IPv6String()
49+
nativeInstance.UISetVar("ip_v6_address", ipv6)
50+
nativeInstance.ChangeVisibility("home_info_ipv6_addr", ipv6 != "")
51+
52+
nativeInstance.UISetVar("mac_address", networkManager.MACString())
53+
nativeInstance.UISetVar("hostname", networkManager.Hostname())
4854

4955
// we either show the MAC address (if no IP yet) or the hostname (if either IPv4 or IPv6 are available)
5056
hasIP := networkManager.IPv4Ready() || networkManager.IPv6Ready()
@@ -210,7 +216,8 @@ func waitCtrlAndRequestDisplayUpdate(shouldWakeDisplay bool, reason string) {
210216
func updateStaticContents() {
211217
//contents that never change
212218
if networkManager != nil {
213-
nativeInstance.UpdateLabelIfChanged("home_info_mac_addr", networkManager.MACString())
219+
mac := networkManager.MACString()
220+
nativeInstance.UISetVar("mac_address", mac)
214221
}
215222

216223
// get cpu info
@@ -236,7 +243,7 @@ func updateStaticContents() {
236243
nativeInstance.UpdateLabelAndChangeVisibility("build_date", version.BuildDate)
237244
nativeInstance.UpdateLabelAndChangeVisibility("golang_version", version.GoVersion)
238245

239-
// nativeInstance.UpdateLabelAndChangeVisibility("boot_screen_device_id", GetDeviceID())
246+
nativeInstance.UpdateLabelAndChangeVisibility("device_id", GetDeviceID())
240247
}
241248

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

internal/native/cgo_notlinux.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ func uiGetLVGLVersion() string {
9898
return ""
9999
}
100100

101+
func uiTick() {
102+
panicPlatformNotSupported()
103+
}
104+
101105
func videoGetStreamQualityFactor() (float64, error) {
102106
panicPlatformNotSupported()
103107
return 0, nil

internal/native/display.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ func (n *Native) UpdateLabelIfChanged(objName string, newText string) {
109109

110110
if changed {
111111
l.Msg("label changed")
112+
uiTick()
112113
} else {
113114
l.Msg("label not changed")
114115
}
@@ -130,6 +131,8 @@ func (n *Native) ChangeVisibility(objName string, show bool) {
130131
_, _ = n.UIObjHide(objName)
131132
_, _ = n.UIObjHide(containerName)
132133
}
134+
135+
uiTick()
133136
}
134137

135138
// SwitchToScreenIf switches to the screen if the screen name is different from the current screen and the screen name is in the shouldSwitch list

internal/native/eez/jetkvm.eez-project

Lines changed: 513 additions & 432 deletions
Large diffs are not rendered by default.

internal/native/eez/src/ui/actions.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ void action_switch_to_reboot(lv_event_t *e) {
5656
loadScreen(SCREEN_ID_REBOOT_SCREEN);
5757
}
5858

59+
void action_switch_to_network(lv_event_t *e) {
60+
loadScreen(SCREEN_ID_MENU_NETWORK_SCREEN);
61+
}
62+
5963
void action_menu_screen_gesture(lv_event_t * e) {
6064
handle_gesture_main_screen_switch(e, LV_DIR_RIGHT);
6165
}
@@ -76,6 +80,11 @@ void action_about_screen_gesture(lv_event_t * e) {
7680
handle_gesture_screen_switch(e, LV_DIR_RIGHT, SCREEN_ID_MENU_SCREEN);
7781
}
7882

83+
void action_status_screen_gesture(lv_event_t *e) {
84+
handle_gesture_screen_switch(e, LV_DIR_RIGHT, SCREEN_ID_MENU_SCREEN);
85+
}
86+
87+
7988
// user_data doesn't seem to be working, so we use a global variable here
8089
static uint32_t t_reset_config;
8190
static uint32_t t_reboot;
@@ -168,9 +177,9 @@ void action_dhcpc(lv_event_t * e) {
168177
.lock = &b_dhcpc_lock,
169178
.hold_time_seconds = DHCPC_HOLD_TIME,
170179
.rpc_method = "toggleDHCPClient",
171-
.button_obj = NULL, // No button/spinner for reboot
180+
.button_obj = NULL, // No button/spinner for dhcp client change
172181
.spinner_obj = NULL,
173-
.label_obj = objects.dhcpc_label,
182+
.label_obj = objects.dhcp_client_label,
174183
.default_text = "Press and hold for\n5 seconds"
175184
};
176185

internal/native/eez/src/ui/actions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ extern void action_reboot(lv_event_t * e);
2626
extern void action_switch_to_reboot(lv_event_t * e);
2727
extern void action_dhcpc(lv_event_t * e);
2828
extern void action_switch_to_dhcpc(lv_event_t * e);
29+
extern void action_status_screen_gesture(lv_event_t * e);
30+
extern void action_switch_to_network(lv_event_t * e);
2931

3032

3133
#ifdef __cplusplus

internal/native/eez/src/ui/fonts.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ extern "C" {
88
#endif
99

1010
extern const lv_font_t ui_font_font_bold30;
11-
extern const lv_font_t ui_font_font_bold24;
1211
extern const lv_font_t ui_font_font_book16;
1312
extern const lv_font_t ui_font_font_book18;
1413
extern const lv_font_t ui_font_font_book20;

0 commit comments

Comments
 (0)