WIP Upgrade LVGL Components
This commit is contained in:
parent
6227866e8c
commit
e2f46019bc
23 changed files with 159 additions and 152 deletions
|
@ -28,23 +28,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 32
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -31,23 +31,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 32
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -29,23 +29,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 32
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -21,23 +21,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 32
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -29,23 +29,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 64
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -31,23 +31,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 32
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -29,23 +29,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 32
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -31,23 +31,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 32
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -31,23 +31,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 32
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -21,23 +21,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 32
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -25,23 +25,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 32
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -31,23 +31,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 32
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -22,23 +22,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 32
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -31,23 +31,23 @@ endif # ZMK_DISPLAY
|
|||
|
||||
if LVGL
|
||||
|
||||
config LVGL_HOR_RES_MAX
|
||||
config LV_Z_HOR_RES_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
config LV_Z_VER_RES_MAX
|
||||
default 64
|
||||
|
||||
config LVGL_VDB_SIZE
|
||||
config LV_Z_VDB_SIZE
|
||||
default 64
|
||||
|
||||
config LVGL_DPI
|
||||
config LV_Z_DPI
|
||||
default 148
|
||||
|
||||
config LVGL_BITS_PER_PIXEL
|
||||
config LV_Z_BITS_PER_PIXEL
|
||||
default 1
|
||||
|
||||
choice LVGL_COLOR_DEPTH
|
||||
default LVGL_COLOR_DEPTH_1
|
||||
choice LV_COLOR_DEPTH_BITS
|
||||
default LV_COLOR_DEPTH_1
|
||||
endchoice
|
||||
|
||||
endif # LVGL
|
||||
|
|
|
@ -6,13 +6,13 @@ menuconfig ZMK_DISPLAY
|
|||
default n
|
||||
select DISPLAY
|
||||
select LVGL
|
||||
select LVGL_THEMES
|
||||
select LVGL_THEME_MONO
|
||||
select LV_THEMES
|
||||
select LV_THEME_MONO
|
||||
|
||||
if ZMK_DISPLAY
|
||||
|
||||
choice LVGL_TXT_ENC
|
||||
default LVGL_TXT_ENC_UTF8
|
||||
choice LV_TXT_ENC
|
||||
default LV_TXT_ENC_UTF8
|
||||
|
||||
endchoice
|
||||
|
||||
|
@ -21,7 +21,7 @@ choice ZMK_DISPLAY_STATUS_SCREEN
|
|||
|
||||
config ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN
|
||||
bool "Built in status screen"
|
||||
select LVGL_OBJ_LABEL
|
||||
select LV_OBJ_LABEL
|
||||
|
||||
config ZMK_DISPLAY_STATUS_SCREEN_CUSTOM
|
||||
bool "Custom status screen"
|
||||
|
@ -53,21 +53,21 @@ endif # ZMK_DISPLAY_WORK_QUEUE_DEDICATED
|
|||
|
||||
if ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN
|
||||
|
||||
config LVGL_FONT_MONTSERRAT_16
|
||||
default y
|
||||
# config LV_FONT_MONTSERRAT_16
|
||||
# default y
|
||||
|
||||
choice LVGL_THEME_DEFAULT_FONT_NORMAL
|
||||
default LVGL_THEME_DEFAULT_FONT_NORMAL_MONTSERRAT_16
|
||||
# choice LV_THEME_DEFAULT_FONT_NORMAL
|
||||
# default LV_FONT_MONTSERRAT_16
|
||||
|
||||
endchoice
|
||||
# endchoice
|
||||
|
||||
config LVGL_FONT_MONTSERRAT_12
|
||||
default y
|
||||
# config LV_FONT_MONTSERRAT_12
|
||||
# default y
|
||||
|
||||
choice LVGL_THEME_DEFAULT_FONT_SMALL
|
||||
default LVGL_THEME_DEFAULT_FONT_SMALL_MONTSERRAT_12
|
||||
# choice LV_THEME_DEFAULT_FONT_SMALL
|
||||
# default LV_FONT_MONTSERRAT_12
|
||||
|
||||
endchoice
|
||||
# endchoice
|
||||
|
||||
endif # ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
|||
#include <zmk/events/activity_state_changed.h>
|
||||
#include <zmk/display/status_screen.h>
|
||||
|
||||
#define ZMK_DISPLAY_NAME CONFIG_LVGL_DISPLAY_DEV_NAME
|
||||
#define ZMK_DISPLAY_NAME CONFIG_LV_Z_DISPLAY_DEV_NAME
|
||||
|
||||
static const struct device *display;
|
||||
static bool initialized = false;
|
||||
|
@ -51,7 +51,7 @@ struct k_work_q *zmk_display_work_q() {
|
|||
}
|
||||
|
||||
void display_timer_cb() {
|
||||
lv_tick_inc(TICK_MS);
|
||||
//lv_tick_inc(TICK_MS);
|
||||
k_work_submit_to_queue(zmk_display_work_q(), &display_tick_work);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,35 +29,38 @@ static struct zmk_widget_layer_status layer_status_widget;
|
|||
static struct zmk_widget_wpm_status wpm_status_widget;
|
||||
#endif
|
||||
|
||||
lv_style_t global_style;
|
||||
|
||||
lv_obj_t *zmk_display_status_screen() {
|
||||
lv_obj_t *screen;
|
||||
|
||||
screen = lv_obj_create(NULL, NULL);
|
||||
lv_style_init(&global_style);
|
||||
lv_style_set_text_font(&global_style, &lv_font_montserrat_32);
|
||||
|
||||
screen = lv_obj_create(NULL);
|
||||
lv_obj_add_style(screen, &global_style, LV_PART_MAIN);
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_WIDGET_BATTERY_STATUS)
|
||||
zmk_widget_battery_status_init(&battery_status_widget, screen);
|
||||
lv_obj_align(zmk_widget_battery_status_obj(&battery_status_widget), NULL, LV_ALIGN_IN_TOP_RIGHT,
|
||||
lv_obj_align(zmk_widget_battery_status_obj(&battery_status_widget), LV_ALIGN_TOP_RIGHT,
|
||||
0, 0);
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_WIDGET_OUTPUT_STATUS)
|
||||
zmk_widget_output_status_init(&output_status_widget, screen);
|
||||
lv_obj_align(zmk_widget_output_status_obj(&output_status_widget), NULL, LV_ALIGN_IN_TOP_LEFT, 0,
|
||||
lv_obj_align(zmk_widget_output_status_obj(&output_status_widget), LV_ALIGN_TOP_LEFT, 0,
|
||||
0);
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_WIDGET_LAYER_STATUS)
|
||||
zmk_widget_layer_status_init(&layer_status_widget, screen);
|
||||
lv_obj_set_style_local_text_font(zmk_widget_layer_status_obj(&layer_status_widget),
|
||||
LV_LABEL_PART_MAIN, LV_STATE_DEFAULT,
|
||||
lv_theme_get_font_small());
|
||||
lv_obj_align(zmk_widget_layer_status_obj(&layer_status_widget), NULL, LV_ALIGN_IN_BOTTOM_LEFT,
|
||||
lv_obj_align(zmk_widget_layer_status_obj(&layer_status_widget), LV_ALIGN_BOTTOM_LEFT,
|
||||
0, 0);
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_WIDGET_WPM_STATUS)
|
||||
zmk_widget_wpm_status_init(&wpm_status_widget, screen);
|
||||
lv_obj_align(zmk_widget_wpm_status_obj(&wpm_status_widget), NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -12,
|
||||
lv_obj_align(zmk_widget_wpm_status_obj(&wpm_status_widget), LV_ALIGN_BOTTOM_RIGHT, 0,
|
||||
0);
|
||||
#endif
|
||||
return screen;
|
||||
|
|
|
@ -7,24 +7,24 @@ config ZMK_WIDGET_LAYER_STATUS
|
|||
bool "Widget for highest, active layer using small icons"
|
||||
default y
|
||||
depends on !ZMK_SPLIT || ZMK_SPLIT_BLE_ROLE_CENTRAL
|
||||
select LVGL_USE_LABEL
|
||||
select LV_USE_LABEL
|
||||
|
||||
config ZMK_WIDGET_BATTERY_STATUS
|
||||
bool "Widget for battery charge information, using small icons"
|
||||
depends on BT
|
||||
default y if BT
|
||||
select LVGL_USE_LABEL
|
||||
select LV_USE_LABEL
|
||||
|
||||
config ZMK_WIDGET_OUTPUT_STATUS
|
||||
bool "Widget for keyboard output status icons"
|
||||
depends on BT
|
||||
default y if BT
|
||||
select LVGL_USE_LABEL
|
||||
select LV_USE_LABEL
|
||||
|
||||
config ZMK_WIDGET_WPM_STATUS
|
||||
bool "Widget for displaying typed words per minute"
|
||||
depends on !ZMK_SPLIT || ZMK_SPLIT_BLE_ROLE_CENTRAL
|
||||
select LVGL_USE_LABEL
|
||||
select LV_USE_LABEL
|
||||
select ZMK_WPM
|
||||
|
||||
endmenu
|
||||
|
|
|
@ -27,7 +27,7 @@ struct battery_status_state {
|
|||
};
|
||||
|
||||
static void set_battery_symbol(lv_obj_t *label, struct battery_status_state state) {
|
||||
char text[2] = " ";
|
||||
char text[3] = "";
|
||||
|
||||
uint8_t level = state.level;
|
||||
|
||||
|
@ -38,15 +38,15 @@ static void set_battery_symbol(lv_obj_t *label, struct battery_status_state stat
|
|||
#endif /* IS_ENABLED(CONFIG_USB_DEVICE_STACK) */
|
||||
|
||||
if (level > 95) {
|
||||
strcat(text, LV_SYMBOL_BATTERY_FULL);
|
||||
strcat(text, " " LV_SYMBOL_BATTERY_FULL);
|
||||
} else if (level > 65) {
|
||||
strcat(text, LV_SYMBOL_BATTERY_3);
|
||||
strcat(text, " " LV_SYMBOL_BATTERY_3);
|
||||
} else if (level > 35) {
|
||||
strcat(text, LV_SYMBOL_BATTERY_2);
|
||||
strcat(text, " " LV_SYMBOL_BATTERY_2);
|
||||
} else if (level > 5) {
|
||||
strcat(text, LV_SYMBOL_BATTERY_1);
|
||||
strcat(text, " " LV_SYMBOL_BATTERY_1);
|
||||
} else {
|
||||
strcat(text, LV_SYMBOL_BATTERY_EMPTY);
|
||||
strcat(text, " " LV_SYMBOL_BATTERY_EMPTY);
|
||||
}
|
||||
lv_label_set_text(label, text);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ ZMK_SUBSCRIPTION(widget_battery_status, zmk_usb_conn_state_changed);
|
|||
#endif /* IS_ENABLED(CONFIG_USB_DEVICE_STACK) */
|
||||
|
||||
int zmk_widget_battery_status_init(struct zmk_widget_battery_status *widget, lv_obj_t *parent) {
|
||||
widget->obj = lv_label_create(parent, NULL);
|
||||
widget->obj = lv_label_create(parent);
|
||||
|
||||
lv_obj_set_size(widget->obj, 40, 15);
|
||||
|
||||
|
|
|
@ -26,13 +26,13 @@ static void set_layer_symbol(lv_obj_t *label, struct layer_status_state state) {
|
|||
if (state.label == NULL) {
|
||||
char text[6] = {};
|
||||
|
||||
sprintf(text, LV_SYMBOL_KEYBOARD "%i", state.index);
|
||||
sprintf(text, LV_SYMBOL_KEYBOARD " %i", state.index);
|
||||
|
||||
lv_label_set_text(label, text);
|
||||
} else {
|
||||
char text[12] = {};
|
||||
|
||||
snprintf(text, 12, LV_SYMBOL_KEYBOARD "%s", state.label);
|
||||
snprintf(text, 12, LV_SYMBOL_KEYBOARD " %s", state.label);
|
||||
|
||||
lv_label_set_text(label, text);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ ZMK_DISPLAY_WIDGET_LISTENER(widget_layer_status, struct layer_status_state, laye
|
|||
ZMK_SUBSCRIPTION(widget_layer_status, zmk_layer_state_changed);
|
||||
|
||||
int zmk_widget_layer_status_init(struct zmk_widget_layer_status *widget, lv_obj_t *parent) {
|
||||
widget->obj = lv_label_create(parent, NULL);
|
||||
widget->obj = lv_label_create(parent);
|
||||
|
||||
lv_obj_set_size(widget->obj, 40, 15);
|
||||
|
||||
|
|
|
@ -39,23 +39,23 @@ static struct output_status_state get_state(const zmk_event_t *_eh) {
|
|||
}
|
||||
|
||||
static void set_status_symbol(lv_obj_t *label, struct output_status_state state) {
|
||||
char text[9] = {};
|
||||
char text[10] = {};
|
||||
|
||||
switch (state.selected_endpoint) {
|
||||
case ZMK_ENDPOINT_USB:
|
||||
strcat(text, LV_SYMBOL_USB " ");
|
||||
strcat(text, LV_SYMBOL_USB " ");
|
||||
break;
|
||||
case ZMK_ENDPOINT_BLE:
|
||||
if (state.active_profile_bonded) {
|
||||
if (state.active_profile_connected) {
|
||||
snprintf(text, sizeof(text), LV_SYMBOL_WIFI "%i " LV_SYMBOL_OK,
|
||||
snprintf(text, sizeof(text), LV_SYMBOL_WIFI " %i " LV_SYMBOL_OK,
|
||||
state.active_profile_index);
|
||||
} else {
|
||||
snprintf(text, sizeof(text), LV_SYMBOL_WIFI "%i " LV_SYMBOL_CLOSE,
|
||||
snprintf(text, sizeof(text), LV_SYMBOL_WIFI " %i " LV_SYMBOL_CLOSE,
|
||||
state.active_profile_index);
|
||||
}
|
||||
} else {
|
||||
snprintf(text, sizeof(text), LV_SYMBOL_WIFI "%i " LV_SYMBOL_SETTINGS,
|
||||
snprintf(text, sizeof(text), LV_SYMBOL_WIFI " %i " LV_SYMBOL_SETTINGS,
|
||||
state.active_profile_index);
|
||||
}
|
||||
break;
|
||||
|
@ -81,7 +81,7 @@ ZMK_SUBSCRIPTION(widget_output_status, zmk_ble_active_profile_changed);
|
|||
#endif
|
||||
|
||||
int zmk_widget_output_status_init(struct zmk_widget_output_status *widget, lv_obj_t *parent) {
|
||||
widget->obj = lv_label_create(parent, NULL);
|
||||
widget->obj = lv_label_create(parent);
|
||||
|
||||
lv_obj_set_size(widget->obj, 40, 15);
|
||||
|
||||
|
|
|
@ -24,13 +24,14 @@ struct wpm_status_state wpm_status_get_state(const zmk_event_t *eh) {
|
|||
return (struct wpm_status_state){.wpm = zmk_wpm_get_state()};
|
||||
};
|
||||
|
||||
void set_wpm_symbol(lv_obj_t *label, struct wpm_status_state state) {
|
||||
void set_wpm_symbol(lv_obj_t *obj, struct wpm_status_state state) {
|
||||
char text[4] = {};
|
||||
|
||||
LOG_DBG("WPM changed to %i", state.wpm);
|
||||
snprintf(text, sizeof(text), "%i ", state.wpm);
|
||||
snprintf(text, sizeof(text), "%i", state.wpm);
|
||||
|
||||
lv_label_set_text(label, text);
|
||||
lv_span_t *span = lv_spangroup_get_child(obj, 0);
|
||||
lv_span_set_text(span, text);
|
||||
}
|
||||
|
||||
void wpm_status_update_cb(struct wpm_status_state state) {
|
||||
|
@ -43,10 +44,11 @@ ZMK_DISPLAY_WIDGET_LISTENER(widget_wpm_status, struct wpm_status_state, wpm_stat
|
|||
ZMK_SUBSCRIPTION(widget_wpm_status, zmk_wpm_state_changed);
|
||||
|
||||
int zmk_widget_wpm_status_init(struct zmk_widget_wpm_status *widget, lv_obj_t *parent) {
|
||||
widget->obj = lv_label_create(parent, NULL);
|
||||
lv_label_set_align(widget->obj, LV_LABEL_ALIGN_RIGHT);
|
||||
|
||||
lv_obj_set_size(widget->obj, 40, 15);
|
||||
widget->obj = lv_spangroup_create(parent);
|
||||
lv_spangroup_new_span(widget->obj);
|
||||
lv_spangroup_set_align(widget->obj, LV_TEXT_ALIGN_RIGHT);
|
||||
lv_spangroup_set_mode(widget->obj, LV_SPAN_MODE_EXPAND);
|
||||
lv_obj_set_size(widget->obj, 60, 32);
|
||||
|
||||
sys_slist_append(&widgets, &widget->node);
|
||||
|
||||
|
|
|
@ -4,10 +4,12 @@ manifest:
|
|||
url-base: https://github.com/zephyrproject-rtos
|
||||
- name: zmkfirmware
|
||||
url-base: https://github.com/zmkfirmware
|
||||
- name: nicell
|
||||
url-base: https://github.com/nicell
|
||||
projects:
|
||||
- name: zephyr
|
||||
remote: zmkfirmware
|
||||
revision: v3.0.0+zmk-fixes
|
||||
remote: nicell
|
||||
revision: v3.0.0+zmk-fixes+lvgl
|
||||
clone-depth: 1
|
||||
import:
|
||||
# TODO: Rename once upstream offers option like `exclude` or `denylist`
|
||||
|
|
Loading…
Add table
Reference in a new issue