refactor(display): Updates for LVGL v8.x changes.

* LV_ prefix from new LVGL official Kconfig now used.
* API changes for themes, container object removal, etc.
* Add our own Kconfig and code for theme default small font.
* Remove some hardcoded sizes.
This commit is contained in:
Peter Johanson 2023-01-17 23:33:42 -05:00 • committed by Pete Johanson
parent 168b32b828
commit 69a4c3200d
44 changed files with 463 additions and 246 deletions

View file

@ -7,13 +7,13 @@ config ZMK_WIDGET_LAYER_STATUS
bool "Widget for highest, active layer using small icons"
default y
depends on !ZMK_SPLIT || ZMK_SPLIT_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
if ZMK_WIDGET_BATTERY_STATUS
@ -26,18 +26,18 @@ config ZMK_WIDGET_OUTPUT_STATUS
bool "Widget for keyboard output status icons"
depends on BT && (!ZMK_SPLIT_BLE || ZMK_SPLIT_ROLE_CENTRAL)
default y if BT && (!ZMK_SPLIT_BLE || ZMK_SPLIT_ROLE_CENTRAL)
select LVGL_USE_LABEL
select LV_USE_LABEL
config ZMK_WIDGET_PERIPHERAL_STATUS
bool "Widget for split peripheral status icons"
depends on BT && ZMK_SPLIT_BLE && !ZMK_SPLIT_ROLE_CENTRAL
default y if BT && ZMK_SPLIT_BLE && !ZMK_SPLIT_ROLE_CENTRAL
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_ROLE_CENTRAL
select LVGL_USE_LABEL
select LV_USE_LABEL
select ZMK_WPM
endmenu

View file

@ -55,7 +55,6 @@ static void set_battery_symbol(lv_obj_t *label, struct battery_status_state stat
}
#endif
lv_label_set_text(label, text);
lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
}
void battery_status_update_cb(struct battery_status_state state) {
@ -81,9 +80,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);
lv_obj_set_size(widget->obj, 43, 15);
widget->obj = lv_label_create(parent);
sys_slist_append(&widgets, &widget->node);

View file

@ -54,9 +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);
lv_obj_set_size(widget->obj, 40, 15);
widget->obj = lv_label_create(parent);
sys_slist_append(&widgets, &widget->node);

View file

@ -81,9 +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);
lv_obj_set_size(widget->obj, 40, 15);
widget->obj = lv_label_create(parent);
sys_slist_append(&widgets, &widget->node);

View file

@ -45,9 +45,7 @@ ZMK_SUBSCRIPTION(widget_peripheral_status, zmk_split_peripheral_status_changed);
int zmk_widget_peripheral_status_init(struct zmk_widget_peripheral_status *widget,
lv_obj_t *parent) {
widget->obj = lv_label_create(parent, NULL);
lv_obj_set_size(widget->obj, 40, 15);
widget->obj = lv_label_create(parent);
sys_slist_append(&widgets, &widget->node);

View file

@ -31,7 +31,7 @@ void set_wpm_symbol(lv_obj_t *label, struct wpm_status_state state) {
snprintf(text, sizeof(text), "%i", state.wpm);
lv_label_set_text(label, text);
lv_obj_align(label, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0);
lv_obj_align(label, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
}
void wpm_status_update_cb(struct wpm_status_state state) {
@ -44,10 +44,8 @@ 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_label_create(parent);
lv_obj_align(widget->obj, LV_ALIGN_RIGHT_MID, 0, 0);
sys_slist_append(&widgets, &widget->node);