mirror of https://github.com/jetkvm/kvm.git
Compare commits
2 Commits
0e1c49c2f6
...
51e0c9e421
| Author | SHA1 | Date |
|---|---|---|
|
|
51e0c9e421 | |
|
|
af261bd8f0 |
|
|
@ -42,12 +42,18 @@ func switchToMainScreen() {
|
||||||
func updateDisplay() {
|
func updateDisplay() {
|
||||||
if networkManager != nil {
|
if networkManager != nil {
|
||||||
ipv4 := networkManager.IPv4String()
|
ipv4 := networkManager.IPv4String()
|
||||||
|
if ipv4 == "" {
|
||||||
|
ipv4 = "--"
|
||||||
|
}
|
||||||
nativeInstance.UISetVar("ip_v4_address", ipv4)
|
nativeInstance.UISetVar("ip_v4_address", ipv4)
|
||||||
nativeInstance.ChangeVisibility("home_info_ipv4_addr", ipv4 != "")
|
nativeInstance.ChangeVisibility("home_info_ipv4_addr", ipv4 != "")
|
||||||
|
|
||||||
ipv6 := networkManager.IPv6String()
|
ipv6 := networkManager.IPv6String()
|
||||||
|
if ipv6 == "" {
|
||||||
|
ipv6 = "--"
|
||||||
|
}
|
||||||
nativeInstance.UISetVar("ip_v6_address", ipv6)
|
nativeInstance.UISetVar("ip_v6_address", ipv6)
|
||||||
nativeInstance.ChangeVisibility("home_info_ipv6_addr", ipv6 != "")
|
nativeInstance.ChangeVisibility("home_info_ipv6_addr", ipv6 != "" && ipv6 != "--")
|
||||||
|
|
||||||
nativeInstance.UISetVar("mac_address", networkManager.MACString())
|
nativeInstance.UISetVar("mac_address", networkManager.MACString())
|
||||||
nativeInstance.UISetVar("hostname", networkManager.Hostname())
|
nativeInstance.UISetVar("hostname", networkManager.Hostname())
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
{
|
{
|
||||||
"objID": "316b04e4-a7de-4afc-c413-31f5f36d3843",
|
"objID": "316b04e4-a7de-4afc-c413-31f5f36d3843",
|
||||||
"fileName": "vars.c",
|
"fileName": "vars.c",
|
||||||
"template": "#include <string.h>\n#include <stdio.h>\n//${eez-studio LVGL_INCLUDE}\n#include \"vars.h\"\n\nchar app_version[100] = { 0 };\nchar system_version[100] = { 0 };\nchar lvgl_version[32] = { 0 };\nchar main_screen[32] = \"home_screen\";\nchar mac_address[18] = { 0 };\nchar ip_v4_address[22] = { 0 };\nchar ip_v6_address[46] = { 0 };\nchar hostname[262] = { 0 };\n\nconst char *get_var_ip_v4_address() {\n return ip_v4_address;\n}\n\nvoid set_var_ip_v4_address(const char *value) {\n strncpy(ip_v4_address, value, sizeof(ip_v4_address) / sizeof(char));\n ip_v4_address[sizeof(ip_v4_address) / sizeof(char) - 1] = 0;\n\n tick_screen_home_screen();\n}\n\nconst char *get_var_ip_v6_address() {\n return ip_v6_address;\n}\n\nvoid set_var_ip_v6_address(const char *value) {\n strncpy(ip_v6_address, value, sizeof(ip_v6_address) / sizeof(char));\n ip_v6_address[sizeof(ip_v6_address) / sizeof(char) - 1] = 0;\n\n tick_screen_home_screen();\n}\n\nconst char *get_var_mac_address() {\n return mac_address;\n}\n\nvoid set_var_mac_address(const char *value) {\n strncpy(mac_address, value, sizeof(mac_address) / sizeof(char));\n mac_address[sizeof(mac_address) / sizeof(char) - 1] = 0;\n\n tick_screen_home_screen();\n tick_screen_status_screen();\n}\n\nconst char *get_var_hostname() {\n return hostname;\n}\n\nvoid set_var_hostname(const char *value) {\n strncpy(hostname, value, sizeof(hostname) / sizeof(char));\n hostname[sizeof(hostname) / sizeof(char) - 1] = 0;\n\n tick_screen_home_screen();\n}\n\nconst char *get_var_app_version() {\n return app_version;\n}\n\nvoid set_var_app_version(const char *value) {\n strncpy(app_version, value, sizeof(app_version) / sizeof(char));\n app_version[sizeof(app_version) / sizeof(char) - 1] = 0;\n \n tick_screen_boot_screen();\n tick_screen_about_screen();\n}\n\nconst char *get_var_system_version() {\n return system_version;\n}\n\nvoid set_var_system_version(const char *value) {\n strncpy(system_version, value, sizeof(system_version) / sizeof(char));\n system_version[sizeof(system_version) / sizeof(char) - 1] = 0;\n\n tick_screen_about_screen();\n}\n\nconst char *get_var_lvgl_version() {\n if (lvgl_version[0] == '\\0') {\n char buf[32];\n sprintf(buf, \"%d.%d.%d\", LVGL_VERSION_MAJOR, LVGL_VERSION_MINOR, LVGL_VERSION_PATCH);\n \n \n strncpy(lvgl_version, buf, sizeof(lvgl_version) / sizeof(char));\n app_version[sizeof(lvgl_version) / sizeof(char) - 1] = 0;\n }\n return lvgl_version;\n}\n\nvoid set_var_lvgl_version(const char *value) {\n // intentional NOP since this is actually generated\n \n tick_screen_about_screen();\n}\n\nconst char *get_var_main_screen() {\n return main_screen;\n}\n\nvoid set_var_main_screen(const char *value) {\n strncpy(main_screen, value, sizeof(main_screen) / sizeof(char));\n main_screen[sizeof(main_screen) / sizeof(char) - 1] = 0;\n}\n"
|
"template": "#include <string.h>\n#include <stdio.h>\n//${eez-studio LVGL_INCLUDE}\n#include \"vars.h\"\n\nchar app_version[100] = { 0 };\nchar system_version[100] = { 0 };\nchar lvgl_version[32] = { 0 };\nchar main_screen[32] = \"home_screen\";\nchar mac_address[18] = { 0 };\nchar ip_v4_address[22] = \"--\";\nchar ip_v6_address[46] = \"--\";\nchar hostname[262] = { 0 };\n\nconst char *get_var_ip_v4_address() {\n return ip_v4_address;\n}\n\nvoid set_var_ip_v4_address(const char *value) {\n strncpy(ip_v4_address, value, sizeof(ip_v4_address) / sizeof(char));\n ip_v4_address[sizeof(ip_v4_address) / sizeof(char) - 1] = 0;\n\n tick_screen_home_screen();\n}\n\nconst char *get_var_ip_v6_address() {\n return ip_v6_address;\n}\n\nvoid set_var_ip_v6_address(const char *value) {\n strncpy(ip_v6_address, value, sizeof(ip_v6_address) / sizeof(char));\n ip_v6_address[sizeof(ip_v6_address) / sizeof(char) - 1] = 0;\n\n tick_screen_home_screen();\n}\n\nconst char *get_var_mac_address() {\n return mac_address;\n}\n\nvoid set_var_mac_address(const char *value) {\n strncpy(mac_address, value, sizeof(mac_address) / sizeof(char));\n mac_address[sizeof(mac_address) / sizeof(char) - 1] = 0;\n\n tick_screen_home_screen();\n tick_screen_status_screen();\n}\n\nconst char *get_var_hostname() {\n return hostname;\n}\n\nvoid set_var_hostname(const char *value) {\n strncpy(hostname, value, sizeof(hostname) / sizeof(char));\n hostname[sizeof(hostname) / sizeof(char) - 1] = 0;\n\n tick_screen_home_screen();\n}\n\nconst char *get_var_app_version() {\n return app_version;\n}\n\nvoid set_var_app_version(const char *value) {\n strncpy(app_version, value, sizeof(app_version) / sizeof(char));\n app_version[sizeof(app_version) / sizeof(char) - 1] = 0;\n \n tick_screen_boot_screen();\n tick_screen_about_screen();\n}\n\nconst char *get_var_system_version() {\n return system_version;\n}\n\nvoid set_var_system_version(const char *value) {\n strncpy(system_version, value, sizeof(system_version) / sizeof(char));\n system_version[sizeof(system_version) / sizeof(char) - 1] = 0;\n\n tick_screen_about_screen();\n}\n\nconst char *get_var_lvgl_version() {\n if (lvgl_version[0] == '\\0') {\n char buf[32];\n sprintf(buf, \"%d.%d.%d\", LVGL_VERSION_MAJOR, LVGL_VERSION_MINOR, LVGL_VERSION_PATCH);\n \n \n strncpy(lvgl_version, buf, sizeof(lvgl_version) / sizeof(char));\n app_version[sizeof(lvgl_version) / sizeof(char) - 1] = 0;\n }\n return lvgl_version;\n}\n\nvoid set_var_lvgl_version(const char *value) {\n // intentional NOP since this is actually generated\n \n tick_screen_about_screen();\n}\n\nconst char *get_var_main_screen() {\n return main_screen;\n}\n\nvoid set_var_main_screen(const char *value) {\n strncpy(main_screen, value, sizeof(main_screen) / sizeof(char));\n main_screen[sizeof(main_screen) / sizeof(char) - 1] = 0;\n}\n"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"objID": "cbe7cde1-8920-476a-b2a2-1761ae7451b0",
|
"objID": "cbe7cde1-8920-476a-b2a2-1761ae7451b0",
|
||||||
|
|
@ -1414,8 +1414,8 @@
|
||||||
"type": "LVGLLabelWidget",
|
"type": "LVGLLabelWidget",
|
||||||
"left": 0,
|
"left": 0,
|
||||||
"top": 0,
|
"top": 0,
|
||||||
"width": 74,
|
"width": 60,
|
||||||
"height": 21,
|
"height": 19,
|
||||||
"customInputs": [],
|
"customInputs": [],
|
||||||
"customOutputs": [],
|
"customOutputs": [],
|
||||||
"style": {
|
"style": {
|
||||||
|
|
@ -1446,8 +1446,7 @@
|
||||||
"MAIN": {
|
"MAIN": {
|
||||||
"DEFAULT": {
|
"DEFAULT": {
|
||||||
"pad_bottom": 2,
|
"pad_bottom": 2,
|
||||||
"pad_top": -1,
|
"pad_top": 0
|
||||||
"text_font": "FontBook20"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -370,8 +370,7 @@ void create_screen_home_screen() {
|
||||||
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICK_FOCUSABLE|LV_OBJ_FLAG_PRESS_LOCK|LV_OBJ_FLAG_SCROLLABLE|LV_OBJ_FLAG_SCROLL_CHAIN_HOR|LV_OBJ_FLAG_SCROLL_CHAIN_VER|LV_OBJ_FLAG_SCROLL_ELASTIC|LV_OBJ_FLAG_SCROLL_MOMENTUM|LV_OBJ_FLAG_SCROLL_WITH_ARROW|LV_OBJ_FLAG_SNAPPABLE);
|
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICK_FOCUSABLE|LV_OBJ_FLAG_PRESS_LOCK|LV_OBJ_FLAG_SCROLLABLE|LV_OBJ_FLAG_SCROLL_CHAIN_HOR|LV_OBJ_FLAG_SCROLL_CHAIN_VER|LV_OBJ_FLAG_SCROLL_ELASTIC|LV_OBJ_FLAG_SCROLL_MOMENTUM|LV_OBJ_FLAG_SCROLL_WITH_ARROW|LV_OBJ_FLAG_SNAPPABLE);
|
||||||
add_style_label_font16(obj);
|
add_style_label_font16(obj);
|
||||||
lv_obj_set_style_pad_bottom(obj, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
|
lv_obj_set_style_pad_bottom(obj, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||||
lv_obj_set_style_pad_top(obj, -1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
lv_obj_set_style_pad_top(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||||
lv_obj_set_style_text_font(obj, &ui_font_font_book20, LV_PART_MAIN | LV_STATE_DEFAULT);
|
|
||||||
lv_label_set_text(obj, "");
|
lv_label_set_text(obj, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ char system_version[100] = { 0 };
|
||||||
char lvgl_version[32] = { 0 };
|
char lvgl_version[32] = { 0 };
|
||||||
char main_screen[32] = "home_screen";
|
char main_screen[32] = "home_screen";
|
||||||
char mac_address[18] = { 0 };
|
char mac_address[18] = { 0 };
|
||||||
char ip_v4_address[22] = { 0 };
|
char ip_v4_address[22] = "--";
|
||||||
char ip_v6_address[46] = { 0 };
|
char ip_v6_address[46] = "--";
|
||||||
char hostname[262] = { 0 };
|
char hostname[262] = { 0 };
|
||||||
|
|
||||||
const char *get_var_ip_v4_address() {
|
const char *get_var_ip_v4_address() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue