Skip to content

Commit

Permalink
Merge pull request #7 from aumuell/display-fixes
Browse files Browse the repository at this point in the history
Display fixes for Zephyr 3.2/LVGL 8
  • Loading branch information
petejohanson authored Sep 22, 2023
2 parents d85612d + b55228e commit 9306b4b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions boards/arm/zaphod/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ if ZMK_DISPLAY
menuconfig ZAPHOD_BONGO_CAT
bool "Show WPM bongo cat"
select ZMK_WPM
select LVGL_USE_IMG
select LVGL_USE_ANIMATION
select LV_USE_IMG
select LV_USE_ANIMATION

if ZAPHOD_BONGO_CAT

Expand Down
8 changes: 4 additions & 4 deletions boards/arm/zaphod/zaphod_bongo_cat_widget.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <zmk/event_manager.h>
#include <zmk/events/wpm_state_changed.h>

#include <logging/log.h>
#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);

#include "zaphod_bongo_cat_widget.h"
Expand Down Expand Up @@ -48,7 +48,7 @@ const void* fast_images[] = {
&fast_img2,
};

void set_img_src(void *var, lv_anim_value_t val) {
void set_img_src(void *var, int32_t val) {
lv_obj_t *img = (lv_obj_t *)var;
lv_img_set_src(img, images[val]);
}
Expand Down Expand Up @@ -95,10 +95,10 @@ void state_widget_wpm(struct zaphod_bongo_cat_widget *widget, int wpm) {
}

int zaphod_bongo_cat_widget_init(struct zaphod_bongo_cat_widget *widget, lv_obj_t *parent) {
widget->obj = lv_img_create(parent, NULL);
widget->obj = lv_img_create(parent);


lv_img_set_auto_size(widget->obj, true);
lv_obj_set_size(widget->obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
state_widget_wpm(widget, 0);

sys_slist_append(&widgets, &widget->node);
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/zaphod/zaphod_bongo_cat_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


#include <lvgl.h>
#include <kernel.h>
#include <zephyr/kernel.h>

struct zaphod_bongo_cat_widget {
sys_snode_t node;
Expand Down
4 changes: 4 additions & 0 deletions boards/arm/zaphod/zaphod_status_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ lv_obj_t *zmk_display_status_screen() {

panic_label = lv_label_create(center_frame);
lv_label_set_text(panic_label, "Panic");

lv_obj_update_layout(dont_label); // otherwise proper height is not known
lv_obj_set_y(panic_label, lv_obj_get_height(dont_label));
#endif // IS_ENABLED(CONFIG_ZAPHOD_BONGO_CAT)
lv_obj_set_size(center_frame, LV_SIZE_CONTENT, LV_SIZE_CONTENT);

#if IS_ENABLED(CONFIG_ZMK_WIDGET_LAYER_STATUS)
zmk_widget_layer_status_init(&layer_status_widget, screen);
Expand Down

0 comments on commit 9306b4b

Please sign in to comment.