Skip to content

Commit

Permalink
Merge pull request petejohanson#10 from jbarr21/jb/lite-display-lvgl-…
Browse files Browse the repository at this point in the history
…updates

Update zaphod_lite status screen to match zaphod
  • Loading branch information
petejohanson authored Nov 20, 2023
2 parents 9306b4b + fdd8132 commit c867bcd
Showing 1 changed file with 19 additions and 19 deletions.
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 c867bcd

Please sign in to comment.