Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
chdorner committed Dec 27, 2023
2 parents ce1a8c0 + c867bcd commit 1904c72
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 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
38 changes: 19 additions & 19 deletions boards/shields/zaphod_lite/zaphod_status_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <zmk/display/widgets/wpm_status.h>
#include <zmk/display/status_screen.h>

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

#if IS_ENABLED(CONFIG_ZAPHOD_BONGO_CAT)
Expand Down Expand Up @@ -47,52 +47,52 @@ lv_obj_t *zmk_display_status_screen() {
lv_obj_t *center_frame;

lv_style_init(&global_style);
lv_style_set_text_font(&global_style, LV_STATE_DEFAULT, &lv_font_montserrat_26);
lv_style_set_text_letter_space(&global_style, LV_STATE_DEFAULT, 1);
lv_style_set_text_line_space(&global_style, LV_STATE_DEFAULT, 1);
lv_style_set_text_font(&global_style, &lv_font_montserrat_26);
lv_style_set_text_letter_space(&global_style, 1);
lv_style_set_text_line_space(&global_style, 1);

screen = lv_obj_create(NULL, NULL);
lv_obj_add_style(screen, LV_LABEL_PART_MAIN, &global_style);
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

center_frame = lv_cont_create(screen, NULL);
lv_obj_set_auto_realign(center_frame, true);
lv_obj_align(center_frame, NULL, LV_ALIGN_CENTER, 0,
0);
lv_cont_set_fit(center_frame, LV_FIT_TIGHT);
lv_cont_set_layout(center_frame, LV_LAYOUT_CENTER);
center_frame = lv_obj_create(screen);
lv_obj_align(center_frame, LV_ALIGN_CENTER, 0, 0);
lv_obj_center(center_frame);

#if IS_ENABLED(CONFIG_ZAPHOD_BONGO_CAT)
zaphod_bongo_cat_widget_init(&bongo_widget, center_frame);
#else
dont_label = lv_label_create(center_frame, NULL);
dont_label = lv_label_create(center_frame);
lv_label_set_text(dont_label, "Don't");

panic_label = lv_label_create(center_frame, NULL);
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);
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,
0);
lv_obj_align(zmk_widget_wpm_status_obj(&wpm_status_widget), LV_ALIGN_BOTTOM_RIGHT, -12, 0);
#endif
return screen;
}

0 comments on commit 1904c72

Please sign in to comment.