|
10 | 10 | #include <zmk/display/widgets/wpm_status.h>
|
11 | 11 | #include <zmk/display/status_screen.h>
|
12 | 12 |
|
13 |
| -#include <logging/log.h> |
| 13 | +#include <zephyr/logging/log.h> |
14 | 14 | LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
15 | 15 |
|
16 | 16 | #if IS_ENABLED(CONFIG_ZAPHOD_BONGO_CAT)
|
@@ -47,52 +47,52 @@ lv_obj_t *zmk_display_status_screen() {
|
47 | 47 | lv_obj_t *center_frame;
|
48 | 48 |
|
49 | 49 | lv_style_init(&global_style);
|
50 |
| - lv_style_set_text_font(&global_style, LV_STATE_DEFAULT, &lv_font_montserrat_26); |
51 |
| - lv_style_set_text_letter_space(&global_style, LV_STATE_DEFAULT, 1); |
52 |
| - lv_style_set_text_line_space(&global_style, LV_STATE_DEFAULT, 1); |
| 50 | + lv_style_set_text_font(&global_style, &lv_font_montserrat_26); |
| 51 | + lv_style_set_text_letter_space(&global_style, 1); |
| 52 | + lv_style_set_text_line_space(&global_style, 1); |
53 | 53 |
|
54 |
| - screen = lv_obj_create(NULL, NULL); |
55 |
| - lv_obj_add_style(screen, LV_LABEL_PART_MAIN, &global_style); |
| 54 | + screen = lv_obj_create(NULL); |
| 55 | + lv_obj_add_style(screen, &global_style, LV_PART_MAIN); |
56 | 56 |
|
57 | 57 | #if IS_ENABLED(CONFIG_ZMK_WIDGET_BATTERY_STATUS)
|
58 | 58 | zmk_widget_battery_status_init(&battery_status_widget, screen);
|
59 |
| - lv_obj_align(zmk_widget_battery_status_obj(&battery_status_widget), NULL, LV_ALIGN_IN_TOP_RIGHT, |
| 59 | + lv_obj_align(zmk_widget_battery_status_obj(&battery_status_widget), LV_ALIGN_TOP_RIGHT, |
60 | 60 | 0, 0);
|
61 | 61 | #endif
|
62 | 62 |
|
63 | 63 | #if IS_ENABLED(CONFIG_ZMK_WIDGET_OUTPUT_STATUS)
|
64 | 64 | zmk_widget_output_status_init(&output_status_widget, screen);
|
65 |
| - lv_obj_align(zmk_widget_output_status_obj(&output_status_widget), NULL, LV_ALIGN_IN_TOP_LEFT, 0, |
| 65 | + lv_obj_align(zmk_widget_output_status_obj(&output_status_widget), LV_ALIGN_TOP_LEFT, 0, |
66 | 66 | 0);
|
67 | 67 | #endif
|
68 | 68 |
|
69 |
| - center_frame = lv_cont_create(screen, NULL); |
70 |
| - lv_obj_set_auto_realign(center_frame, true); |
71 |
| - lv_obj_align(center_frame, NULL, LV_ALIGN_CENTER, 0, |
72 |
| - 0); |
73 |
| - lv_cont_set_fit(center_frame, LV_FIT_TIGHT); |
74 |
| - lv_cont_set_layout(center_frame, LV_LAYOUT_CENTER); |
| 69 | + center_frame = lv_obj_create(screen); |
| 70 | + lv_obj_align(center_frame, LV_ALIGN_CENTER, 0, 0); |
| 71 | + lv_obj_center(center_frame); |
75 | 72 |
|
76 | 73 | #if IS_ENABLED(CONFIG_ZAPHOD_BONGO_CAT)
|
77 | 74 | zaphod_bongo_cat_widget_init(&bongo_widget, center_frame);
|
78 | 75 | #else
|
79 |
| - dont_label = lv_label_create(center_frame, NULL); |
| 76 | + dont_label = lv_label_create(center_frame); |
80 | 77 | lv_label_set_text(dont_label, "Don't");
|
81 | 78 |
|
82 |
| - panic_label = lv_label_create(center_frame, NULL); |
| 79 | + panic_label = lv_label_create(center_frame); |
83 | 80 | lv_label_set_text(panic_label, "Panic");
|
| 81 | + |
| 82 | + lv_obj_update_layout(dont_label); // otherwise proper height is not known |
| 83 | + lv_obj_set_y(panic_label, lv_obj_get_height(dont_label)); |
84 | 84 | #endif // IS_ENABLED(CONFIG_ZAPHOD_BONGO_CAT)
|
| 85 | + lv_obj_set_size(center_frame, LV_SIZE_CONTENT, LV_SIZE_CONTENT); |
85 | 86 |
|
86 | 87 | #if IS_ENABLED(CONFIG_ZMK_WIDGET_LAYER_STATUS)
|
87 | 88 | zmk_widget_layer_status_init(&layer_status_widget, screen);
|
88 |
| - lv_obj_align(zmk_widget_layer_status_obj(&layer_status_widget), NULL, LV_ALIGN_IN_BOTTOM_LEFT, |
| 89 | + lv_obj_align(zmk_widget_layer_status_obj(&layer_status_widget), LV_ALIGN_BOTTOM_LEFT, |
89 | 90 | 0, 0);
|
90 | 91 | #endif
|
91 | 92 |
|
92 | 93 | #if IS_ENABLED(CONFIG_ZMK_WIDGET_WPM_STATUS)
|
93 | 94 | zmk_widget_wpm_status_init(&wpm_status_widget, screen);
|
94 |
| - lv_obj_align(zmk_widget_wpm_status_obj(&wpm_status_widget), NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -12, |
95 |
| - 0); |
| 95 | + lv_obj_align(zmk_widget_wpm_status_obj(&wpm_status_widget), LV_ALIGN_BOTTOM_RIGHT, -12, 0); |
96 | 96 | #endif
|
97 | 97 | return screen;
|
98 | 98 | }
|
0 commit comments