From f5f970afce885db80eb9d2a9222abbc479316548 Mon Sep 17 00:00:00 2001 From: suchmememanyskill <38142618+suchmememanyskill@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:51:25 +0100 Subject: [PATCH] Show macros help message even when there's power devices present --- CYD-Klipper/src/ui/panels/macros_panel.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/CYD-Klipper/src/ui/panels/macros_panel.cpp b/CYD-Klipper/src/ui/panels/macros_panel.cpp index 295eaca..f48d935 100644 --- a/CYD-Klipper/src/ui/panels/macros_panel.cpp +++ b/CYD-Klipper/src/ui/panels/macros_panel.cpp @@ -22,14 +22,8 @@ void macros_panel_init(lv_obj_t* panel) { lv_label_set_text(label, LV_SYMBOL_SETTINGS " Screen Settings"); lv_obj_center(label); - MACROSQUERY query = macros_query(); + MACROSQUERY macros = macros_query(); POWERQUERY power = power_devices_query(); - if (query.count == 0 && power.count == 0){ - label = lv_label_create(panel); - lv_label_set_text(label, "No macros found.\nMacros with the description\n\"CYD_SCREEN_MACRO\"\nwill show up here."); - lv_obj_align(label, LV_ALIGN_CENTER, 0, 0); - return; - } lv_obj_t * root_panel = lv_create_empty_panel(panel); lv_obj_set_scrollbar_mode(root_panel, LV_SCROLLBAR_MODE_OFF); @@ -38,5 +32,17 @@ void macros_panel_init(lv_obj_t* panel) { lv_layout_flex_column(root_panel); macros_add_power_devices_to_panel(root_panel, power); - macros_add_macros_to_panel(root_panel, query); + + if (macros.count == 0){ + label = lv_label_create(root_panel); + lv_label_set_text(label, "No macros found.\nMacros with the description\n\"CYD_SCREEN_MACRO\"\nwill show up here."); + + if (power.count == 0){ + lv_layout_flex_column(root_panel, LV_FLEX_ALIGN_CENTER); + } + + return; + } + + macros_add_macros_to_panel(root_panel, macros); } \ No newline at end of file