Skip to content
Open
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ node_modules
#internal/native/include
#internal/native/lib

ui/reports
ui/reports
*.eez-project-ui-state
30 changes: 25 additions & 5 deletions display.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,27 @@ func switchToMainScreen() {

func updateDisplay() {
if networkManager != nil {
nativeInstance.UpdateLabelIfChanged("home_info_ipv4_addr", networkManager.IPv4String())
nativeInstance.UpdateLabelAndChangeVisibility("home_info_ipv6_addr", networkManager.IPv6String())
nativeInstance.UpdateLabelIfChanged("home_info_mac_addr", networkManager.MACString())
ipv4 := networkManager.IPv4String()
if ipv4 == "" {
ipv4 = "--"
}
nativeInstance.UISetVar("ip_v4_address", ipv4)
nativeInstance.ChangeVisibility("home_info_ipv4_addr", ipv4 != "")

ipv6 := networkManager.IPv6String()
if ipv6 == "" {
ipv6 = "--"
}
nativeInstance.UISetVar("ip_v6_address", ipv6)
nativeInstance.ChangeVisibility("home_info_ipv6_addr", ipv6 != "" && ipv6 != "--")

nativeInstance.UISetVar("mac_address", networkManager.MACString())
nativeInstance.UISetVar("hostname", networkManager.Hostname())

// we either show the MAC address (if no IP yet) or the hostname (if either IPv4 or IPv6 are available)
hasIP := networkManager.IPv4Ready() || networkManager.IPv6Ready()
nativeInstance.ChangeVisibility("home_info_mac_addr", !hasIP)
nativeInstance.ChangeVisibility("home_info_hostname", hasIP)
}

_, _ = nativeInstance.UIObjHide("menu_btn_network")
Expand All @@ -70,6 +88,7 @@ func updateDisplay() {
nativeInstance.UpdateLabelIfChanged("hdmi_status_label", "Disconnected")
_, _ = nativeInstance.UIObjClearState("hdmi_status_label", "LV_STATE_CHECKED")
}

nativeInstance.UpdateLabelIfChanged("cloud_status_label", fmt.Sprintf("%d active", actionSessions))

if networkManager != nil && networkManager.IsUp() {
Expand Down Expand Up @@ -203,7 +222,8 @@ func waitCtrlAndRequestDisplayUpdate(shouldWakeDisplay bool, reason string) {
func updateStaticContents() {
//contents that never change
if networkManager != nil {
nativeInstance.UpdateLabelIfChanged("home_info_mac_addr", networkManager.MACString())
mac := networkManager.MACString()
nativeInstance.UISetVar("mac_address", mac)
}

// get cpu info
Expand All @@ -229,7 +249,7 @@ func updateStaticContents() {
nativeInstance.UpdateLabelAndChangeVisibility("build_date", version.BuildDate)
nativeInstance.UpdateLabelAndChangeVisibility("golang_version", version.GoVersion)

// nativeInstance.UpdateLabelAndChangeVisibility("boot_screen_device_id", GetDeviceID())
nativeInstance.UpdateLabelAndChangeVisibility("device_id", GetDeviceID())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use UISetVar here too and remove UpdateLabelAndChangeVisibility completely?
EEZ has the ability to change visibility based on a variable, but I'm not sure whether we want to complicate the EEZ code or the Golang code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think absolutely that would be much simpler! I just didn't know if you folks would mind that big a change. I'll do it (my) Friday night.

Copy link
Contributor

@ym ym Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do it in a separate PR instead. Let's keep this one PR from getting too big :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing.

Any thoughts about Adam's comments? Do we need to reenable and of those other screens?

}

// setDisplayBrightness sets /sys/class/backlight/backlight/brightness to alter
Expand Down
4 changes: 4 additions & 0 deletions internal/native/cgo_notlinux.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ func uiGetLVGLVersion() string {
return ""
}

func uiTick() {
panicPlatformNotSupported()
}

func videoGetStreamQualityFactor() (float64, error) {
panicPlatformNotSupported()
return 0, nil
Expand Down
15 changes: 11 additions & 4 deletions internal/native/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func (n *Native) UpdateLabelIfChanged(objName string, newText string) {

if changed {
l.Msg("label changed")
uiTick()
} else {
l.Msg("label not changed")
}
Expand All @@ -117,15 +118,21 @@ func (n *Native) UpdateLabelIfChanged(objName string, newText string) {
// UpdateLabelAndChangeVisibility updates the label and changes the visibility of the object
func (n *Native) UpdateLabelAndChangeVisibility(objName string, newText string) {
n.UpdateLabelIfChanged(objName, newText)
n.ChangeVisibility(objName, newText != "")
}

// ChangeVisibility shows or hides an object AND the container it is in
func (n *Native) ChangeVisibility(objName string, show bool) {
containerName := objName + "_container"
if newText == "" {
_, _ = n.UIObjHide(objName)
_, _ = n.UIObjHide(containerName)
} else {
if show {
_, _ = n.UIObjShow(objName)
_, _ = n.UIObjShow(containerName)
} else {
_, _ = n.UIObjHide(objName)
_, _ = n.UIObjHide(containerName)
}

uiTick()
}

// SwitchToScreenIf switches to the screen if the screen name is different from the current screen and the screen name is in the shouldSwitch list
Expand Down
1,130 changes: 643 additions & 487 deletions internal/native/eez/jetkvm.eez-project

Large diffs are not rendered by default.

Loading
Loading