From 8198729ad3aa4bffcb53c523ac9aa4c7cdbcbf26 Mon Sep 17 00:00:00 2001 From: suchmememanyskill <38142618+suchmememanyskill@users.noreply.github.com> Date: Sun, 28 Jan 2024 00:49:25 +0100 Subject: [PATCH] Rename defines --- CYD-Klipper/platformio.ini | 8 ++++---- CYD-Klipper/src/ui/nav_buttons.cpp | 4 ++-- CYD-Klipper/src/ui/panels/macros_panel.cpp | 10 +++++----- CYD-Klipper/src/ui/panels/settings_panel.cpp | 4 ++-- CYD-Klipper/src/ui/ui_utils.h | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CYD-Klipper/platformio.ini b/CYD-Klipper/platformio.ini index 81b35c9..45b41d6 100644 --- a/CYD-Klipper/platformio.ini +++ b/CYD-Klipper/platformio.ini @@ -44,17 +44,17 @@ build_flags = ### Porting options ### # Defines the screen height - -DCYD_SCREEN_HEIGHT=240 + -DCYD_SCREEN_HEIGHT_PX=240 # Defines the screen width - -DCYD_SCREEN_WIDTH=320 + -DCYD_SCREEN_WIDTH_PX=320 # Defines the pixel gap used for large gaps (like between buttons) -DCYD_SCREEN_BIG_GAP_PX=8 # Defines the pixel gap used for small gaps (like between text and buttons) -DCYD_SCREEN_SMALL_GAP_PX=4 # Defines the minimum pixel height of a button - -DCYD_SCREEN_MIN_BUTTON_HEIGHT=35 + -DCYD_SCREEN_MIN_BUTTON_HEIGHT_PX=35 # Defines the minimum pixel width of a button - -DCYD_SCREEN_MIN_BUTTON_WIDTH=35 + -DCYD_SCREEN_MIN_BUTTON_WIDTH_PX=35 # Defines the size of font used -DCYD_SCREEN_FONT=&lv_font_montserrat_14 # Defines the size of font used for small text diff --git a/CYD-Klipper/src/ui/nav_buttons.cpp b/CYD-Klipper/src/ui/nav_buttons.cpp index 5339ca3..2000911 100644 --- a/CYD-Klipper/src/ui/nav_buttons.cpp +++ b/CYD-Klipper/src/ui/nav_buttons.cpp @@ -101,7 +101,7 @@ void nav_buttons_setup(unsigned char active_panel){ lv_obj_clear_flag(lv_scr_act(), LV_OBJ_FLAG_SCROLLABLE); lv_obj_t * root_panel = lv_create_empty_panel(lv_scr_act()); - lv_obj_set_size(root_panel, CYD_SCREEN_SIDEBAR_SIZE_PX, CYD_SCREEN_HEIGHT); + lv_obj_set_size(root_panel, CYD_SCREEN_SIDEBAR_SIZE_PX, CYD_SCREEN_HEIGHT_PX); lv_obj_align(root_panel, LV_ALIGN_TOP_LEFT, 0, 0); lv_obj_set_layout(root_panel, LV_LAYOUT_FLEX); lv_obj_set_flex_flow(root_panel, LV_FLEX_FLOW_COLUMN); @@ -122,7 +122,7 @@ void nav_buttons_setup(unsigned char active_panel){ create_button(LV_SYMBOL_GPS, "Macro", btn_click_macros, NULL, root_panel); lv_obj_t * panel = lv_create_empty_panel(lv_scr_act()); - lv_obj_set_size(panel, CYD_SCREEN_PANEL_WIDTH, CYD_SCREEN_HEIGHT); + lv_obj_set_size(panel, CYD_SCREEN_PANEL_WIDTH, CYD_SCREEN_HEIGHT_PX); lv_obj_align(panel, LV_ALIGN_TOP_RIGHT, 0, 0); switch (active_panel){ diff --git a/CYD-Klipper/src/ui/panels/macros_panel.cpp b/CYD-Klipper/src/ui/panels/macros_panel.cpp index ebb2c07..95034bf 100644 --- a/CYD-Klipper/src/ui/panels/macros_panel.cpp +++ b/CYD-Klipper/src/ui/panels/macros_panel.cpp @@ -22,7 +22,7 @@ static void btn_goto_settings(lv_event_t * e){ void macros_panel_init(lv_obj_t* panel) { lv_obj_t * btn = lv_btn_create(panel); lv_obj_add_event_cb(btn, btn_goto_settings, LV_EVENT_CLICKED, NULL); - lv_obj_set_size(btn, CYD_SCREEN_PANEL_WIDTH - CYD_SCREEN_BIG_GAP_PX * 2, CYD_SCREEN_MIN_BUTTON_HEIGHT); + lv_obj_set_size(btn, CYD_SCREEN_PANEL_WIDTH - CYD_SCREEN_BIG_GAP_PX * 2, CYD_SCREEN_MIN_BUTTON_HEIGHT_PX); lv_obj_align(btn, LV_ALIGN_TOP_MID, 0, CYD_SCREEN_BIG_GAP_PX); lv_obj_t * label = lv_label_create(btn); @@ -38,8 +38,8 @@ void macros_panel_init(lv_obj_t* panel) { } lv_obj_t * root_panel = lv_create_empty_panel(panel); - lv_obj_set_size(root_panel, CYD_SCREEN_PANEL_WIDTH, CYD_SCREEN_HEIGHT - CYD_SCREEN_MIN_BUTTON_HEIGHT - CYD_SCREEN_BIG_GAP_PX); - lv_obj_align(root_panel, LV_ALIGN_TOP_MID, 0, CYD_SCREEN_MIN_BUTTON_HEIGHT + CYD_SCREEN_BIG_GAP_PX); + lv_obj_set_size(root_panel, CYD_SCREEN_PANEL_WIDTH, CYD_SCREEN_HEIGHT_PX - CYD_SCREEN_MIN_BUTTON_HEIGHT_PX - CYD_SCREEN_BIG_GAP_PX); + lv_obj_align(root_panel, LV_ALIGN_TOP_MID, 0, CYD_SCREEN_MIN_BUTTON_HEIGHT_PX + CYD_SCREEN_BIG_GAP_PX); lv_obj_set_layout(root_panel, LV_LAYOUT_FLEX); lv_obj_set_flex_flow(root_panel, LV_FLEX_FLOW_COLUMN); lv_obj_set_flex_align(root_panel, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); @@ -51,7 +51,7 @@ void macros_panel_init(lv_obj_t* panel) { const char* macro = query.macros[i]; lv_obj_t * panel = lv_create_empty_panel(root_panel); - lv_obj_set_size(panel, CYD_SCREEN_PANEL_WIDTH - CYD_SCREEN_BIG_GAP_PX * 3, CYD_SCREEN_MIN_BUTTON_HEIGHT + CYD_SCREEN_BIG_GAP_PX * 2); + lv_obj_set_size(panel, CYD_SCREEN_PANEL_WIDTH - CYD_SCREEN_BIG_GAP_PX * 3, CYD_SCREEN_MIN_BUTTON_HEIGHT_PX + CYD_SCREEN_BIG_GAP_PX * 2); lv_obj_t * line = lv_line_create(panel); lv_line_set_points(line, line_points, 2); @@ -67,7 +67,7 @@ void macros_panel_init(lv_obj_t* panel) { lv_obj_set_width(label, CYD_SCREEN_PANEL_WIDTH * 0.75f); lv_obj_t * btn = lv_btn_create(panel); - lv_obj_set_height(btn, CYD_SCREEN_MIN_BUTTON_HEIGHT); + lv_obj_set_height(btn, CYD_SCREEN_MIN_BUTTON_HEIGHT_PX); lv_obj_align(btn, LV_ALIGN_RIGHT_MID, 0, 0); lv_obj_add_event_cb(btn, btn_press, LV_EVENT_CLICKED, (void*)macro); diff --git a/CYD-Klipper/src/ui/panels/settings_panel.cpp b/CYD-Klipper/src/ui/panels/settings_panel.cpp index 53b2797..9759597 100644 --- a/CYD-Klipper/src/ui/panels/settings_panel.cpp +++ b/CYD-Klipper/src/ui/panels/settings_panel.cpp @@ -85,13 +85,13 @@ static void on_during_print_switch(lv_event_t* e){ const static lv_point_t line_points[] = { {0, 0}, {(short int)((CYD_SCREEN_PANEL_WIDTH - CYD_SCREEN_BIG_GAP_PX * 2) * 0.85f), 0} }; void create_settings_widget(const char* label_text, lv_obj_t* object, lv_obj_t* root_panel){ - lv_obj_set_height(object, CYD_SCREEN_MIN_BUTTON_HEIGHT); + lv_obj_set_height(object, CYD_SCREEN_MIN_BUTTON_HEIGHT_PX); lv_obj_t * panel = lv_obj_create(root_panel); lv_obj_set_style_border_width(panel, 0, 0); lv_obj_set_style_bg_opa(panel, LV_OPA_TRANSP, 0); lv_obj_set_style_pad_all(panel, 0, 0); - lv_obj_set_size(panel, CYD_SCREEN_PANEL_WIDTH - CYD_SCREEN_BIG_GAP_PX * 3, CYD_SCREEN_MIN_BUTTON_HEIGHT + CYD_SCREEN_BIG_GAP_PX * 2); + lv_obj_set_size(panel, CYD_SCREEN_PANEL_WIDTH - CYD_SCREEN_BIG_GAP_PX * 3, CYD_SCREEN_MIN_BUTTON_HEIGHT_PX + CYD_SCREEN_BIG_GAP_PX * 2); lv_obj_t * line = lv_line_create(panel); lv_line_set_points(line, line_points, 2); diff --git a/CYD-Klipper/src/ui/ui_utils.h b/CYD-Klipper/src/ui/ui_utils.h index 381b8a5..39effe1 100644 --- a/CYD-Klipper/src/ui/ui_utils.h +++ b/CYD-Klipper/src/ui/ui_utils.h @@ -1,6 +1,6 @@ #pragma once #define CYD_SCREEN_PANEL_WIDTH \ - (CYD_SCREEN_WIDTH - CYD_SCREEN_SIDEBAR_SIZE_PX) + (CYD_SCREEN_WIDTH_PX - CYD_SCREEN_SIDEBAR_SIZE_PX) lv_obj_t* lv_create_empty_panel(lv_obj_t* root); \ No newline at end of file