diff --git a/cmake/dev_tools.cmake b/cmake/dev_tools.cmake index cd8603c4..e1b86db2 100644 --- a/cmake/dev_tools.cmake +++ b/cmake/dev_tools.cmake @@ -3,7 +3,7 @@ # Debug = 2 # Error only = 1 # Disabled = 0 -add_compile_options(-DESP3D_TFT_LOG=0) +add_compile_options(-DESP3D_TFT_LOG=1) # Disable ANSI color to fit some serial terminals add_compile_options(-DDISABLE_COLOR_LOG=0) diff --git a/main/display/3dprinter/marlin/esp3d_styles.cpp b/main/display/3dprinter/marlin/esp3d_styles.cpp index 7bc4ae6a..c87f4f88 100644 --- a/main/display/3dprinter/marlin/esp3d_styles.cpp +++ b/main/display/3dprinter/marlin/esp3d_styles.cpp @@ -101,14 +101,14 @@ bool init() { lv_style_set_text_opa(&style_read_only_value, LV_OPA_COVER); lv_style_set_text_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); lv_style_set_bg_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_COLOR); - lv_style_set_radius(&style_read_only_value, CURRENT_STATUS_BAR_RADIUS); + lv_style_set_radius(&style_read_only_value, ESP3D_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_value, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_read_only_value, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); lv_style_set_text_align(&style_read_only_value, LV_TEXT_ALIGN_CENTER); - lv_style_set_pad_top(&style_read_only_value, CURRENT_BUTTON_PAD); - lv_style_set_pad_bottom(&style_read_only_value, CURRENT_BUTTON_PAD); + lv_style_set_pad_top(&style_read_only_value, ESP3D_BUTTON_PAD); + lv_style_set_pad_bottom(&style_read_only_value, ESP3D_BUTTON_PAD); /* read only setting on main background @@ -116,16 +116,16 @@ bool init() { lv_style_init(&style_read_only_setting); lv_style_set_text_opa(&style_read_only_setting, LV_OPA_COVER); lv_style_set_text_color(&style_read_only_setting, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_bg_color(&style_read_only_setting, ESP3D_SCREEN_BACKGROUND_COLOR); - lv_style_set_radius(&style_read_only_setting, CURRENT_STATUS_BAR_RADIUS); + lv_style_set_radius(&style_read_only_setting, ESP3D_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_setting, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_read_only_setting, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); lv_style_set_text_align(&style_read_only_setting, LV_TEXT_ALIGN_CENTER); - lv_style_set_pad_top(&style_read_only_setting, CURRENT_BUTTON_PAD); - lv_style_set_pad_bottom(&style_read_only_setting, CURRENT_BUTTON_PAD); + lv_style_set_pad_top(&style_read_only_setting, ESP3D_BUTTON_PAD); + lv_style_set_pad_bottom(&style_read_only_setting, ESP3D_BUTTON_PAD); /* Status bar @@ -134,16 +134,16 @@ bool init() { lv_style_set_text_opa(&style_status_bar_default, LV_OPA_COVER); lv_style_set_text_color(&style_status_bar_default, - CURRENT_STATUS_BAR_TEXT_COLOR); + ESP3D_STATUS_BAR_TEXT_COLOR); lv_style_set_bg_opa(&style_status_bar_default, LV_OPA_COVER); - lv_style_set_bg_color(&style_status_bar_default, CURRENT_STATUS_BAR_BG_COLOR); - lv_style_set_radius(&style_status_bar_default, CURRENT_STATUS_BAR_RADIUS); - lv_style_set_pad_hor(&style_status_bar_default, CURRENT_STATUS_BAR_H_PAD); - lv_style_set_pad_ver(&style_status_bar_default, CURRENT_STATUS_BAR_V_PAD); + lv_style_set_bg_color(&style_status_bar_default, ESP3D_STATUS_BAR_BG_COLOR); + lv_style_set_radius(&style_status_bar_default, ESP3D_STATUS_BAR_RADIUS); + lv_style_set_pad_hor(&style_status_bar_default, ESP3D_STATUS_BAR_H_PAD); + lv_style_set_pad_ver(&style_status_bar_default, ESP3D_STATUS_BAR_V_PAD); lv_style_set_border_width(&style_status_bar_default, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_status_bar_default, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); /* Scrollbar @@ -151,7 +151,7 @@ bool init() { // Create style for scrollbar default state lv_style_init(&style_scrollbar_default); - lv_style_set_width(&style_scrollbar_default, CURRENT_SCROLL_BAR_WIDTH); + lv_style_set_width(&style_scrollbar_default, ESP3D_SCROLL_BAR_WIDTH); lv_style_set_bg_opa(&style_scrollbar_default, LV_OPA_COVER); lv_style_set_bg_color(&style_scrollbar_default, lv_palette_main(LV_PALETTE_GREY)); @@ -159,12 +159,12 @@ bool init() { lv_style_set_border_color( &style_scrollbar_default, lv_palette_darken(LV_PALETTE_GREY, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_border_opa(&style_scrollbar_default, LV_OPA_COVER); lv_style_set_border_width(&style_scrollbar_default, - CURRENT_BUTTON_BORDER_VALUE); - lv_style_set_radius(&style_scrollbar_default, CURRENT_SCROLL_BAR_RADIUS); + ESP3D_BUTTON_BORDER_SIZE); + lv_style_set_radius(&style_scrollbar_default, ESP3D_SCROLL_BAR_RADIUS); lv_style_set_pad_all(&style_scrollbar_default, 8); // Create style for scrollbar active state lv_style_init(&style_scrollbar_active); @@ -172,11 +172,11 @@ bool init() { lv_style_set_bg_color(&style_scrollbar_active, lv_palette_main(LV_PALETTE_GREEN)); lv_style_set_shadow_width(&style_scrollbar_active, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_shadow_color(&style_scrollbar_active, lv_palette_main(LV_PALETTE_GREEN)); lv_style_set_shadow_spread(&style_scrollbar_active, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); /* Radio Buttons @@ -187,16 +187,16 @@ bool init() { lv_style_set_border_color( &style_btn_radio_default, lv_palette_darken(LV_PALETTE_GREY, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); // Create style for button pressed state lv_style_init(&style_btn_radio_pressed); lv_style_set_shadow_width(&style_btn_radio_pressed, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_shadow_color(&style_btn_radio_pressed, lv_palette_main(LV_PALETTE_GREEN)); lv_style_set_shadow_spread(&style_btn_radio_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_btn_radio_pressed, lv_palette_main(LV_PALETTE_GREEN)); @@ -212,57 +212,57 @@ bool init() { // Create style for button default state lv_style_init(&style_btn_default); - lv_style_set_radius(&style_btn_default, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_default, ESP3D_BUTTON_RADIUS ); lv_style_set_bg_opa(&style_btn_default, LV_OPA_100); lv_style_set_bg_color(&style_btn_default, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_btn_default, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_btn_default, LV_GRAD_DIR_VER); lv_style_set_border_opa(&style_btn_default, LV_OPA_40); - lv_style_set_border_width(&style_btn_default, CURRENT_BUTTON_BORDER_VALUE); - lv_style_set_border_color(&style_btn_default, CURRENT_BUTTON_BORDER_COLOR); + lv_style_set_border_width(&style_btn_default, ESP3D_BUTTON_BORDER_SIZE); + lv_style_set_border_color(&style_btn_default, ESP3D_BUTTON_BORDER_COLOR); lv_style_set_outline_opa(&style_btn_default, LV_OPA_COVER); lv_style_set_outline_color( &style_btn_default, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); - lv_style_set_text_color(&style_btn_default, CURRENT_BUTTON_TEXT_COLOR); - lv_style_set_pad_all(&style_btn_default, CURRENT_BUTTON_PAD); + lv_style_set_text_color(&style_btn_default, ESP3D_BUTTON_TEXT_COLOR); + lv_style_set_pad_all(&style_btn_default, ESP3D_BUTTON_PAD); // Create style for button pressed state lv_style_init(&style_btn_pressed); /*Add a large outline when pressed*/ lv_style_set_outline_width(&style_btn_pressed, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_outline_opa(&style_btn_pressed, LV_OPA_TRANSP); lv_style_set_shadow_ofs_y(&style_btn_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_color( &style_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_text_color(&style_btn_pressed, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_border_color(&style_btn_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); - if (BUTTON_ANIMATION_DELAY) { + ESP3D_BUTTON_PRESSED_BORDER_COLOR); + if (ESP3D_BUTTON_ANIMATION_DELAY) { /*Add a transition to the outline*/ static lv_style_transition_dsc_t trans; static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, LV_STYLE_PROP_INV}; lv_style_transition_dsc_init(&trans, props, lv_anim_path_linear, - BUTTON_ANIMATION_DELAY, 0, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, 0, NULL); lv_style_set_transition(&style_btn_pressed, &trans); } @@ -275,44 +275,44 @@ bool init() { lv_style_set_radius(&style_embedded_btn_default, 0); lv_style_set_bg_opa(&style_embedded_btn_default, LV_OPA_100); lv_style_set_bg_color(&style_embedded_btn_default, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_embedded_btn_default, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_embedded_btn_default, LV_GRAD_DIR_VER); lv_style_set_border_opa(&style_embedded_btn_default, LV_OPA_40); lv_style_set_border_width(&style_embedded_btn_default, - CURRENT_BUTTON_BORDER_VALUE); + ESP3D_BUTTON_BORDER_SIZE); lv_style_set_border_color(&style_embedded_btn_default, - CURRENT_BUTTON_BORDER_COLOR); + ESP3D_BUTTON_BORDER_COLOR); lv_style_set_outline_opa(&style_embedded_btn_default, LV_OPA_COVER); lv_style_set_outline_color( &style_embedded_btn_default, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); lv_style_set_text_color(&style_embedded_btn_default, - CURRENT_BUTTON_TEXT_COLOR); - lv_style_set_pad_all(&style_embedded_btn_default, CURRENT_BUTTON_PAD); + ESP3D_BUTTON_TEXT_COLOR); + lv_style_set_pad_all(&style_embedded_btn_default, ESP3D_BUTTON_PAD); // Create style for embedded button pressed state lv_style_init(&style_embedded_btn_pressed); lv_style_set_shadow_ofs_y(&style_embedded_btn_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_embedded_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_color( &style_embedded_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_text_color(&style_embedded_btn_pressed, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_border_color(&style_embedded_btn_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); + ESP3D_BUTTON_PRESSED_BORDER_COLOR); /* Buttons matrix @@ -323,33 +323,33 @@ bool init() { lv_style_set_pad_all(&style_btn_matrix_bar, 1); lv_style_set_pad_gap(&style_btn_matrix_bar, 0); lv_style_set_clip_corner(&style_btn_matrix_bar, true); - lv_style_set_radius(&style_btn_matrix_bar, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_bar, ESP3D_BUTTON_RADIUS ); lv_style_set_pad_left(&style_btn_matrix_bar, 4); lv_style_set_pad_top(&style_btn_matrix_bar, 4); // border lv_style_set_border_opa(&style_btn_matrix_bar, LV_OPA_40); - lv_style_set_border_width(&style_btn_matrix_bar, CURRENT_BUTTON_BORDER_VALUE); - lv_style_set_border_color(&style_btn_matrix_bar, CURRENT_BUTTON_BORDER_COLOR); + lv_style_set_border_width(&style_btn_matrix_bar, ESP3D_BUTTON_BORDER_SIZE); + lv_style_set_border_color(&style_btn_matrix_bar, ESP3D_BUTTON_BORDER_COLOR); // bg lv_style_set_bg_opa(&style_btn_matrix_bar, LV_OPA_100); lv_style_set_bg_color(&style_btn_matrix_bar, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_btn_matrix_bar, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_btn_matrix_bar, LV_GRAD_DIR_VER); // text - lv_style_set_text_color(&style_btn_matrix_bar, CURRENT_BUTTON_TEXT_COLOR); + lv_style_set_text_color(&style_btn_matrix_bar, ESP3D_BUTTON_TEXT_COLOR); //***************************************************************** // Default lv_style_init(&style_btn_matrix_default); - lv_style_set_radius(&style_btn_matrix_default, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_default, ESP3D_BUTTON_RADIUS ); // bg // text @@ -360,32 +360,32 @@ bool init() { // Pressed lv_style_init(&style_btn_matrix_pressed); lv_style_set_pad_all(&style_btn_matrix_pressed, 10); - lv_style_set_radius(&style_btn_matrix_pressed, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_pressed, ESP3D_BUTTON_RADIUS ); lv_style_set_outline_opa(&style_btn_matrix_pressed, LV_OPA_40); lv_style_set_outline_color( &style_btn_matrix_pressed, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); lv_style_set_outline_width(&style_btn_matrix_pressed, 1); // bg lv_style_set_bg_opa(&style_btn_matrix_pressed, LV_OPA_60); lv_style_set_bg_color( &style_btn_matrix_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_bg_grad_color( &style_btn_matrix_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); // text lv_style_set_text_color( &style_btn_matrix_pressed, - lv_palette_darken(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); // border lv_style_set_border_color(&style_btn_matrix_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); + ESP3D_BUTTON_PRESSED_BORDER_COLOR); lv_style_set_border_width(&style_btn_matrix_pressed, 3); lv_style_set_border_opa(&style_btn_matrix_pressed, LV_OPA_60); @@ -393,24 +393,24 @@ bool init() { // checked lv_style_init(&style_btn_matrix_checked); lv_style_set_pad_all(&style_btn_matrix_checked, 10); - lv_style_set_radius(&style_btn_matrix_checked, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_checked, ESP3D_BUTTON_RADIUS ); // bg lv_style_set_bg_opa(&style_btn_matrix_checked, LV_OPA_40); lv_style_set_bg_color( &style_btn_matrix_checked, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_bg_grad_color( &style_btn_matrix_checked, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); // text lv_style_set_text_color(&style_btn_matrix_checked, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); // border lv_style_set_border_color(&style_btn_matrix_checked, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); + ESP3D_BUTTON_PRESSED_BORDER_COLOR); lv_style_set_border_width(&style_btn_matrix_checked, 2); lv_style_set_border_opa(&style_btn_matrix_checked, LV_OPA_40); @@ -419,30 +419,30 @@ bool init() { */ /*Default*/ lv_style_init(&style_btn_msb_box_default); - lv_style_set_radius(&style_btn_msb_box_default, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_msb_box_default, ESP3D_BUTTON_RADIUS ); lv_style_set_bg_opa(&style_btn_msb_box_default, LV_OPA_100); lv_style_set_bg_color(&style_btn_msb_box_default, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_btn_msb_box_default, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_btn_msb_box_default, LV_GRAD_DIR_VER); lv_style_set_border_opa(&style_btn_msb_box_default, LV_OPA_40); lv_style_set_border_width(&style_btn_msb_box_default, - CURRENT_BUTTON_BORDER_VALUE); + ESP3D_BUTTON_BORDER_SIZE); lv_style_set_border_color(&style_btn_msb_box_default, - CURRENT_BUTTON_BORDER_COLOR); + ESP3D_BUTTON_BORDER_COLOR); lv_style_set_outline_opa(&style_btn_msb_box_default, LV_OPA_COVER); lv_style_set_outline_color( &style_btn_msb_box_default, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); lv_style_set_text_color(&style_btn_msb_box_default, - CURRENT_BUTTON_TEXT_COLOR); - lv_style_set_pad_all(&style_btn_msb_box_default, CURRENT_BUTTON_PAD); + ESP3D_BUTTON_TEXT_COLOR); + lv_style_set_pad_all(&style_btn_msb_box_default, ESP3D_BUTTON_PAD); /*Pressed*/ @@ -450,30 +450,30 @@ bool init() { /*Add a large outline when pressed*/ lv_style_set_outline_width(&style_btn_msb_box_pressed, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_outline_opa(&style_btn_msb_box_pressed, LV_OPA_TRANSP); lv_style_set_shadow_ofs_y(&style_btn_msb_box_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_btn_msb_box_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_color( &style_btn_msb_box_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_text_color(&style_btn_msb_box_pressed, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_border_color(&style_btn_msb_box_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); - if (BUTTON_ANIMATION_DELAY) { + ESP3D_BUTTON_PRESSED_BORDER_COLOR); + if (ESP3D_BUTTON_ANIMATION_DELAY) { /*Add a transition to the outline*/ static lv_style_transition_dsc_t trans; static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, LV_STYLE_PROP_INV}; lv_style_transition_dsc_init(&trans, props, lv_anim_path_linear, - BUTTON_ANIMATION_DELAY, 0, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, 0, NULL); lv_style_set_transition(&style_btn_msb_box_pressed, &trans); } @@ -483,24 +483,24 @@ bool init() { lv_style_init(&style_status_list_default); lv_style_set_text_opa(&style_status_list_default, LV_OPA_COVER); lv_style_set_text_color(&style_status_list_default, - CURRENT_STATUS_BAR_TEXT_COLOR); + ESP3D_STATUS_BAR_TEXT_COLOR); lv_style_set_bg_opa(&style_status_list_default, LV_OPA_COVER); lv_style_set_bg_color(&style_status_list_default, - CURRENT_STATUS_BAR_BG_COLOR); + ESP3D_STATUS_BAR_BG_COLOR); lv_style_set_radius(&style_status_list_default, 0); // lv_style_set_pad_hor(&style_status_list_default, - // CURRENT_STATUS_BAR_H_PAD); + // ESP3D_STATUS_BAR_H_PAD); // lv_style_set_pad_ver(&style_status_list_default, - // CURRENT_STATUS_BAR_V_PAD); + // ESP3D_STATUS_BAR_V_PAD); lv_style_set_border_width(&style_status_list_default, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_status_list_default, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); /* Col Container */ lv_style_init(&style_col_container_default); - lv_style_set_radius(&style_col_container_default, CURRENT_CONTAINER_RADIUS); + lv_style_set_radius(&style_col_container_default, ESP3D_CONTAINER_RADIUS); lv_style_set_layout(&style_col_container_default, LV_LAYOUT_FLEX); lv_style_set_flex_flow(&style_col_container_default, LV_FLEX_FLOW_COLUMN); lv_style_set_flex_main_place(&style_col_container_default, @@ -510,7 +510,7 @@ bool init() { Row Container */ lv_style_init(&style_row_container_default); - lv_style_set_radius(&style_row_container_default, CURRENT_CONTAINER_RADIUS); + lv_style_set_radius(&style_row_container_default, ESP3D_CONTAINER_RADIUS); lv_style_set_layout(&style_row_container_default, LV_LAYOUT_FLEX); lv_style_set_flex_flow(&style_row_container_default, LV_FLEX_FLOW_ROW); lv_style_set_flex_main_place(&style_row_container_default, @@ -607,8 +607,8 @@ bool apply(lv_obj_t* obj, ESP3DStyleType type) { lv_obj_set_width(obj, LV_PCT(80)); ESP3DStyle::apply(lv_msgbox_get_close_btn(obj), ESP3DStyleType::button); ESP3DStyle::apply(lv_msgbox_get_btns(obj), ESP3DStyleType::buttons_msgbox); - lv_obj_set_height(lv_msgbox_get_btns(obj), SYMBOL_BUTTON_HEIGHT); - lv_obj_set_width(lv_msgbox_get_btns(obj), MSGBOX_BUTTON_WIDTH); + lv_obj_set_height(lv_msgbox_get_btns(obj), ESP3D_SYMBOL_BUTTON_HEIGHT); + lv_obj_set_width(lv_msgbox_get_btns(obj), ESP3D_MSGBOX_BUTTON_WIDTH); break; case ESP3DStyleType::embedded_button: lv_obj_add_style(obj, &style_embedded_btn_default, LV_STATE_DEFAULT); @@ -618,16 +618,16 @@ bool apply(lv_obj_t* obj, ESP3DStyleType type) { case ESP3DStyleType::row_container: lv_obj_add_style(obj, &style_row_container_default, LV_STATE_DEFAULT); lv_obj_set_style_clip_corner(obj, true, 0); - lv_obj_set_style_pad_column(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_column(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); break; case ESP3DStyleType::col_container: lv_obj_add_style(obj, &style_col_container_default, LV_STATE_DEFAULT); lv_obj_set_style_clip_corner(obj, true, 0); - lv_obj_set_style_pad_top(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_top(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_bottom(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_bottom(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); break; case ESP3DStyleType::list_container: @@ -635,10 +635,10 @@ bool apply(lv_obj_t* obj, ESP3DStyleType type) { lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_ELASTIC); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_scrollbar_mode(obj, LV_SCROLLBAR_MODE_AUTO); - lv_obj_set_style_pad_row(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_row(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_set_style_flex_main_place(obj, LV_FLEX_ALIGN_START, LV_PART_MAIN); - lv_obj_set_style_pad_all(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_all(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_add_style(obj, &style_scrollbar_default, LV_PART_SCROLLBAR); #pragma GCC diagnostic push @@ -669,10 +669,10 @@ bool apply(lv_obj_t* obj, ESP3DStyleType type) { } bool add_pad(lv_obj_t* obj) { - lv_obj_set_style_pad_left(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_right(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_top(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_bottom(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_left(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_set_style_pad_right(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_set_style_pad_top(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_set_style_pad_bottom(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); return true; } diff --git a/main/display/3dprinter/marlin/esp3d_styles.h b/main/display/3dprinter/marlin/esp3d_styles.h index ced70744..a6fd4040 100644 --- a/main/display/3dprinter/marlin/esp3d_styles.h +++ b/main/display/3dprinter/marlin/esp3d_styles.h @@ -57,23 +57,25 @@ namespace ESP3DStyle { }; // namespace ESP3DStyle //Colors definition + //Screen colors #define ESP3D_SCREEN_BACKGROUND_COLOR lv_color_hex(0x000000) #define ESP3D_SCREEN_BACKGROUND_TEXT_COLOR lv_color_hex(0xFFFFFF) +//Button colors +#define ESP3D_BUTTON_COLOR_PALETTE LV_PALETTE_GREY +#define ESP3D_BUTTON_COLOR_PALETTE_DARKEN 2 +#define ESP3D_BUTTON_BORDER_COLOR lv_color_hex(0xFFFFFF) +#define ESP3D_BUTTON_TEXT_COLOR lv_color_hex(0xFFFFFF) +#define ESP3D_BUTTON_OUTLINE_COLOR_PALETTE LV_PALETTE_GREEN +#define ESP3D_BUTTON_PRESSED_COLOR_PALETTE LV_PALETTE_GREY +#define ESP3D_BUTTON_PRESSED_TEXT_COLOR lv_color_hex(0x00FF00) +#define ESP3D_BUTTON_PRESSED_BORDER_COLOR lv_color_hex(0x00FF00) -#define CURRENT_STATUS_BAR_TEXT_COLOR lv_color_hex(0x000000) -#define CURRENT_STATUS_BAR_BG_COLOR lv_color_hex(0xFFFFFF) -#define CURRENT_STATUS_BAR_BORDER_COLOR lv_palette_main(LV_PALETTE_GREY) +//Status bar colors +#define ESP3D_STATUS_BAR_TEXT_COLOR lv_color_hex(0x000000) +#define ESP3D_STATUS_BAR_BG_COLOR lv_color_hex(0xFFFFFF) +#define ESP3D_STATUS_BAR_BORDER_COLOR lv_palette_main(LV_PALETTE_GREY) -#define CURRENT_BUTTON_COLOR_PALETTE LV_PALETTE_GREY -#define CURRENT_BUTTON_COLOR_PALETTE_DARKEN 2 -#define CURRENT_BUTTON_BORDER_COLOR \ - lv_color_hex(0xFFFFFF) // lv_palette_main(LV_PALETTE_GREY) -#define CURRENT_BUTTON_TEXT_COLOR lv_color_hex(0xFFFFFF) -#define CURRENT_BUTTON_OUTLINE_COLOR_PALETTE LV_PALETTE_GREEN -#define CURRENT_BUTTON_PRESSED_COLOR_PALETTE LV_PALETTE_GREY -#define CURRENT_BUTTON_PRESSED_TEXT_COLOR lv_color_hex(0x00FF00) -#define CURRENT_BUTTON_PRESSED_BORDER_COLOR lv_color_hex(0x00FF00) diff --git a/main/display/3dprinter/marlin/res_320_240/esp3d_styles_res.h b/main/display/3dprinter/marlin/res_320_240/esp3d_styles_res.h index be39cd82..550d4a7e 100644 --- a/main/display/3dprinter/marlin/res_320_240/esp3d_styles_res.h +++ b/main/display/3dprinter/marlin/res_320_240/esp3d_styles_res.h @@ -20,46 +20,46 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 4 -#define CURRENT_STATUS_BAR_H_PAD 5 -#define CURRENT_STATUS_BAR_V_PAD 3 -#define CURRENT_STATUS_BAR_BORDER_VALUE 1 -#define CURRENT_STATUS_AREA_HEIGHT 40 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 10) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 2 +#define ESP3D_STATUS_BAR_RADIUS 4 +#define ESP3D_STATUS_BAR_H_PAD 5 +#define ESP3D_STATUS_BAR_V_PAD 3 +#define ESP3D_STATUS_BAR_BORDER_VALUE 1 +#define ESP3D_STATUS_BAR_HEIGHT 40 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 10) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 2 -#define CURRENT_BUTTON_RADIUS_VALUE 4 -#define CURRENT_BUTTON_BORDER_VALUE 2 +#define ESP3D_BUTTON_RADIUS 4 +#define ESP3D_BUTTON_BORDER_SIZE 2 -#define CURRENT_BUTTON_PRESSED_OUTLINE 5 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 3 +#define ESP3D_BUTTON_PRESSED_OUTLINE 5 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 3 -#define CURRENT_CONTAINER_RADIUS 5 +#define ESP3D_CONTAINER_RADIUS 5 -#define BUTTON_WIDTH 60 -#define BUTTON_HEIGHT 60 +#define ESP3D_BUTTON_WIDTH 60 +#define ESP3D_BUTTON_HEIGHT 60 -#define SYMBOL_BUTTON_WIDTH 50 -#define SYMBOL_BUTTON_HEIGHT 44 +#define ESP3D_SYMBOL_BUTTON_WIDTH 50 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 44 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 0 -#endif // BUTTON_ANIMATION_DELAY +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 0 +#endif // ESP3D_BUTTON_ANIMATION_DELAY -#define CURRENT_SPINNER_SIZE 70 +#define ESP3D_SPINNER_SIZE 70 -#define BACK_BUTTON_WIDTH 50 -#define BACK_BUTTON_HEIGHT 40 -#define MATRIX_BUTTON_WIDTH 48 -#define MATRIX_BUTTON_HEIGHT 40 -#define MSGBOX_BUTTON_WIDTH 100 +#define ESP3D_BACK_BUTTON_WIDTH 50 +#define ESP3D_BACK_BUTTON_HEIGHT 40 +#define ESP3D_MATRIX_BUTTON_WIDTH 48 +#define ESP3D_MATRIX_BUTTON_HEIGHT 40 +#define ESP3D_MATRIX_BUTTON_WIDTH 100 -#define LIST_CONTAINER_LR_PAD 6 -#define LIST_LINE_HEIGHT 36 -#define LIST_LINE_BORDER_WIDTH 2 -#define LIST_LINE_BUTTON_WIDTH 40 +#define ESP3D_LIST_CONTAINER_LR_PAD 6 +#define ESP3D_LIST_LINE_HEIGHT 36 +#define ESP3D_LIST_LINE_BORDER_SIZE 2 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 40 -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 diff --git a/main/display/3dprinter/marlin/res_480_272/esp3d_styles_res.h b/main/display/3dprinter/marlin/res_480_272/esp3d_styles_res.h index b0f1df2f..175a9061 100644 --- a/main/display/3dprinter/marlin/res_480_272/esp3d_styles_res.h +++ b/main/display/3dprinter/marlin/res_480_272/esp3d_styles_res.h @@ -20,48 +20,48 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 5 -#define CURRENT_STATUS_BAR_H_PAD 5 -#define CURRENT_STATUS_BAR_V_PAD 3 -#define CURRENT_STATUS_BAR_BORDER_VALUE 1 -#define CURRENT_STATUS_AREA_HEIGHT 50 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 15) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 3 +#define ESP3D_STATUS_BAR_RADIUS 5 +#define ESP3D_STATUS_BAR_H_PAD 5 +#define ESP3D_STATUS_BAR_V_PAD 3 +#define ESP3D_STATUS_BAR_BORDER_VALUE 1 +#define ESP3D_STATUS_BAR_HEIGHT 50 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 15) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 3 -#define CURRENT_BUTTON_RADIUS_VALUE 5 -#define CURRENT_BUTTON_BORDER_VALUE 2 +#define ESP3D_BUTTON_RADIUS 5 +#define ESP3D_BUTTON_BORDER_SIZE 2 -#define CURRENT_BUTTON_PRESSED_OUTLINE 8 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 4 +#define ESP3D_BUTTON_PRESSED_OUTLINE 8 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 4 -#define CURRENT_CONTAINER_RADIUS 5 +#define ESP3D_CONTAINER_RADIUS 5 -#define BUTTON_WIDTH (LV_HOR_RES / 6) -#define BUTTON_HEIGHT BUTTON_WIDTH +#define ESP3D_BUTTON_WIDTH (LV_HOR_RES / 6) +#define ESP3D_BUTTON_HEIGHT ESP3D_BUTTON_WIDTH -#define SYMBOL_BUTTON_WIDTH 70 -#define SYMBOL_BUTTON_HEIGHT 50 +#define ESP3D_SYMBOL_BUTTON_WIDTH 70 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 50 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 300 -#endif // BUTTON_ANIMATION_DELAY +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 300 +#endif // ESP3D_BUTTON_ANIMATION_DELAY -#define CURRENT_SPINNER_SIZE 100 +#define ESP3D_SPINNER_SIZE 100 -#define BACK_BUTTON_WIDTH 70 -#define BACK_BUTTON_HEIGHT 33 -#define MATRIX_BUTTON_WIDTH 70 -#define MATRIX_BUTTON_HEIGHT 33 -#define MSGBOX_BUTTON_WIDTH 130 +#define ESP3D_BACK_BUTTON_WIDTH 70 +#define ESP3D_BACK_BUTTON_HEIGHT 33 +#define ESP3D_MATRIX_BUTTON_WIDTH 70 +#define ESP3D_MATRIX_BUTTON_HEIGHT 33 +#define ESP3D_MATRIX_BUTTON_WIDTH 130 -#define LIST_CONTAINER_LR_PAD 10 -#define LIST_LINE_HEIGHT 42 -#define LIST_LINE_BORDER_WIDTH 2 -#define LIST_LINE_BUTTON_WIDTH 50 +#define ESP3D_LIST_CONTAINER_LR_PAD 10 +#define ESP3D_LIST_LINE_HEIGHT 42 +#define ESP3D_LIST_LINE_BORDER_SIZE 2 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 50 -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 10 #define FW_LOGO_Y -1 diff --git a/main/display/3dprinter/marlin/res_480_320/esp3d_styles_res.h b/main/display/3dprinter/marlin/res_480_320/esp3d_styles_res.h index e920c267..5a51ebaf 100644 --- a/main/display/3dprinter/marlin/res_480_320/esp3d_styles_res.h +++ b/main/display/3dprinter/marlin/res_480_320/esp3d_styles_res.h @@ -20,48 +20,48 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 5 -#define CURRENT_STATUS_BAR_H_PAD 5 -#define CURRENT_STATUS_BAR_V_PAD 3 -#define CURRENT_STATUS_BAR_BORDER_VALUE 1 -#define CURRENT_STATUS_AREA_HEIGHT 50 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 15) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 3 +#define ESP3D_STATUS_BAR_RADIUS 5 +#define ESP3D_STATUS_BAR_H_PAD 5 +#define ESP3D_STATUS_BAR_V_PAD 3 +#define ESP3D_STATUS_BAR_BORDER_VALUE 1 +#define ESP3D_STATUS_BAR_HEIGHT 50 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 15) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 3 -#define CURRENT_BUTTON_RADIUS_VALUE 5 -#define CURRENT_BUTTON_BORDER_VALUE 2 +#define ESP3D_BUTTON_RADIUS 5 +#define ESP3D_BUTTON_BORDER_SIZE 2 -#define CURRENT_BUTTON_PRESSED_OUTLINE 10 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 4 +#define ESP3D_BUTTON_PRESSED_OUTLINE 10 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 4 -#define CURRENT_CONTAINER_RADIUS 5 +#define ESP3D_CONTAINER_RADIUS 5 -#define BUTTON_WIDTH (LV_HOR_RES / 6) -#define BUTTON_HEIGHT BUTTON_WIDTH +#define ESP3D_BUTTON_WIDTH (LV_HOR_RES / 6) +#define ESP3D_BUTTON_HEIGHT ESP3D_BUTTON_WIDTH -#define SYMBOL_BUTTON_WIDTH 70 -#define SYMBOL_BUTTON_HEIGHT 56 +#define ESP3D_SYMBOL_BUTTON_WIDTH 70 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 56 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 300 -#endif // BUTTON_ANIMATION_DELAY +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 300 +#endif // ESP3D_BUTTON_ANIMATION_DELAY -#define CURRENT_SPINNER_SIZE 100 +#define ESP3D_SPINNER_SIZE 100 -#define BACK_BUTTON_WIDTH 70 -#define BACK_BUTTON_HEIGHT 50 -#define MATRIX_BUTTON_WIDTH 70 -#define MATRIX_BUTTON_HEIGHT 50 -#define MSGBOX_BUTTON_WIDTH 130 +#define ESP3D_BACK_BUTTON_WIDTH 70 +#define ESP3D_BACK_BUTTON_HEIGHT 50 +#define ESP3D_MATRIX_BUTTON_WIDTH 70 +#define ESP3D_MATRIX_BUTTON_HEIGHT 50 +#define ESP3D_MATRIX_BUTTON_WIDTH 130 -#define LIST_CONTAINER_LR_PAD 10 -#define LIST_LINE_HEIGHT 45 -#define LIST_LINE_BORDER_WIDTH 3 -#define LIST_LINE_BUTTON_WIDTH 50 +#define ESP3D_LIST_CONTAINER_LR_PAD 10 +#define ESP3D_LIST_LINE_HEIGHT 45 +#define ESP3D_LIST_LINE_BORDER_SIZE 3 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 50 -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 10 #define FW_LOGO_Y -10 \ No newline at end of file diff --git a/main/display/3dprinter/marlin/res_800_480/esp3d_styles_res.h b/main/display/3dprinter/marlin/res_800_480/esp3d_styles_res.h index 4139bed0..d8a3c5bd 100644 --- a/main/display/3dprinter/marlin/res_800_480/esp3d_styles_res.h +++ b/main/display/3dprinter/marlin/res_800_480/esp3d_styles_res.h @@ -20,44 +20,61 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 10 -#define CURRENT_STATUS_BAR_H_PAD 10 -#define CURRENT_STATUS_BAR_V_PAD 4 -#define CURRENT_STATUS_BAR_BORDER_VALUE 2 -#define CURRENT_STATUS_AREA_HEIGHT 80 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 30) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 3 - -#define CURRENT_BUTTON_RADIUS_VALUE 10 -#define CURRENT_BUTTON_BORDER_VALUE 2 - -#define CURRENT_BUTTON_PRESSED_OUTLINE 20 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 10 - -#define CURRENT_CONTAINER_RADIUS 10 - -#define BUTTON_WIDTH (LV_HOR_RES / 6) -#define BUTTON_HEIGHT BUTTON_WIDTH - -#define SYMBOL_BUTTON_WIDTH 100 -#define SYMBOL_BUTTON_HEIGHT 85 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 300 -#endif // BUTTON_ANIMATION_DELAY - -#define CURRENT_SPINNER_SIZE 100 - -#define BACK_BUTTON_WIDTH 100 -#define BACK_BUTTON_HEIGHT 75 -#define MATRIX_BUTTON_WIDTH 100 -#define MATRIX_BUTTON_HEIGHT 75 -#define MSGBOX_BUTTON_WIDTH 220 - -#define LIST_CONTAINER_LR_PAD 20 -#define LIST_LINE_HEIGHT 64 -#define LIST_LINE_BORDER_WIDTH 4 -#define LIST_LINE_BUTTON_WIDTH 80 - -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 \ No newline at end of file +//Styles for common controls + +//Back button size +#define ESP3D_BACK_BUTTON_WIDTH 100 +#define ESP3D_BACK_BUTTON_HEIGHT 75 + +//Buttons +#define ESP3D_BUTTON_RADIUS 10 +#define ESP3D_BUTTON_BORDER_SIZE 2 +#define ESP3D_BUTTON_PRESSED_OUTLINE 20 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 10 +#define ESP3D_BUTTON_WIDTH (LV_HOR_RES / 6) +#define ESP3D_BUTTON_HEIGHT ESP3D_BUTTON_WIDTH +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 300 +#endif // ESP3D_BUTTON_ANIMATION_DELAY + +//Symbol buttons +#define ESP3D_SYMBOL_BUTTON_WIDTH 100 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 85 + +//Matrix buttons +#define ESP3D_MATRIX_BUTTON_WIDTH 100 +#define ESP3D_MATRIX_BUTTON_HEIGHT 75 + +//Message box buttons +#define ESP3D_MSGBOX_BUTTON_WIDTH 220 + +//Spinner size +#define ESP3D_SPINNER_SIZE 100 + +//List styles +#define ESP3D_LIST_CONTAINER_LR_PAD 20 +#define ESP3D_LIST_LINE_HEIGHT 64 +#define ESP3D_LIST_LINE_BORDER_SIZE 4 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 80 + +//Container styles +#define ESP3D_CONTAINER_RADIUS 10 + +//Scroll bar styles +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 + +//Choice List styles +#define ESP3D_CHOICE_LIST_WIDTH (LV_HOR_RES / 3) + +//Status bar styles +#define ESP3D_STATUS_BAR_RADIUS 10 +#define ESP3D_STATUS_BAR_H_PAD 10 +#define ESP3D_STATUS_BAR_V_PAD 4 +#define ESP3D_STATUS_BAR_BORDER_VALUE 2 +#define ESP3D_STATUS_BAR_HEIGHT 80 +#define ESP3D_STATUS_BAR_WIDTH (LV_HOR_RES - (2 * 30)) + + + diff --git a/main/display/3dprinter/marlin/screens/auto_leveling_screen.cpp b/main/display/3dprinter/marlin/screens/auto_leveling_screen.cpp index 9eba2990..f5f5b072 100644 --- a/main/display/3dprinter/marlin/screens/auto_leveling_screen.cpp +++ b/main/display/3dprinter/marlin/screens/auto_leveling_screen.cpp @@ -159,7 +159,7 @@ bool auto_leveling_value_cb(ESP3DValuesIndex index, const char *value, for (uint8_t i = 0; i <= col; i++) { lv_table_set_col_width( auto_leveling_screen_table, i, - ((LV_HOR_RES) - (2 * CURRENT_BUTTON_PRESSED_OUTLINE)) / + ((LV_HOR_RES) - (2 * ESP3D_BUTTON_PRESSED_OUTLINE)) / (col + 1)); } } @@ -186,13 +186,13 @@ bool auto_leveling_value_cb(ESP3DValuesIndex index, const char *value, if (max_col != -1 && col == max_col && row == 1) { esp3d_log( "Max col found is:%d, col wdith:%d", max_col, - ((LV_HOR_RES) - (2 * CURRENT_BUTTON_PRESSED_OUTLINE)) / max_col); + ((LV_HOR_RES) - (2 * ESP3D_BUTTON_PRESSED_OUTLINE)) / max_col); lv_table_set_col_cnt(auto_leveling_screen_table, max_col + 1); for (uint8_t i = 0; i <= max_col; i++) { lv_table_set_col_width( auto_leveling_screen_table, i, - ((LV_HOR_RES) - (2 * CURRENT_BUTTON_PRESSED_OUTLINE)) / + ((LV_HOR_RES) - (2 * ESP3D_BUTTON_PRESSED_OUTLINE)) / (max_col + 1)); } } @@ -242,10 +242,10 @@ void event_button_auto_leveling_start_handler(lv_event_t *e) { void event_button_fan_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (auto_leveling_screen_delay_timer) return; auto_leveling_screen_delay_timer = lv_timer_create( - auto_leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + auto_leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { auto_leveling_screen_delay_timer_cb(NULL); } @@ -263,26 +263,26 @@ void auto_leveling_screen() { lv_obj_del(ui_current_screen); homing_done = false; - btn_back = backButton::create_back_button(ui_new_screen); + btn_back = backButton::create(ui_new_screen); lv_obj_add_event_cb(btn_back, event_button_fan_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_update_layout(btn_back); // Create a table auto_leveling_screen_table = lv_table_create(ui_new_screen); lv_obj_set_size(auto_leveling_screen_table, - (LV_HOR_RES) - (2 * CURRENT_BUTTON_PRESSED_OUTLINE), - LV_VER_RES - (3 * CURRENT_BUTTON_PRESSED_OUTLINE) - + (LV_HOR_RES) - (2 * ESP3D_BUTTON_PRESSED_OUTLINE), + LV_VER_RES - (3 * ESP3D_BUTTON_PRESSED_OUTLINE) - lv_obj_get_height(btn_back)); - lv_obj_set_pos(auto_leveling_screen_table, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(auto_leveling_screen_table, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_clear_flag(auto_leveling_screen_table, LV_OBJ_FLAG_SCROLL_ELASTIC); lv_obj_set_style_radius(auto_leveling_screen_table, - CURRENT_BUTTON_RADIUS_VALUE, 0); + ESP3D_BUTTON_RADIUS , 0); // button start btn_start = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_PLAY, BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_PLAY, ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); lv_obj_align_to(btn_start, auto_leveling_screen_table, - LV_ALIGN_OUT_BOTTOM_MID, 0, CURRENT_BUTTON_PRESSED_OUTLINE); + LV_ALIGN_OUT_BOTTOM_MID, 0, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_add_event_cb(btn_start, event_button_auto_leveling_start_handler, LV_EVENT_CLICKED, NULL); @@ -291,9 +291,9 @@ void auto_leveling_screen() { ESP3DStyle::apply(label_status, ESP3DStyleType::bg_label); lv_label_set_text(label_status, ""); lv_obj_align_to(label_status, auto_leveling_screen_table, - LV_ALIGN_OUT_BOTTOM_LEFT, 0, CURRENT_BUTTON_PRESSED_OUTLINE); + LV_ALIGN_OUT_BOTTOM_LEFT, 0, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_set_width(label_status, LV_HOR_RES - - (3 * CURRENT_BUTTON_PRESSED_OUTLINE) - + (3 * ESP3D_BUTTON_PRESSED_OUTLINE) - lv_obj_get_width(btn_start)); lv_label_set_long_mode(label_status, LV_LABEL_LONG_SCROLL_CIRCULAR); esp3dTftui.set_current_screen(ESP3DScreenType::auto_leveling); diff --git a/main/display/3dprinter/marlin/screens/fan_screen.cpp b/main/display/3dprinter/marlin/screens/fan_screen.cpp index 320c925f..4bc7e6bf 100644 --- a/main/display/3dprinter/marlin/screens/fan_screen.cpp +++ b/main/display/3dprinter/marlin/screens/fan_screen.cpp @@ -92,14 +92,14 @@ bool updateBtnMatrix() { ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); - lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); + lv_obj_set_size(btnm_target, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); esp3d_log("child count: %d", i); // lv_obj_add_state(obj, LV_STATE_DISABLED); if (fan_buttons_map_id > i) fan_buttons_map_id = 0; lv_btnmatrix_set_btn_ctrl(btnm_target, fan_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align_to(btnm_target, btnback, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); return true; } @@ -113,10 +113,10 @@ void fan_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_fan_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (fan_screen_delay_timer) return; fan_screen_delay_timer = lv_timer_create(fan_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { fan_screen_delay_timer_cb(NULL); } @@ -308,7 +308,7 @@ void fan_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - btnback = backButton::create_back_button(ui_new_screen); + btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_fan_back_handler, LV_EVENT_CLICKED, NULL); @@ -318,9 +318,9 @@ void fan_screen() { ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(fan_steps_buttons_map) / sizeof(fan_steps_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, fan_steps_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_add_event_cb(btnm, fan_steps_matrix_buttons_event_cb, @@ -331,7 +331,7 @@ void fan_screen() { lv_label_set_text(label_current_fan, fan_buttons_map[fan_buttons_map_id]); ESP3DStyle::apply(label_current_fan, ESP3DStyleType::bg_label); lv_obj_align(label_current_fan, LV_ALIGN_TOP_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_fan); // Current Fan value @@ -343,7 +343,7 @@ void fan_screen() { ESP3DStyle::apply(label_current_fan_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_fan_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_fan_value, label_current_fan, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit @@ -351,13 +351,13 @@ void fan_screen() { lv_label_set_text(label_unit1, "%"); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_fan_value, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_UP "\n" LV_SYMBOL_PLUS); lv_obj_align_to(btn_up, label_current_fan_value, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // fan input lv_obj_t *fan_ta = lv_textarea_create(ui_new_screen); lv_obj_add_event_cb(fan_ta, fan_ta_event_cb, LV_EVENT_VALUE_CHANGED, NULL); @@ -368,27 +368,27 @@ void fan_screen() { lv_obj_set_style_text_align(fan_ta, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_width(fan_ta, LV_HOR_RES / 6); lv_obj_align_to(fan_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_FAN); ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_align_to(label_ta, fan_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, "%"); ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, fan_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // button down lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, fan_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, fan_btn_down_event_cb, LV_EVENT_CLICKED, fan_ta); @@ -398,14 +398,14 @@ void fan_screen() { lv_obj_t *btn_ok = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_OK); lv_obj_align_to(btn_ok, label_unit2, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_ok, fan_btn_ok_event_cb, LV_EVENT_CLICKED, fan_ta); // Button Reset lv_obj_t *btn_reset = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_POWER); lv_obj_align_to(btn_reset, btn_ok, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_reset, fan_btn_reset_event_cb, LV_EVENT_CLICKED, fan_ta); @@ -414,11 +414,11 @@ void fan_screen() { lv_keyboard_set_mode(fan_kb, LV_KEYBOARD_MODE_NUMBER); lv_keyboard_set_textarea(fan_kb, NULL); lv_obj_align_to(fan_kb, fan_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_update_layout(fan_kb); lv_obj_set_content_width(fan_kb, LV_HOR_RES - lv_obj_get_x(fan_kb) - - 2 * CURRENT_BUTTON_PRESSED_OUTLINE); - lv_obj_set_style_radius(fan_kb, CURRENT_BUTTON_RADIUS_VALUE, LV_PART_MAIN); + 2 * ESP3D_BUTTON_PRESSED_OUTLINE); + lv_obj_set_style_radius(fan_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(fan_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(fan_ta, fan_ta_event_cb, LV_EVENT_ALL, fan_kb); diff --git a/main/display/3dprinter/marlin/screens/filament_screen.cpp b/main/display/3dprinter/marlin/screens/filament_screen.cpp index 5e277be1..149de819 100644 --- a/main/display/3dprinter/marlin/screens/filament_screen.cpp +++ b/main/display/3dprinter/marlin/screens/filament_screen.cpp @@ -94,14 +94,14 @@ bool updateBtnMatrix() { ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); - lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); + lv_obj_set_size(btnm_target, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); esp3d_log("child count: %d", i); // lv_obj_add_state(obj, LV_STATE_DISABLED); if (filament_buttons_map_id > i) filament_buttons_map_id = 0; lv_btnmatrix_set_btn_ctrl(btnm_target, filament_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align_to(btnm_target, btnback, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); return true; } @@ -124,10 +124,10 @@ void filament_screen_edit_delay_timer_cb(lv_timer_t *timer) { void event_button_filament_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (filament_screen_delay_timer) return; filament_screen_delay_timer = lv_timer_create( - filament_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + filament_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { filament_screen_delay_timer_cb(NULL); } @@ -135,10 +135,10 @@ void event_button_filament_back_handler(lv_event_t *e) { void event_button_filament_edit_handler(lv_event_t *e) { esp3d_log("edit Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (filament_screen_delay_timer) return; filament_screen_delay_timer = lv_timer_create( - filament_screen_edit_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + filament_screen_edit_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { filament_screen_edit_delay_timer_cb(NULL); } @@ -292,7 +292,7 @@ void filament_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - btnback = backButton::create_back_button(ui_new_screen); + btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_filament_back_handler, LV_EVENT_CLICKED, NULL); @@ -303,9 +303,9 @@ void filament_screen() { size_t i = (sizeof(filament_distance_steps_buttons_map) / sizeof(filament_distance_steps_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, filament_distance_steps_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); @@ -321,8 +321,8 @@ void filament_screen() { lv_obj_set_style_transform_angle(label_ta, 900, 0); lv_obj_update_layout(label_ta); - size_t x = lv_obj_get_width(label_ta) + (2 * CURRENT_BUTTON_PRESSED_OUTLINE); - size_t y = MATRIX_BUTTON_HEIGHT + CURRENT_BUTTON_PRESSED_OUTLINE; + size_t x = lv_obj_get_width(label_ta) + (2 * ESP3D_BUTTON_PRESSED_OUTLINE); + size_t y = ESP3D_MATRIX_BUTTON_HEIGHT + ESP3D_BUTTON_PRESSED_OUTLINE; // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( @@ -342,14 +342,14 @@ void filament_screen() { lv_obj_set_style_text_align(filament_ta, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_width(filament_ta, LV_HOR_RES / 6); lv_obj_align_to(filament_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btnm, filament_distance_steps_matrix_buttons_event_cb, LV_EVENT_VALUE_CHANGED, filament_ta); // Text area label lv_obj_align_to(label_ta, filament_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); @@ -357,7 +357,7 @@ void filament_screen() { esp3dTranslationService.translate(ESP3DLabel::millimeters)); ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, filament_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Current filament label label_current_temperature_filament = lv_label_create(ui_new_screen); @@ -365,7 +365,7 @@ void filament_screen() { filament_buttons_map[filament_buttons_map_id]); ESP3DStyle::apply(label_current_temperature_filament, ESP3DStyleType::bg_label); lv_obj_align_to(label_current_temperature_filament, label_unit2, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE * 3, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE * 3, 0); lv_obj_update_layout(label_current_temperature_filament); @@ -384,7 +384,7 @@ void filament_screen() { lv_obj_set_width(label_current_temperature_filament_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_temperature_filament_value, label_current_temperature_filament, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); @@ -392,13 +392,13 @@ void filament_screen() { esp3dTranslationService.translate(ESP3DLabel::celsius)); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_temperature_filament_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_t *btn_edit = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_EDIT); lv_obj_align_to(btn_edit, label_unit1, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_add_event_cb(btn_edit, event_button_filament_edit_handler, LV_EVENT_CLICKED, NULL); @@ -406,7 +406,7 @@ void filament_screen() { lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, filament_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, filament_btn_down_event_cb, LV_EVENT_CLICKED, filament_ta); @@ -418,11 +418,11 @@ void filament_screen() { lv_keyboard_set_mode(filament_kb, LV_KEYBOARD_MODE_NUMBER); lv_keyboard_set_textarea(filament_kb, NULL); lv_obj_align_to(filament_kb, filament_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_update_layout(filament_kb); lv_obj_set_content_width(filament_kb, LV_HOR_RES - lv_obj_get_x(filament_kb) - - 2 * CURRENT_BUTTON_PRESSED_OUTLINE); - lv_obj_set_style_radius(filament_kb, CURRENT_BUTTON_RADIUS_VALUE, + 2 * ESP3D_BUTTON_PRESSED_OUTLINE); + lv_obj_set_style_radius(filament_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(filament_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(filament_ta, filament_ta_event_cb, LV_EVENT_ALL, diff --git a/main/display/3dprinter/marlin/screens/informations_screen.cpp b/main/display/3dprinter/marlin/screens/informations_screen.cpp index 5b58aa87..6a30d172 100644 --- a/main/display/3dprinter/marlin/screens/informations_screen.cpp +++ b/main/display/3dprinter/marlin/screens/informations_screen.cpp @@ -64,10 +64,10 @@ void informations_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_informations_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (informations_screen_delay_timer) return; informations_screen_delay_timer = lv_timer_create( - informations_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + informations_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else informations_screen_delay_timer_cb(NULL); } @@ -97,7 +97,7 @@ void informations_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_informations_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_update_layout(btnback); @@ -107,16 +107,16 @@ void informations_screen() { ESP3DStyle::apply(ui_info_list_ctl, ESP3DStyleType::status_list); lv_obj_update_layout(ui_new_screen); - lv_obj_set_pos(ui_info_list_ctl, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(ui_info_list_ctl, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_set_size( - ui_info_list_ctl, LV_HOR_RES - CURRENT_BUTTON_PRESSED_OUTLINE * 2, - lv_obj_get_height(ui_new_screen) - (CURRENT_BUTTON_PRESSED_OUTLINE * 3) - + ui_info_list_ctl, LV_HOR_RES - ESP3D_BUTTON_PRESSED_OUTLINE * 2, + lv_obj_get_height(ui_new_screen) - (ESP3D_BUTTON_PRESSED_OUTLINE * 3) - lv_obj_get_height(btnback)); - lv_obj_set_style_radius(ui_info_list_ctl, CURRENT_CONTAINER_RADIUS, 0); - lv_obj_set_style_pad_left(ui_info_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_radius(ui_info_list_ctl, ESP3D_CONTAINER_RADIUS, 0); + lv_obj_set_style_pad_left(ui_info_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); - lv_obj_set_style_pad_right(ui_info_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_right(ui_info_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); addInformationToList(ui_info_list_ctl, ESP3DLabel::screen, TFT_TARGET); diff --git a/main/display/3dprinter/marlin/screens/leveling_screen.cpp b/main/display/3dprinter/marlin/screens/leveling_screen.cpp index 8c36e052..006e32a5 100644 --- a/main/display/3dprinter/marlin/screens/leveling_screen.cpp +++ b/main/display/3dprinter/marlin/screens/leveling_screen.cpp @@ -72,10 +72,10 @@ void event_button_leveling_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); if (leveling_screen_delay_timer) return; leveling_next_screen = ESP3DScreenType::menu; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (leveling_screen_delay_timer) return; leveling_screen_delay_timer = lv_timer_create( - leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { leveling_screen_delay_timer_cb(NULL); } @@ -85,10 +85,10 @@ void event_button_manual_handler(lv_event_t *e) { esp3d_log("MANUAL Clicked"); if (leveling_screen_delay_timer) return; leveling_next_screen = ESP3DScreenType::manual_leveling; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (leveling_screen_delay_timer) return; leveling_screen_delay_timer = lv_timer_create( - leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { leveling_screen_delay_timer_cb(NULL); } @@ -98,10 +98,10 @@ void event_button_auto_handler(lv_event_t *e) { esp3d_log("AUTO Clicked"); if (leveling_screen_delay_timer) return; leveling_next_screen = ESP3DScreenType::auto_leveling; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (leveling_screen_delay_timer) return; leveling_screen_delay_timer = lv_timer_create( - leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { leveling_screen_delay_timer_cb(NULL); } @@ -119,7 +119,7 @@ void leveling_screen(bool autoleveling) { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - btnback = backButton::create_back_button(ui_new_screen); + btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_leveling_back_handler, LV_EVENT_CLICKED, NULL); @@ -137,13 +137,13 @@ void leveling_screen(bool autoleveling) { // Create button and label for manual leveling btn = symbolButton::create_symbol_button( ui_buttons_container, LV_SYMBOL_MANUAL "\n" LV_SYMBOL_LEVELING, - BUTTON_WIDTH, BUTTON_WIDTH); + ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_WIDTH); lv_obj_add_event_cb(btn, event_button_manual_handler, LV_EVENT_CLICKED, NULL); // Create button and label for auto leveling btn = symbolButton::create_symbol_button( ui_buttons_container, LV_SYMBOL_AUTOMATIC "\n" LV_SYMBOL_LEVELING, - BUTTON_WIDTH, BUTTON_WIDTH); + ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_WIDTH); lv_obj_add_event_cb(btn, event_button_auto_handler, LV_EVENT_CLICKED, NULL); esp3dTftui.set_current_screen(ESP3DScreenType::leveling); } diff --git a/main/display/3dprinter/marlin/screens/main_screen.cpp b/main/display/3dprinter/marlin/screens/main_screen.cpp index f16ea93f..ba604ca3 100644 --- a/main/display/3dprinter/marlin/screens/main_screen.cpp +++ b/main/display/3dprinter/marlin/screens/main_screen.cpp @@ -507,10 +507,10 @@ void event_button_E0_handler(lv_event_t *e) { if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::temperatures; main_screen_temperature_target = 0; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -521,10 +521,10 @@ void event_button_E1_handler(lv_event_t *e) { if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::temperatures; main_screen_temperature_target = 1; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -535,10 +535,10 @@ void event_button_Bed_handler(lv_event_t *e) { if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::temperatures; main_screen_temperature_target = 2; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -548,10 +548,10 @@ void event_button_positions_handler(lv_event_t *e) { esp3d_log("Positions Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::positions; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -561,10 +561,10 @@ void event_button_fan_handler(lv_event_t *e) { esp3d_log("Fan Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::fan; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -574,10 +574,10 @@ void event_button_speed_handler(lv_event_t *e) { esp3d_log("Speed Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::speed; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -588,10 +588,10 @@ void event_button_files_handler(lv_event_t *e) { esp3d_log("Files Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::files; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -602,10 +602,10 @@ void event_button_menu_handler(lv_event_t *e) { esp3d_log("Menu Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::menu; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else main_screen_delay_timer_cb(NULL); } @@ -716,7 +716,7 @@ void main_screen() { // Create button and label for positions main_btn_positions = symbolButton::create_symbol_button( - ui_top_buttons_container, "", BUTTON_WIDTH * 1.5, BUTTON_HEIGHT); + ui_top_buttons_container, "", ESP3D_BUTTON_WIDTH * 1.5, ESP3D_BUTTON_HEIGHT); lv_obj_add_event_cb(main_btn_positions, event_button_positions_handler, LV_EVENT_CLICKED, NULL); @@ -726,8 +726,8 @@ void main_screen() { ESP3DStyle::apply(main_label_progression_area, ESP3DStyleType::status_bar); lv_obj_center(main_label_progression_area); - lv_obj_set_size(main_label_progression_area, CURRENT_STATUS_AREA_WIDTH, - CURRENT_STATUS_AREA_HEIGHT); + lv_obj_set_size(main_label_progression_area, ESP3D_STATUS_BAR_WIDTH, + ESP3D_STATUS_BAR_HEIGHT); if (show_fan_button) { // Create button and label for fan main_btn_fan = diff --git a/main/display/3dprinter/marlin/screens/manual_leveling_screen.cpp b/main/display/3dprinter/marlin/screens/manual_leveling_screen.cpp index fbf5e613..57a07185 100644 --- a/main/display/3dprinter/marlin/screens/manual_leveling_screen.cpp +++ b/main/display/3dprinter/marlin/screens/manual_leveling_screen.cpp @@ -84,10 +84,10 @@ void manual_leveling_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_manual_leveling_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (manual_leveling_screen_delay_timer) return; manual_leveling_screen_delay_timer = lv_timer_create( - manual_leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + manual_leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { manual_leveling_screen_delay_timer_cb(NULL); } @@ -372,7 +372,7 @@ void manual_leveling_screen(bool autoleveling) { lv_obj_del(ui_current_screen); // Button back - lv_obj_t *btn_back = backButton::create_back_button(ui_new_screen); + lv_obj_t *btn_back = backButton::create(ui_new_screen); lv_obj_add_event_cb(btn_back, event_button_manual_leveling_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_update_layout(btn_back); @@ -382,10 +382,10 @@ void manual_leveling_screen(bool autoleveling) { lv_btnmatrix_set_map(btnm_leveling_position, leveling_position_buttons_map); ESP3DStyle::apply(btnm_leveling_position, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_leveling_position); - lv_obj_set_pos(btnm_leveling_position, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(btnm_leveling_position, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_set_size(btnm_leveling_position, LV_HOR_RES / 2, - LV_VER_RES - (CURRENT_BUTTON_PRESSED_OUTLINE * 3) - + LV_VER_RES - (ESP3D_BUTTON_PRESSED_OUTLINE * 3) - lv_obj_get_height(btn_back)); lv_obj_add_event_cb(btnm_leveling_position, leveling_posiiton_matrix_buttons_event_cb, @@ -393,34 +393,34 @@ void manual_leveling_screen(bool autoleveling) { // Button Previous btn_previous = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_PREVIOUS, BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_PREVIOUS, ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); lv_obj_align(btn_previous, LV_ALIGN_BOTTOM_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, -CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, -ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_add_event_cb(btn_previous, event_button_manual_leveling_previous_handler, LV_EVENT_CLICKED, btnm_leveling_position); // Button Next btn_next = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_NEXT, BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_NEXT, ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); lv_obj_align_to(btn_next, btnm_leveling_position, LV_ALIGN_OUT_BOTTOM_RIGHT, - 0, CURRENT_BUTTON_PRESSED_OUTLINE); + 0, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_add_event_cb(btn_next, event_button_manual_leveling_next_handler, LV_EVENT_CLICKED, btnm_leveling_position); // Help button lv_obj_t *btn_help = symbolButton::create_symbol_button( - ui_new_screen, "?", BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); - lv_obj_align(btn_help, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + ui_new_screen, "?", ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); + lv_obj_align(btn_help, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_add_event_cb(btn_help, event_button_manual_leveling_help_handler, LV_EVENT_CLICKED, NULL); // Start button btn_start = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_PLAY); lv_obj_align_to(btn_start, btnm_leveling_position, LV_ALIGN_OUT_RIGHT_MID, - (LV_HOR_RES / 4) - SYMBOL_BUTTON_WIDTH / 2, 0); + (LV_HOR_RES / 4) - ESP3D_SYMBOL_BUTTON_WIDTH / 2, 0); lv_obj_add_event_cb(btn_start, event_button_manual_leveling_start_handler, LV_EVENT_CLICKED, btnm_leveling_position); @@ -429,11 +429,11 @@ void manual_leveling_screen(bool autoleveling) { ESP3DStyle::apply(status_container, ESP3DStyleType::text_container); lv_obj_set_size(status_container, - (LV_HOR_RES / 2) - (3 * CURRENT_BUTTON_PRESSED_OUTLINE), - LV_VER_RES - (CURRENT_BUTTON_PRESSED_OUTLINE * 4) - + (LV_HOR_RES / 2) - (3 * ESP3D_BUTTON_PRESSED_OUTLINE), + LV_VER_RES - (ESP3D_BUTTON_PRESSED_OUTLINE * 4) - lv_obj_get_height(btn_back) * 2); lv_obj_align_to(status_container, btn_help, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); // status text std::string t = diff --git a/main/display/3dprinter/marlin/screens/menu_screen.cpp b/main/display/3dprinter/marlin/screens/menu_screen.cpp index 85383e6e..9d6a50d5 100644 --- a/main/display/3dprinter/marlin/screens/menu_screen.cpp +++ b/main/display/3dprinter/marlin/screens/menu_screen.cpp @@ -133,10 +133,10 @@ void event_button_menu_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::main; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { menu_screen_delay_timer_cb(NULL); } @@ -146,10 +146,10 @@ void event_button_filament_handler(lv_event_t *e) { esp3d_log("filament Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::filament; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { menu_screen_delay_timer_cb(NULL); } @@ -160,10 +160,10 @@ void event_button_wifi_handler(lv_event_t *e) { esp3d_log("wifi Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::wifi; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { menu_screen_delay_timer_cb(NULL); } @@ -174,10 +174,10 @@ void event_button_settings_handler(lv_event_t *e) { esp3d_log("settings Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::settings; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else menu_screen_delay_timer_cb(NULL); } @@ -186,10 +186,10 @@ void event_button_leveling_handler(lv_event_t *e) { esp3d_log("leveling Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::leveling; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else menu_screen_delay_timer_cb(NULL); } @@ -198,10 +198,10 @@ void event_button_informations_handler(lv_event_t *e) { esp3d_log("informations Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::informations; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else menu_screen_delay_timer_cb(NULL); } @@ -234,7 +234,7 @@ void menu_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_menu_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_t *ui_main_container = mainContainer::create_main_container( @@ -258,7 +258,7 @@ void menu_screen() { // Create button and label for filament button lv_obj_t *btn1 = symbolButton::create_symbol_button( - ui_top_buttons_container, LV_SYMBOL_FILAMENT, BUTTON_WIDTH, BUTTON_HEIGHT, + ui_top_buttons_container, LV_SYMBOL_FILAMENT, ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_HEIGHT, true, false, 90); lv_obj_add_event_cb(btn1, event_button_filament_handler, LV_EVENT_CLICKED, NULL); @@ -272,7 +272,7 @@ void menu_screen() { // Create button and label for disable steppers button main_btn_disable_steppers = symbolButton::create_symbol_button( - ui_top_buttons_container, LV_SYMBOL_ENGINE, BUTTON_WIDTH, BUTTON_HEIGHT, + ui_top_buttons_container, LV_SYMBOL_ENGINE, ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_HEIGHT, true, true, 90); lv_obj_add_event_cb(main_btn_disable_steppers, event_button_disable_steppers_handler, LV_EVENT_CLICKED, diff --git a/main/display/3dprinter/marlin/screens/positions_screen.cpp b/main/display/3dprinter/marlin/screens/positions_screen.cpp index 44b60999..543ca46c 100644 --- a/main/display/3dprinter/marlin/screens/positions_screen.cpp +++ b/main/display/3dprinter/marlin/screens/positions_screen.cpp @@ -93,10 +93,10 @@ void positions_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_positions_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (positions_screen_delay_timer) return; positions_screen_delay_timer = lv_timer_create( - positions_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + positions_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { positions_screen_delay_timer_cb(NULL); } @@ -312,7 +312,7 @@ void positions_screen(uint8_t target_id) { lv_obj_del(ui_current_screen); // back button - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_positions_back_handler, LV_EVENT_CLICKED, NULL); @@ -322,9 +322,9 @@ void positions_screen(uint8_t target_id) { ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(positions_buttons_map) / sizeof(positions_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, positions_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_add_event_cb(btnm, positions_matrix_buttons_event_cb, @@ -335,18 +335,18 @@ void positions_screen(uint8_t target_id) { lv_btnmatrix_set_map(btnm_target, axis_buttons_map); ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); size_t i2 = (sizeof(axis_buttons_map) / sizeof(axis_buttons_map[0])) - 1; - lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i2, MATRIX_BUTTON_HEIGHT); + lv_obj_set_size(btnm_target, ESP3D_MATRIX_BUTTON_WIDTH * i2, ESP3D_MATRIX_BUTTON_HEIGHT); lv_btnmatrix_set_btn_ctrl(btnm_target, axis_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align_to(btnm_target, btnback, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); // Home all axis lv_obj_t *btn_home_all = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_HOME "xyz", MATRIX_BUTTON_WIDTH, - MATRIX_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_HOME "xyz", ESP3D_MATRIX_BUTTON_WIDTH, + ESP3D_MATRIX_BUTTON_HEIGHT); lv_obj_align_to(btn_home_all, btnm_target, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); // Label current axis label_current_position = lv_label_create(ui_new_screen); @@ -355,7 +355,7 @@ void positions_screen(uint8_t target_id) { // according axis ESP3DStyle::apply(label_current_position, ESP3DStyleType::bg_label); lv_obj_align(label_current_position, LV_ALIGN_TOP_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_position); // Label current axis e @@ -386,7 +386,7 @@ void positions_screen(uint8_t target_id) { ESP3DStyle::apply(label_current_position_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_position_value, LV_HOR_RES / 5); lv_obj_align_to(label_current_position_value, label_current_position, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); @@ -394,13 +394,13 @@ void positions_screen(uint8_t target_id) { esp3dTranslationService.translate(ESP3DLabel::millimeters)); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_position_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_UP "\n" LV_SYMBOL_PLUS); lv_obj_align_to(btn_up, label_current_position_value, LV_ALIGN_OUT_BOTTOM_MID, - 0, CURRENT_BUTTON_PRESSED_OUTLINE); + 0, ESP3D_BUTTON_PRESSED_OUTLINE); // Text area position_ta = lv_textarea_create(ui_new_screen); lv_obj_add_event_cb(position_ta, position_ta_event_cb, LV_EVENT_VALUE_CHANGED, @@ -419,7 +419,7 @@ void positions_screen(uint8_t target_id) { lv_obj_set_width(position_ta, LV_HOR_RES / 5); lv_obj_align_to(position_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_up, positions_btn_up_event_cb, LV_EVENT_CLICKED, position_ta); @@ -431,7 +431,7 @@ void positions_screen(uint8_t target_id) { // axis ESP3DStyle::apply(label_target, ESP3DStyleType::bg_label); lv_obj_align_to(label_target, position_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); @@ -440,18 +440,18 @@ void positions_screen(uint8_t target_id) { ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, position_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // set button btn_set = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_OK); lv_obj_align_to(btn_set, label_unit2, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_set, positions_btn_ok_event_cb, LV_EVENT_CLICKED, position_ta); // Home axis lv_obj_t *btn_home_axis = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_HOME); lv_obj_align_to(btn_home_axis, btn_set, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_home_axis, positions_btn_home_axis_event_cb, LV_EVENT_CLICKED, position_ta); lv_obj_add_event_cb(btn_home_all, home_all_axis_button_event_cb, @@ -469,7 +469,7 @@ void positions_screen(uint8_t target_id) { &absolute_position); lv_obj_align_to(btn_mode, btnm, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // Keyboard lv_obj_t *positions_kb = lv_keyboard_create(ui_new_screen); @@ -478,11 +478,11 @@ void positions_screen(uint8_t target_id) { lv_obj_update_layout(label_unit2); lv_obj_set_content_width(positions_kb, LV_HOR_RES - (lv_obj_get_x(label_unit2) + - CURRENT_BUTTON_PRESSED_OUTLINE)); + ESP3D_BUTTON_PRESSED_OUTLINE)); lv_obj_align_to(positions_kb, position_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2); - lv_obj_set_style_radius(positions_kb, CURRENT_BUTTON_RADIUS_VALUE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2, + -ESP3D_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_style_radius(positions_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(positions_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(position_ta, position_ta_event_cb, LV_EVENT_ALL, @@ -491,7 +491,7 @@ void positions_screen(uint8_t target_id) { lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, position_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, positions_btn_down_event_cb, LV_EVENT_CLICKED, position_ta); updateMode(absolute_position); diff --git a/main/display/3dprinter/marlin/screens/settings_screen.cpp b/main/display/3dprinter/marlin/screens/settings_screen.cpp index 7601a4ac..0e0b3685 100644 --- a/main/display/3dprinter/marlin/screens/settings_screen.cpp +++ b/main/display/3dprinter/marlin/screens/settings_screen.cpp @@ -556,7 +556,7 @@ void event_button_edit_setting_cb(lv_event_t *e) { } data.value = lv_label_get_text(data.label); if (data.choices.size() > 0) { - choiceEditor::create_choice_editor(lv_scr_act(), data.value.c_str(), + choiceEditor::create(lv_scr_act(), data.value.c_str(), title.c_str(), data.choices, setting_edit_done_cb, (void *)(&data)); } else { @@ -598,10 +598,10 @@ void event_button_edit_setting_cb(lv_event_t *e) { // event_button_settings_back_handler void event_button_settings_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (settings_screen_delay_timer) return; settings_screen_delay_timer = lv_timer_create( - settings_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + settings_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { settings_screen_delay_timer_cb(NULL); } @@ -618,32 +618,32 @@ void settings_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_settings_back_handler, LV_EVENT_CLICKED, NULL); ui_settings_list_ctl = lv_list_create(ui_new_screen); lv_obj_clear_flag(ui_settings_list_ctl, LV_OBJ_FLAG_SCROLL_ELASTIC); - lv_obj_set_style_pad_left(ui_settings_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_left(ui_settings_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); - lv_obj_set_style_pad_right(ui_settings_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_right(ui_settings_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); lv_obj_set_size( - ui_settings_list_ctl, LV_HOR_RES - CURRENT_BUTTON_PRESSED_OUTLINE * 2, + ui_settings_list_ctl, LV_HOR_RES - ESP3D_BUTTON_PRESSED_OUTLINE * 2, LV_VER_RES - - ((3 * CURRENT_BUTTON_PRESSED_OUTLINE) + lv_obj_get_height(btnback))); + ((3 * ESP3D_BUTTON_PRESSED_OUTLINE) + lv_obj_get_height(btnback))); - lv_obj_set_pos(ui_settings_list_ctl, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(ui_settings_list_ctl, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_t *line_container = NULL; std::string LabelStr = ""; // Language - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::ui_language); if (line_container) { std::string ui_language; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_ui_language); esp3d_log("Looking for index %d", @@ -661,19 +661,19 @@ void settings_screen() { ui_language = "English"; } language_label = - listLine::add_label_to_line(ui_language.c_str(), line_container, true); + listLine::add_label(ui_language.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } // Hostname - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::hostname); if (line_container) { std::string hostname; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_hostname); if (settingPtr) { @@ -682,9 +682,9 @@ void settings_screen() { out_str, settingPtr->size); } hostname_label = - listLine::add_label_to_line(hostname.c_str(), line_container, true); + listLine::add_label(hostname.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -692,23 +692,23 @@ void settings_screen() { // Extensions static ESP3DSettingIndex extensions_setting_index = ESP3DSettingIndex::esp3d_extensions; - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::extensions); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); - extensions_label = listLine::add_label_to_line("", line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); + extensions_label = listLine::add_label("", line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)&(extensions_setting_index)); } #if ESP3D_USB_SERIAL_FEATURE // USB Serial - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::output_client); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_output_client); if (settingPtr) { @@ -721,9 +721,9 @@ void settings_screen() { ? esp3dTranslationService.translate(ESP3DLabel::usb) : "???"; output_client_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -731,10 +731,10 @@ void settings_screen() { #endif // ESP3D_USB_SERIAL_FEATURE // Serial Baud rate - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::serial_baud_rate); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_baud_rate); if (settingPtr) { @@ -742,9 +742,9 @@ void settings_screen() { esp3dTftsettings.readUint32(ESP3DSettingIndex::esp3d_baud_rate); std::string value = std::to_string(val); serial_baud_rate_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -752,10 +752,10 @@ void settings_screen() { #if ESP3D_USB_SERIAL_FEATURE // USB serial Baud rate - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::usb_baud_rate); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr( ESP3DSettingIndex::esp3d_usb_serial_baud_rate); if (settingPtr) { @@ -763,9 +763,9 @@ void settings_screen() { ESP3DSettingIndex::esp3d_usb_serial_baud_rate); std::string value = std::to_string(val); usb_serial_baud_rate_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -773,10 +773,10 @@ void settings_screen() { #endif // ESP3D_USB_SERIAL_FEATURE // Jog type - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::jog_type); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_jog_type); if (settingPtr) { @@ -786,19 +786,19 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::relative) : esp3dTranslationService.translate(ESP3DLabel::absolute); jog_type_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } } // Polling on - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::polling); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_polling_on); if (settingPtr) { @@ -808,9 +808,9 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); polling_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -820,23 +820,23 @@ void settings_screen() { // show fan controls static ESP3DSettingIndex show_fan_controls_setting_index = ESP3DSettingIndex::esp3d_show_fan_controls; - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::fan_controls); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); show_fan_controls_label = - listLine::add_label_to_line("", line_container, true); + listLine::add_label("", line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)&(show_fan_controls_setting_index)); } // Auto level on - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::auto_leveling); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_auto_level_on); if (settingPtr) { @@ -846,20 +846,20 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); auto_leveling_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } } // Bed width - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::bed_width); if (line_container) { std::string bed_width_str; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_bed_width); if (settingPtr) { @@ -869,20 +869,20 @@ void settings_screen() { } else { esp3d_log_e("Failed to get bed width setting"); } - bed_width_label = listLine::add_label_to_line(bed_width_str.c_str(), + bed_width_label = listLine::add_label(bed_width_str.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } // Bed depth - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::bed_depth); if (line_container) { std::string bed_depth_str; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_bed_depth); if (settingPtr) { @@ -892,19 +892,19 @@ void settings_screen() { } else { esp3d_log_e("Failed to get bed depth setting"); } - bed_depth_label = listLine::add_label_to_line(bed_depth_str.c_str(), + bed_depth_label = listLine::add_label(bed_depth_str.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } // Invert X axis - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::invert_axis, "X"); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_inverved_x); if (settingPtr) { @@ -914,19 +914,19 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); inverted_x_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } } // Invert Y axis - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::invert_axis, "Y"); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_inverved_y); if (settingPtr) { @@ -936,9 +936,9 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); inverted_y_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } diff --git a/main/display/3dprinter/marlin/screens/speed_screen.cpp b/main/display/3dprinter/marlin/screens/speed_screen.cpp index 4f8c496b..cca7df8a 100644 --- a/main/display/3dprinter/marlin/screens/speed_screen.cpp +++ b/main/display/3dprinter/marlin/screens/speed_screen.cpp @@ -52,10 +52,10 @@ void speed_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_speed_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (speed_screen_delay_timer) return; speed_screen_delay_timer = lv_timer_create(speed_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { speed_screen_delay_timer_cb(NULL); } @@ -165,7 +165,7 @@ void speed_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_speed_back_handler, LV_EVENT_CLICKED, NULL); @@ -174,9 +174,9 @@ void speed_screen() { lv_btnmatrix_set_map(btnm, speed_buttons_map); ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(speed_buttons_map) / sizeof(speed_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, speed_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_add_event_cb(btnm, speed_matrix_buttons_event_cb, @@ -187,7 +187,7 @@ void speed_screen() { lv_label_set_text(label_current_speed, LV_SYMBOL_SPEED); ESP3DStyle::apply(label_current_speed, ESP3DStyleType::bg_label); lv_obj_align(label_current_speed, LV_ALIGN_TOP_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_speed); // Current Speed value @@ -200,7 +200,7 @@ void speed_screen() { ESP3DStyle::apply(label_current_speed_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_speed_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_speed_value, label_current_speed, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit @@ -208,14 +208,14 @@ void speed_screen() { lv_label_set_text(label_unit1, "%"); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_speed_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_UP "\n" LV_SYMBOL_PLUS); lv_obj_align_to(btn_up, label_current_speed_value, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // speed input lv_obj_t *speed_ta = lv_textarea_create(ui_new_screen); lv_obj_add_event_cb(speed_ta, speed_ta_event_cb, LV_EVENT_VALUE_CHANGED, @@ -227,27 +227,27 @@ void speed_screen() { lv_obj_set_style_text_align(speed_ta, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_width(speed_ta, LV_HOR_RES / 6); lv_obj_align_to(speed_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_SPEED); ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_align_to(label_ta, speed_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, "%"); ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, speed_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // button down lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, speed_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, speed_btn_down_event_cb, LV_EVENT_CLICKED, speed_ta); @@ -258,7 +258,7 @@ void speed_screen() { lv_obj_t *btn_ok = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_OK); lv_obj_align_to(btn_ok, label_unit2, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_ok, speed_btn_ok_event_cb, LV_EVENT_CLICKED, speed_ta); @@ -266,7 +266,7 @@ void speed_screen() { lv_obj_t *btn_reset = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_GAUGE); lv_obj_align_to(btn_reset, btn_ok, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_reset, speed_btn_reset_event_cb, LV_EVENT_CLICKED, speed_ta); @@ -275,11 +275,11 @@ void speed_screen() { lv_keyboard_set_mode(speed_kb, LV_KEYBOARD_MODE_NUMBER); lv_keyboard_set_textarea(speed_kb, NULL); lv_obj_align_to(speed_kb, speed_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_update_layout(speed_kb); lv_obj_set_content_width(speed_kb, LV_HOR_RES - lv_obj_get_x(speed_kb) - - 2 * CURRENT_BUTTON_PRESSED_OUTLINE); - lv_obj_set_style_radius(speed_kb, CURRENT_BUTTON_RADIUS_VALUE, LV_PART_MAIN); + 2 * ESP3D_BUTTON_PRESSED_OUTLINE); + lv_obj_set_style_radius(speed_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(speed_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(speed_ta, speed_ta_event_cb, LV_EVENT_ALL, speed_kb); diff --git a/main/display/3dprinter/marlin/screens/temperatures_screen.cpp b/main/display/3dprinter/marlin/screens/temperatures_screen.cpp index fb9dbaa6..2a563f68 100644 --- a/main/display/3dprinter/marlin/screens/temperatures_screen.cpp +++ b/main/display/3dprinter/marlin/screens/temperatures_screen.cpp @@ -132,14 +132,14 @@ bool updateBtnMatrix() { ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); - lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); + lv_obj_set_size(btnm_target, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); esp3d_log("child count: %d", i); // lv_obj_add_state(obj, LV_STATE_DISABLED); if (heater_buttons_map_id > i) heater_buttons_map_id = 0; lv_btnmatrix_set_btn_ctrl(btnm_target, heater_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align_to(btnm_target, btnback, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); return true; } @@ -181,10 +181,10 @@ void temperatures_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_temperatures_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (temperatures_screen_delay_timer) return; temperatures_screen_delay_timer = lv_timer_create( - temperatures_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + temperatures_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { temperatures_screen_delay_timer_cb(NULL); } @@ -446,7 +446,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_del(ui_current_screen); // back button - btnback = backButton::create_back_button(ui_new_screen); + btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_temperatures_back_handler, LV_EVENT_CLICKED, NULL); @@ -457,9 +457,9 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { size_t i = (sizeof(temperatures_buttons_map) / sizeof(temperatures_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, temperatures_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_add_event_cb(btnm, temperatures_matrix_buttons_event_cb, @@ -472,10 +472,10 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // Power off all heater lv_obj_t *btn_power_off_all = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_POWER "...", MATRIX_BUTTON_WIDTH, - MATRIX_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_POWER "...", ESP3D_MATRIX_BUTTON_WIDTH, + ESP3D_MATRIX_BUTTON_HEIGHT); lv_obj_align_to(btn_power_off_all, btnm_target, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); // Label current heater label_current_temperature = lv_label_create(ui_new_screen); @@ -486,7 +486,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // heater ESP3DStyle::apply(label_current_temperature, ESP3DStyleType::bg_label); lv_obj_align(label_current_temperature, LV_ALIGN_TOP_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_temperature); // Label current heater e @@ -526,7 +526,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { ESP3DStyle::apply(label_current_temperature_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_temperature_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_temperature_value, label_current_temperature, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); @@ -534,14 +534,14 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { esp3dTranslationService.translate(ESP3DLabel::celsius)); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_temperature_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_UP "\n" LV_SYMBOL_PLUS); lv_obj_align_to(btn_up, label_current_temperature_value, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // Text area lv_obj_t *temperatures_ta = lv_textarea_create(ui_new_screen); lv_obj_add_event_cb(temperatures_ta, temperatures_ta_event_cb, @@ -559,7 +559,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_set_width(temperatures_ta, LV_HOR_RES / 6); lv_obj_align_to(temperatures_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_up, temperatures_btn_up_event_cb, LV_EVENT_CLICKED, temperatures_ta); @@ -575,7 +575,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // heater ESP3DStyle::apply(label_target, ESP3DStyleType::bg_label); lv_obj_align_to(label_target, temperatures_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); @@ -584,19 +584,19 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, temperatures_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // set button lv_obj_t *btn_set = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_OK); lv_obj_align_to(btn_set, label_unit2, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_set, temperatures_btn_ok_event_cb, LV_EVENT_CLICKED, temperatures_ta); // Power off button to 0 lv_obj_t *btn_stop = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_POWER); lv_obj_align_to(btn_stop, btn_set, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_stop, temperatures_btn_power_off_event_cb, LV_EVENT_CLICKED, temperatures_ta); // Keyboard @@ -606,11 +606,11 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_update_layout(label_unit2); lv_obj_set_content_width(temperatures_kb, LV_HOR_RES - (lv_obj_get_x(label_unit2) + - CURRENT_BUTTON_PRESSED_OUTLINE)); + ESP3D_BUTTON_PRESSED_OUTLINE)); lv_obj_align_to(temperatures_kb, temperatures_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2); - lv_obj_set_style_radius(temperatures_kb, CURRENT_BUTTON_RADIUS_VALUE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2, + -ESP3D_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_style_radius(temperatures_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(temperatures_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(temperatures_ta, temperatures_ta_event_cb, LV_EVENT_ALL, @@ -619,7 +619,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, temperatures_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, temperatures_btn_down_event_cb, LV_EVENT_CLICKED, temperatures_ta); @@ -633,7 +633,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_set_width(label_target_temperature_value, LV_HOR_RES / 6); lv_obj_align_to(label_target_temperature_value, btn_down, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // unit label_unit1 = lv_label_create(ui_new_screen); @@ -641,7 +641,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { esp3dTranslationService.translate(ESP3DLabel::celsius)); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_target_temperature_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Label target heater @@ -653,7 +653,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { ESP3DStyle::apply(label_target_temperature, ESP3DStyleType::bg_label); lv_obj_align_to(label_target_temperature, label_target_temperature_value, - LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_LEFT_MID, -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); esp3dTftui.set_current_screen(ESP3DScreenType::temperatures); diff --git a/main/display/3dprinter/repetier/esp3d_styles.cpp b/main/display/3dprinter/repetier/esp3d_styles.cpp index 36c2e232..df0545db 100644 --- a/main/display/3dprinter/repetier/esp3d_styles.cpp +++ b/main/display/3dprinter/repetier/esp3d_styles.cpp @@ -26,21 +26,21 @@ #define ESP3D_SCREEN_BACKGROUND_TEXT_COLOR lv_color_hex(0xFFFFFF) -#define CURRENT_STATUS_BAR_TEXT_COLOR lv_color_hex(0x000000) -#define CURRENT_STATUS_BAR_BG_COLOR lv_color_hex(0xFFFFFF) +#define ESP3D_STATUS_BAR_TEXT_COLOR lv_color_hex(0x000000) +#define ESP3D_STATUS_BAR_BG_COLOR lv_color_hex(0xFFFFFF) -#define CURRENT_STATUS_BAR_BORDER_COLOR lv_palette_main(LV_PALETTE_GREY) +#define ESP3D_STATUS_BAR_BORDER_COLOR lv_palette_main(LV_PALETTE_GREY) -#define CURRENT_BUTTON_COLOR_PALETTE LV_PALETTE_GREY -#define CURRENT_BUTTON_COLOR_PALETTE_DARKEN 2 +#define ESP3D_BUTTON_COLOR_PALETTE LV_PALETTE_GREY +#define ESP3D_BUTTON_COLOR_PALETTE_DARKEN 2 -#define CURRENT_BUTTON_BORDER_COLOR \ +#define ESP3D_BUTTON_BORDER_COLOR \ lv_color_hex(0xFFFFFF) // lv_palette_main(LV_PALETTE_GREY) -#define CURRENT_BUTTON_TEXT_COLOR lv_color_hex(0xFFFFFF) -#define CURRENT_BUTTON_OUTLINE_COLOR_PALETTE LV_PALETTE_GREEN -#define CURRENT_BUTTON_PRESSED_COLOR_PALETTE LV_PALETTE_GREY -#define CURRENT_BUTTON_PRESSED_TEXT_COLOR lv_color_hex(0x00FF00) -#define CURRENT_BUTTON_PRESSED_BORDER_COLOR lv_color_hex(0x00FF00) +#define ESP3D_BUTTON_TEXT_COLOR lv_color_hex(0xFFFFFF) +#define ESP3D_BUTTON_OUTLINE_COLOR_PALETTE LV_PALETTE_GREEN +#define ESP3D_BUTTON_PRESSED_COLOR_PALETTE LV_PALETTE_GREY +#define ESP3D_BUTTON_PRESSED_TEXT_COLOR lv_color_hex(0x00FF00) +#define ESP3D_BUTTON_PRESSED_BORDER_COLOR lv_color_hex(0x00FF00) // Create styles for main background lv_style_t style_main_bg; @@ -121,14 +121,14 @@ bool ESP3DStyle::init() { lv_style_set_text_opa(&style_read_only_value, LV_OPA_COVER); lv_style_set_text_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); lv_style_set_bg_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_COLOR); - lv_style_set_radius(&style_read_only_value, CURRENT_STATUS_BAR_RADIUS); + lv_style_set_radius(&style_read_only_value, ESP3D_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_value, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_read_only_value, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); lv_style_set_text_align(&style_read_only_value, LV_TEXT_ALIGN_CENTER); - lv_style_set_pad_top(&style_read_only_value, CURRENT_BUTTON_PAD); - lv_style_set_pad_bottom(&style_read_only_value, CURRENT_BUTTON_PAD); + lv_style_set_pad_top(&style_read_only_value, ESP3D_BUTTON_PAD); + lv_style_set_pad_bottom(&style_read_only_value, ESP3D_BUTTON_PAD); /* read only setting on main background @@ -136,16 +136,16 @@ bool ESP3DStyle::init() { lv_style_init(&style_read_only_setting); lv_style_set_text_opa(&style_read_only_setting, LV_OPA_COVER); lv_style_set_text_color(&style_read_only_setting, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_bg_color(&style_read_only_setting, ESP3D_SCREEN_BACKGROUND_COLOR); - lv_style_set_radius(&style_read_only_setting, CURRENT_STATUS_BAR_RADIUS); + lv_style_set_radius(&style_read_only_setting, ESP3D_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_setting, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_read_only_setting, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); lv_style_set_text_align(&style_read_only_setting, LV_TEXT_ALIGN_CENTER); - lv_style_set_pad_top(&style_read_only_setting, CURRENT_BUTTON_PAD); - lv_style_set_pad_bottom(&style_read_only_setting, CURRENT_BUTTON_PAD); + lv_style_set_pad_top(&style_read_only_setting, ESP3D_BUTTON_PAD); + lv_style_set_pad_bottom(&style_read_only_setting, ESP3D_BUTTON_PAD); /* Status bar @@ -154,16 +154,16 @@ bool ESP3DStyle::init() { lv_style_set_text_opa(&style_status_bar_default, LV_OPA_COVER); lv_style_set_text_color(&style_status_bar_default, - CURRENT_STATUS_BAR_TEXT_COLOR); + ESP3D_STATUS_BAR_TEXT_COLOR); lv_style_set_bg_opa(&style_status_bar_default, LV_OPA_COVER); - lv_style_set_bg_color(&style_status_bar_default, CURRENT_STATUS_BAR_BG_COLOR); - lv_style_set_radius(&style_status_bar_default, CURRENT_STATUS_BAR_RADIUS); - lv_style_set_pad_hor(&style_status_bar_default, CURRENT_STATUS_BAR_H_PAD); - lv_style_set_pad_ver(&style_status_bar_default, CURRENT_STATUS_BAR_V_PAD); + lv_style_set_bg_color(&style_status_bar_default, ESP3D_STATUS_BAR_BG_COLOR); + lv_style_set_radius(&style_status_bar_default, ESP3D_STATUS_BAR_RADIUS); + lv_style_set_pad_hor(&style_status_bar_default, ESP3D_STATUS_BAR_H_PAD); + lv_style_set_pad_ver(&style_status_bar_default, ESP3D_STATUS_BAR_V_PAD); lv_style_set_border_width(&style_status_bar_default, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_status_bar_default, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); /* Scrollbar @@ -171,7 +171,7 @@ bool ESP3DStyle::init() { // Create style for scrollbar default state lv_style_init(&style_scrollbar_default); - lv_style_set_width(&style_scrollbar_default, CURRENT_SCROLL_BAR_WIDTH); + lv_style_set_width(&style_scrollbar_default, ESP3D_SCROLL_BAR_WIDTH); lv_style_set_bg_opa(&style_scrollbar_default, LV_OPA_COVER); lv_style_set_bg_color(&style_scrollbar_default, lv_palette_main(LV_PALETTE_GREY)); @@ -179,12 +179,12 @@ bool ESP3DStyle::init() { lv_style_set_border_color( &style_scrollbar_default, lv_palette_darken(LV_PALETTE_GREY, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_border_opa(&style_scrollbar_default, LV_OPA_COVER); lv_style_set_border_width(&style_scrollbar_default, - CURRENT_BUTTON_BORDER_VALUE); - lv_style_set_radius(&style_scrollbar_default, CURRENT_SCROLL_BAR_RADIUS); + ESP3D_BUTTON_BORDER_SIZE); + lv_style_set_radius(&style_scrollbar_default, ESP3D_SCROLL_BAR_RADIUS); lv_style_set_pad_all(&style_scrollbar_default, 8); // Create style for scrollbar active state lv_style_init(&style_scrollbar_active); @@ -192,11 +192,11 @@ bool ESP3DStyle::init() { lv_style_set_bg_color(&style_scrollbar_active, lv_palette_main(LV_PALETTE_GREEN)); lv_style_set_shadow_width(&style_scrollbar_active, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_shadow_color(&style_scrollbar_active, lv_palette_main(LV_PALETTE_GREEN)); lv_style_set_shadow_spread(&style_scrollbar_active, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); /* Radio Buttons @@ -207,16 +207,16 @@ bool ESP3DStyle::init() { lv_style_set_border_color( &style_btn_radio_default, lv_palette_darken(LV_PALETTE_GREY, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); // Create style for button pressed state lv_style_init(&style_btn_radio_pressed); lv_style_set_shadow_width(&style_btn_radio_pressed, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_shadow_color(&style_btn_radio_pressed, lv_palette_main(LV_PALETTE_GREEN)); lv_style_set_shadow_spread(&style_btn_radio_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_btn_radio_pressed, lv_palette_main(LV_PALETTE_GREEN)); @@ -232,57 +232,57 @@ bool ESP3DStyle::init() { // Create style for button default state lv_style_init(&style_btn_default); - lv_style_set_radius(&style_btn_default, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_default, ESP3D_BUTTON_RADIUS ); lv_style_set_bg_opa(&style_btn_default, LV_OPA_100); lv_style_set_bg_color(&style_btn_default, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_btn_default, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_btn_default, LV_GRAD_DIR_VER); lv_style_set_border_opa(&style_btn_default, LV_OPA_40); - lv_style_set_border_width(&style_btn_default, CURRENT_BUTTON_BORDER_VALUE); - lv_style_set_border_color(&style_btn_default, CURRENT_BUTTON_BORDER_COLOR); + lv_style_set_border_width(&style_btn_default, ESP3D_BUTTON_BORDER_SIZE); + lv_style_set_border_color(&style_btn_default, ESP3D_BUTTON_BORDER_COLOR); lv_style_set_outline_opa(&style_btn_default, LV_OPA_COVER); lv_style_set_outline_color( &style_btn_default, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); - lv_style_set_text_color(&style_btn_default, CURRENT_BUTTON_TEXT_COLOR); - lv_style_set_pad_all(&style_btn_default, CURRENT_BUTTON_PAD); + lv_style_set_text_color(&style_btn_default, ESP3D_BUTTON_TEXT_COLOR); + lv_style_set_pad_all(&style_btn_default, ESP3D_BUTTON_PAD); // Create style for button pressed state lv_style_init(&style_btn_pressed); /*Add a large outline when pressed*/ lv_style_set_outline_width(&style_btn_pressed, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_outline_opa(&style_btn_pressed, LV_OPA_TRANSP); lv_style_set_shadow_ofs_y(&style_btn_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_color( &style_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_text_color(&style_btn_pressed, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_border_color(&style_btn_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); - if (BUTTON_ANIMATION_DELAY) { + ESP3D_BUTTON_PRESSED_BORDER_COLOR); + if (ESP3D_BUTTON_ANIMATION_DELAY) { /*Add a transition to the outline*/ static lv_style_transition_dsc_t trans; static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, LV_STYLE_PROP_INV}; lv_style_transition_dsc_init(&trans, props, lv_anim_path_linear, - BUTTON_ANIMATION_DELAY, 0, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, 0, NULL); lv_style_set_transition(&style_btn_pressed, &trans); } @@ -295,44 +295,44 @@ bool ESP3DStyle::init() { lv_style_set_radius(&style_embedded_btn_default, 0); lv_style_set_bg_opa(&style_embedded_btn_default, LV_OPA_100); lv_style_set_bg_color(&style_embedded_btn_default, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_embedded_btn_default, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_embedded_btn_default, LV_GRAD_DIR_VER); lv_style_set_border_opa(&style_embedded_btn_default, LV_OPA_40); lv_style_set_border_width(&style_embedded_btn_default, - CURRENT_BUTTON_BORDER_VALUE); + ESP3D_BUTTON_BORDER_SIZE); lv_style_set_border_color(&style_embedded_btn_default, - CURRENT_BUTTON_BORDER_COLOR); + ESP3D_BUTTON_BORDER_COLOR); lv_style_set_outline_opa(&style_embedded_btn_default, LV_OPA_COVER); lv_style_set_outline_color( &style_embedded_btn_default, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); lv_style_set_text_color(&style_embedded_btn_default, - CURRENT_BUTTON_TEXT_COLOR); - lv_style_set_pad_all(&style_embedded_btn_default, CURRENT_BUTTON_PAD); + ESP3D_BUTTON_TEXT_COLOR); + lv_style_set_pad_all(&style_embedded_btn_default, ESP3D_BUTTON_PAD); // Create style for embedded button pressed state lv_style_init(&style_embedded_btn_pressed); lv_style_set_shadow_ofs_y(&style_embedded_btn_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_embedded_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_color( &style_embedded_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_text_color(&style_embedded_btn_pressed, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_border_color(&style_embedded_btn_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); + ESP3D_BUTTON_PRESSED_BORDER_COLOR); /* Buttons matrix @@ -343,33 +343,33 @@ bool ESP3DStyle::init() { lv_style_set_pad_all(&style_btn_matrix_bar, 1); lv_style_set_pad_gap(&style_btn_matrix_bar, 0); lv_style_set_clip_corner(&style_btn_matrix_bar, true); - lv_style_set_radius(&style_btn_matrix_bar, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_bar, ESP3D_BUTTON_RADIUS ); lv_style_set_pad_left(&style_btn_matrix_bar, 4); lv_style_set_pad_top(&style_btn_matrix_bar, 4); // border lv_style_set_border_opa(&style_btn_matrix_bar, LV_OPA_40); - lv_style_set_border_width(&style_btn_matrix_bar, CURRENT_BUTTON_BORDER_VALUE); - lv_style_set_border_color(&style_btn_matrix_bar, CURRENT_BUTTON_BORDER_COLOR); + lv_style_set_border_width(&style_btn_matrix_bar, ESP3D_BUTTON_BORDER_SIZE); + lv_style_set_border_color(&style_btn_matrix_bar, ESP3D_BUTTON_BORDER_COLOR); // bg lv_style_set_bg_opa(&style_btn_matrix_bar, LV_OPA_100); lv_style_set_bg_color(&style_btn_matrix_bar, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_btn_matrix_bar, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_btn_matrix_bar, LV_GRAD_DIR_VER); // text - lv_style_set_text_color(&style_btn_matrix_bar, CURRENT_BUTTON_TEXT_COLOR); + lv_style_set_text_color(&style_btn_matrix_bar, ESP3D_BUTTON_TEXT_COLOR); //***************************************************************** // Default lv_style_init(&style_btn_matrix_default); - lv_style_set_radius(&style_btn_matrix_default, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_default, ESP3D_BUTTON_RADIUS ); // bg // text @@ -380,32 +380,32 @@ bool ESP3DStyle::init() { // Pressed lv_style_init(&style_btn_matrix_pressed); lv_style_set_pad_all(&style_btn_matrix_pressed, 10); - lv_style_set_radius(&style_btn_matrix_pressed, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_pressed, ESP3D_BUTTON_RADIUS ); lv_style_set_outline_opa(&style_btn_matrix_pressed, LV_OPA_40); lv_style_set_outline_color( &style_btn_matrix_pressed, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); lv_style_set_outline_width(&style_btn_matrix_pressed, 1); // bg lv_style_set_bg_opa(&style_btn_matrix_pressed, LV_OPA_60); lv_style_set_bg_color( &style_btn_matrix_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_bg_grad_color( &style_btn_matrix_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); // text lv_style_set_text_color( &style_btn_matrix_pressed, - lv_palette_darken(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); // border lv_style_set_border_color(&style_btn_matrix_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); + ESP3D_BUTTON_PRESSED_BORDER_COLOR); lv_style_set_border_width(&style_btn_matrix_pressed, 3); lv_style_set_border_opa(&style_btn_matrix_pressed, LV_OPA_60); @@ -413,24 +413,24 @@ bool ESP3DStyle::init() { // checked lv_style_init(&style_btn_matrix_checked); lv_style_set_pad_all(&style_btn_matrix_checked, 10); - lv_style_set_radius(&style_btn_matrix_checked, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_checked, ESP3D_BUTTON_RADIUS ); // bg lv_style_set_bg_opa(&style_btn_matrix_checked, LV_OPA_40); lv_style_set_bg_color( &style_btn_matrix_checked, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_bg_grad_color( &style_btn_matrix_checked, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); // text lv_style_set_text_color(&style_btn_matrix_checked, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); // border lv_style_set_border_color(&style_btn_matrix_checked, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); + ESP3D_BUTTON_PRESSED_BORDER_COLOR); lv_style_set_border_width(&style_btn_matrix_checked, 2); lv_style_set_border_opa(&style_btn_matrix_checked, LV_OPA_40); @@ -439,30 +439,30 @@ bool ESP3DStyle::init() { */ /*Default*/ lv_style_init(&style_btn_msb_box_default); - lv_style_set_radius(&style_btn_msb_box_default, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_msb_box_default, ESP3D_BUTTON_RADIUS ); lv_style_set_bg_opa(&style_btn_msb_box_default, LV_OPA_100); lv_style_set_bg_color(&style_btn_msb_box_default, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_btn_msb_box_default, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_btn_msb_box_default, LV_GRAD_DIR_VER); lv_style_set_border_opa(&style_btn_msb_box_default, LV_OPA_40); lv_style_set_border_width(&style_btn_msb_box_default, - CURRENT_BUTTON_BORDER_VALUE); + ESP3D_BUTTON_BORDER_SIZE); lv_style_set_border_color(&style_btn_msb_box_default, - CURRENT_BUTTON_BORDER_COLOR); + ESP3D_BUTTON_BORDER_COLOR); lv_style_set_outline_opa(&style_btn_msb_box_default, LV_OPA_COVER); lv_style_set_outline_color( &style_btn_msb_box_default, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); lv_style_set_text_color(&style_btn_msb_box_default, - CURRENT_BUTTON_TEXT_COLOR); - lv_style_set_pad_all(&style_btn_msb_box_default, CURRENT_BUTTON_PAD); + ESP3D_BUTTON_TEXT_COLOR); + lv_style_set_pad_all(&style_btn_msb_box_default, ESP3D_BUTTON_PAD); /*Pressed*/ @@ -470,30 +470,30 @@ bool ESP3DStyle::init() { /*Add a large outline when pressed*/ lv_style_set_outline_width(&style_btn_msb_box_pressed, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_outline_opa(&style_btn_msb_box_pressed, LV_OPA_TRANSP); lv_style_set_shadow_ofs_y(&style_btn_msb_box_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_btn_msb_box_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_color( &style_btn_msb_box_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_text_color(&style_btn_msb_box_pressed, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_border_color(&style_btn_msb_box_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); - if (BUTTON_ANIMATION_DELAY) { + ESP3D_BUTTON_PRESSED_BORDER_COLOR); + if (ESP3D_BUTTON_ANIMATION_DELAY) { /*Add a transition to the outline*/ static lv_style_transition_dsc_t trans; static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, LV_STYLE_PROP_INV}; lv_style_transition_dsc_init(&trans, props, lv_anim_path_linear, - BUTTON_ANIMATION_DELAY, 0, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, 0, NULL); lv_style_set_transition(&style_btn_msb_box_pressed, &trans); } @@ -503,24 +503,24 @@ bool ESP3DStyle::init() { lv_style_init(&style_status_list_default); lv_style_set_text_opa(&style_status_list_default, LV_OPA_COVER); lv_style_set_text_color(&style_status_list_default, - CURRENT_STATUS_BAR_TEXT_COLOR); + ESP3D_STATUS_BAR_TEXT_COLOR); lv_style_set_bg_opa(&style_status_list_default, LV_OPA_COVER); lv_style_set_bg_color(&style_status_list_default, - CURRENT_STATUS_BAR_BG_COLOR); + ESP3D_STATUS_BAR_BG_COLOR); lv_style_set_radius(&style_status_list_default, 0); // lv_style_set_pad_hor(&style_status_list_default, - // CURRENT_STATUS_BAR_H_PAD); + // ESP3D_STATUS_BAR_H_PAD); // lv_style_set_pad_ver(&style_status_list_default, - // CURRENT_STATUS_BAR_V_PAD); + // ESP3D_STATUS_BAR_V_PAD); lv_style_set_border_width(&style_status_list_default, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_status_list_default, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); /* Col Container */ lv_style_init(&style_col_container_default); - lv_style_set_radius(&style_col_container_default, CURRENT_CONTAINER_RADIUS); + lv_style_set_radius(&style_col_container_default, ESP3D_CONTAINER_RADIUS); lv_style_set_layout(&style_col_container_default, LV_LAYOUT_FLEX); lv_style_set_flex_flow(&style_col_container_default, LV_FLEX_FLOW_COLUMN); lv_style_set_flex_main_place(&style_col_container_default, @@ -530,7 +530,7 @@ bool ESP3DStyle::init() { Row Container */ lv_style_init(&style_row_container_default); - lv_style_set_radius(&style_row_container_default, CURRENT_CONTAINER_RADIUS); + lv_style_set_radius(&style_row_container_default, ESP3D_CONTAINER_RADIUS); lv_style_set_layout(&style_row_container_default, LV_LAYOUT_FLEX); lv_style_set_flex_flow(&style_row_container_default, LV_FLEX_FLOW_ROW); lv_style_set_flex_main_place(&style_row_container_default, @@ -627,8 +627,8 @@ bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { lv_obj_set_width(obj, LV_PCT(80)); ESP3DStyle::apply(lv_msgbox_get_close_btn(obj), ESP3DStyleType::button); ESP3DStyle::apply(lv_msgbox_get_btns(obj), ESP3DStyleType::buttons_msgbox); - lv_obj_set_height(lv_msgbox_get_btns(obj), SYMBOL_BUTTON_HEIGHT); - lv_obj_set_width(lv_msgbox_get_btns(obj), MSGBOX_BUTTON_WIDTH); + lv_obj_set_height(lv_msgbox_get_btns(obj), ESP3D_SYMBOL_BUTTON_HEIGHT); + lv_obj_set_width(lv_msgbox_get_btns(obj), ESP3D_MSGBOX_BUTTON_WIDTH); break; case ESP3DStyleType::embedded_button: lv_obj_add_style(obj, &style_embedded_btn_default, LV_STATE_DEFAULT); @@ -638,16 +638,16 @@ bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { case ESP3DStyleType::row_container: lv_obj_add_style(obj, &style_row_container_default, LV_STATE_DEFAULT); lv_obj_set_style_clip_corner(obj, true, 0); - lv_obj_set_style_pad_column(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_column(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); break; case ESP3DStyleType::col_container: lv_obj_add_style(obj, &style_col_container_default, LV_STATE_DEFAULT); lv_obj_set_style_clip_corner(obj, true, 0); - lv_obj_set_style_pad_top(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_top(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_bottom(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_bottom(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); break; case ESP3DStyleType::list_container: @@ -655,10 +655,10 @@ bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_ELASTIC); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_scrollbar_mode(obj, LV_SCROLLBAR_MODE_AUTO); - lv_obj_set_style_pad_row(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_row(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_set_style_flex_main_place(obj, LV_FLEX_ALIGN_START, LV_PART_MAIN); - lv_obj_set_style_pad_all(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_all(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_add_style(obj, &style_scrollbar_default, LV_PART_SCROLLBAR); #pragma GCC diagnostic push @@ -689,10 +689,10 @@ bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { } bool ESP3DStyle::add_pad(lv_obj_t* obj) { - lv_obj_set_style_pad_left(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_right(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_top(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_bottom(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_left(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_set_style_pad_right(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_set_style_pad_top(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_set_style_pad_bottom(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); return true; } \ No newline at end of file diff --git a/main/display/3dprinter/repetier/res_320_240/esp3d_styles_res.h b/main/display/3dprinter/repetier/res_320_240/esp3d_styles_res.h index b55f6ce1..f460a318 100644 --- a/main/display/3dprinter/repetier/res_320_240/esp3d_styles_res.h +++ b/main/display/3dprinter/repetier/res_320_240/esp3d_styles_res.h @@ -20,48 +20,48 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 4 -#define CURRENT_STATUS_BAR_H_PAD 5 -#define CURRENT_STATUS_BAR_V_PAD 3 -#define CURRENT_STATUS_BAR_BORDER_VALUE 1 -#define CURRENT_STATUS_AREA_HEIGHT 40 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 10) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 2 +#define ESP3D_STATUS_BAR_RADIUS 4 +#define ESP3D_STATUS_BAR_H_PAD 5 +#define ESP3D_STATUS_BAR_V_PAD 3 +#define ESP3D_STATUS_BAR_BORDER_VALUE 1 +#define ESP3D_STATUS_BAR_HEIGHT 40 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 10) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 2 -#define CURRENT_BUTTON_RADIUS_VALUE 4 -#define CURRENT_BUTTON_BORDER_VALUE 2 +#define ESP3D_BUTTON_RADIUS 4 +#define ESP3D_BUTTON_BORDER_SIZE 2 -#define CURRENT_BUTTON_PRESSED_OUTLINE 5 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 3 +#define ESP3D_BUTTON_PRESSED_OUTLINE 5 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 3 -#define CURRENT_CONTAINER_RADIUS 5 +#define ESP3D_CONTAINER_RADIUS 5 -#define BUTTON_WIDTH 60 -#define BUTTON_HEIGHT 60 +#define ESP3D_BUTTON_WIDTH 60 +#define ESP3D_BUTTON_HEIGHT 60 -#define SYMBOL_BUTTON_WIDTH 50 -#define SYMBOL_BUTTON_HEIGHT 44 +#define ESP3D_SYMBOL_BUTTON_WIDTH 50 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 44 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 0 -#endif // BUTTON_ANIMATION_DELAY +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 0 +#endif // ESP3D_BUTTON_ANIMATION_DELAY -#define CURRENT_SPINNER_SIZE 70 +#define ESP3D_SPINNER_SIZE 70 -#define BACK_BUTTON_WIDTH 50 -#define BACK_BUTTON_HEIGHT 40 -#define MATRIX_BUTTON_WIDTH 48 -#define MATRIX_BUTTON_HEIGHT 40 -#define MSGBOX_BUTTON_WIDTH 100 +#define ESP3D_BACK_BUTTON_WIDTH 50 +#define ESP3D_BACK_BUTTON_HEIGHT 40 +#define ESP3D_MATRIX_BUTTON_WIDTH 48 +#define ESP3D_MATRIX_BUTTON_HEIGHT 40 +#define ESP3D_MATRIX_BUTTON_WIDTH 100 -#define LIST_CONTAINER_LR_PAD 6 -#define LIST_LINE_HEIGHT 36 -#define LIST_LINE_BORDER_WIDTH 2 -#define LIST_LINE_BUTTON_WIDTH 40 +#define ESP3D_LIST_CONTAINER_LR_PAD 6 +#define ESP3D_LIST_LINE_HEIGHT 36 +#define ESP3D_LIST_LINE_BORDER_SIZE 2 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 40 -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 1 #define FW_LOGO_Y -1 diff --git a/main/display/3dprinter/repetier/res_480_272/esp3d_styles_res.h b/main/display/3dprinter/repetier/res_480_272/esp3d_styles_res.h index b0f1df2f..175a9061 100644 --- a/main/display/3dprinter/repetier/res_480_272/esp3d_styles_res.h +++ b/main/display/3dprinter/repetier/res_480_272/esp3d_styles_res.h @@ -20,48 +20,48 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 5 -#define CURRENT_STATUS_BAR_H_PAD 5 -#define CURRENT_STATUS_BAR_V_PAD 3 -#define CURRENT_STATUS_BAR_BORDER_VALUE 1 -#define CURRENT_STATUS_AREA_HEIGHT 50 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 15) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 3 +#define ESP3D_STATUS_BAR_RADIUS 5 +#define ESP3D_STATUS_BAR_H_PAD 5 +#define ESP3D_STATUS_BAR_V_PAD 3 +#define ESP3D_STATUS_BAR_BORDER_VALUE 1 +#define ESP3D_STATUS_BAR_HEIGHT 50 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 15) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 3 -#define CURRENT_BUTTON_RADIUS_VALUE 5 -#define CURRENT_BUTTON_BORDER_VALUE 2 +#define ESP3D_BUTTON_RADIUS 5 +#define ESP3D_BUTTON_BORDER_SIZE 2 -#define CURRENT_BUTTON_PRESSED_OUTLINE 8 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 4 +#define ESP3D_BUTTON_PRESSED_OUTLINE 8 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 4 -#define CURRENT_CONTAINER_RADIUS 5 +#define ESP3D_CONTAINER_RADIUS 5 -#define BUTTON_WIDTH (LV_HOR_RES / 6) -#define BUTTON_HEIGHT BUTTON_WIDTH +#define ESP3D_BUTTON_WIDTH (LV_HOR_RES / 6) +#define ESP3D_BUTTON_HEIGHT ESP3D_BUTTON_WIDTH -#define SYMBOL_BUTTON_WIDTH 70 -#define SYMBOL_BUTTON_HEIGHT 50 +#define ESP3D_SYMBOL_BUTTON_WIDTH 70 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 50 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 300 -#endif // BUTTON_ANIMATION_DELAY +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 300 +#endif // ESP3D_BUTTON_ANIMATION_DELAY -#define CURRENT_SPINNER_SIZE 100 +#define ESP3D_SPINNER_SIZE 100 -#define BACK_BUTTON_WIDTH 70 -#define BACK_BUTTON_HEIGHT 33 -#define MATRIX_BUTTON_WIDTH 70 -#define MATRIX_BUTTON_HEIGHT 33 -#define MSGBOX_BUTTON_WIDTH 130 +#define ESP3D_BACK_BUTTON_WIDTH 70 +#define ESP3D_BACK_BUTTON_HEIGHT 33 +#define ESP3D_MATRIX_BUTTON_WIDTH 70 +#define ESP3D_MATRIX_BUTTON_HEIGHT 33 +#define ESP3D_MATRIX_BUTTON_WIDTH 130 -#define LIST_CONTAINER_LR_PAD 10 -#define LIST_LINE_HEIGHT 42 -#define LIST_LINE_BORDER_WIDTH 2 -#define LIST_LINE_BUTTON_WIDTH 50 +#define ESP3D_LIST_CONTAINER_LR_PAD 10 +#define ESP3D_LIST_LINE_HEIGHT 42 +#define ESP3D_LIST_LINE_BORDER_SIZE 2 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 50 -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 10 #define FW_LOGO_Y -1 diff --git a/main/display/3dprinter/repetier/res_480_320/esp3d_styles_res.h b/main/display/3dprinter/repetier/res_480_320/esp3d_styles_res.h index e920c267..5a51ebaf 100644 --- a/main/display/3dprinter/repetier/res_480_320/esp3d_styles_res.h +++ b/main/display/3dprinter/repetier/res_480_320/esp3d_styles_res.h @@ -20,48 +20,48 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 5 -#define CURRENT_STATUS_BAR_H_PAD 5 -#define CURRENT_STATUS_BAR_V_PAD 3 -#define CURRENT_STATUS_BAR_BORDER_VALUE 1 -#define CURRENT_STATUS_AREA_HEIGHT 50 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 15) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 3 +#define ESP3D_STATUS_BAR_RADIUS 5 +#define ESP3D_STATUS_BAR_H_PAD 5 +#define ESP3D_STATUS_BAR_V_PAD 3 +#define ESP3D_STATUS_BAR_BORDER_VALUE 1 +#define ESP3D_STATUS_BAR_HEIGHT 50 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 15) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 3 -#define CURRENT_BUTTON_RADIUS_VALUE 5 -#define CURRENT_BUTTON_BORDER_VALUE 2 +#define ESP3D_BUTTON_RADIUS 5 +#define ESP3D_BUTTON_BORDER_SIZE 2 -#define CURRENT_BUTTON_PRESSED_OUTLINE 10 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 4 +#define ESP3D_BUTTON_PRESSED_OUTLINE 10 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 4 -#define CURRENT_CONTAINER_RADIUS 5 +#define ESP3D_CONTAINER_RADIUS 5 -#define BUTTON_WIDTH (LV_HOR_RES / 6) -#define BUTTON_HEIGHT BUTTON_WIDTH +#define ESP3D_BUTTON_WIDTH (LV_HOR_RES / 6) +#define ESP3D_BUTTON_HEIGHT ESP3D_BUTTON_WIDTH -#define SYMBOL_BUTTON_WIDTH 70 -#define SYMBOL_BUTTON_HEIGHT 56 +#define ESP3D_SYMBOL_BUTTON_WIDTH 70 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 56 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 300 -#endif // BUTTON_ANIMATION_DELAY +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 300 +#endif // ESP3D_BUTTON_ANIMATION_DELAY -#define CURRENT_SPINNER_SIZE 100 +#define ESP3D_SPINNER_SIZE 100 -#define BACK_BUTTON_WIDTH 70 -#define BACK_BUTTON_HEIGHT 50 -#define MATRIX_BUTTON_WIDTH 70 -#define MATRIX_BUTTON_HEIGHT 50 -#define MSGBOX_BUTTON_WIDTH 130 +#define ESP3D_BACK_BUTTON_WIDTH 70 +#define ESP3D_BACK_BUTTON_HEIGHT 50 +#define ESP3D_MATRIX_BUTTON_WIDTH 70 +#define ESP3D_MATRIX_BUTTON_HEIGHT 50 +#define ESP3D_MATRIX_BUTTON_WIDTH 130 -#define LIST_CONTAINER_LR_PAD 10 -#define LIST_LINE_HEIGHT 45 -#define LIST_LINE_BORDER_WIDTH 3 -#define LIST_LINE_BUTTON_WIDTH 50 +#define ESP3D_LIST_CONTAINER_LR_PAD 10 +#define ESP3D_LIST_LINE_HEIGHT 45 +#define ESP3D_LIST_LINE_BORDER_SIZE 3 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 50 -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 10 #define FW_LOGO_Y -10 \ No newline at end of file diff --git a/main/display/3dprinter/repetier/res_800_480/esp3d_styles_res.h b/main/display/3dprinter/repetier/res_800_480/esp3d_styles_res.h index 6c0f54ba..e3d7c9b0 100644 --- a/main/display/3dprinter/repetier/res_800_480/esp3d_styles_res.h +++ b/main/display/3dprinter/repetier/res_800_480/esp3d_styles_res.h @@ -20,47 +20,47 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 10 -#define CURRENT_STATUS_BAR_H_PAD 10 -#define CURRENT_STATUS_BAR_V_PAD 4 -#define CURRENT_STATUS_BAR_BORDER_VALUE 2 -#define CURRENT_STATUS_AREA_HEIGHT 80 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 30) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 3 - -#define CURRENT_BUTTON_RADIUS_VALUE 10 -#define CURRENT_BUTTON_BORDER_VALUE 2 - -#define CURRENT_BUTTON_PRESSED_OUTLINE 20 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 10 - -#define CURRENT_CONTAINER_RADIUS 10 - -#define BUTTON_WIDTH (LV_HOR_RES / 6) -#define BUTTON_HEIGHT BUTTON_WIDTH - -#define SYMBOL_BUTTON_WIDTH 100 -#define SYMBOL_BUTTON_HEIGHT 85 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 300 -#endif // BUTTON_ANIMATION_DELAY - -#define CURRENT_SPINNER_SIZE 100 - -#define BACK_BUTTON_WIDTH 100 -#define BACK_BUTTON_HEIGHT 75 -#define MATRIX_BUTTON_WIDTH 100 -#define MATRIX_BUTTON_HEIGHT 75 -#define MSGBOX_BUTTON_WIDTH 220 - -#define LIST_CONTAINER_LR_PAD 20 -#define LIST_LINE_HEIGHT 64 -#define LIST_LINE_BORDER_WIDTH 4 -#define LIST_LINE_BUTTON_WIDTH 80 - -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_STATUS_BAR_RADIUS 10 +#define ESP3D_STATUS_BAR_H_PAD 10 +#define ESP3D_STATUS_BAR_V_PAD 4 +#define ESP3D_STATUS_BAR_BORDER_VALUE 2 +#define ESP3D_STATUS_BAR_HEIGHT 80 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 30) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 3 + +#define ESP3D_BUTTON_RADIUS 10 +#define ESP3D_BUTTON_BORDER_SIZE 2 + +#define ESP3D_BUTTON_PRESSED_OUTLINE 20 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 10 + +#define ESP3D_CONTAINER_RADIUS 10 + +#define ESP3D_BUTTON_WIDTH (LV_HOR_RES / 6) +#define ESP3D_BUTTON_HEIGHT ESP3D_BUTTON_WIDTH + +#define ESP3D_SYMBOL_BUTTON_WIDTH 100 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 85 +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 300 +#endif // ESP3D_BUTTON_ANIMATION_DELAY + +#define ESP3D_SPINNER_SIZE 100 + +#define ESP3D_BACK_BUTTON_WIDTH 100 +#define ESP3D_BACK_BUTTON_HEIGHT 75 +#define ESP3D_MATRIX_BUTTON_WIDTH 100 +#define ESP3D_MATRIX_BUTTON_HEIGHT 75 +#define ESP3D_MATRIX_BUTTON_WIDTH 220 + +#define ESP3D_LIST_CONTAINER_LR_PAD 20 +#define ESP3D_LIST_LINE_HEIGHT 64 +#define ESP3D_LIST_LINE_BORDER_SIZE 4 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 80 + +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 10 #define FW_LOGO_Y -10 \ No newline at end of file diff --git a/main/display/3dprinter/repetier/screens/auto_leveling_screen.cpp b/main/display/3dprinter/repetier/screens/auto_leveling_screen.cpp index 9eba2990..f5f5b072 100644 --- a/main/display/3dprinter/repetier/screens/auto_leveling_screen.cpp +++ b/main/display/3dprinter/repetier/screens/auto_leveling_screen.cpp @@ -159,7 +159,7 @@ bool auto_leveling_value_cb(ESP3DValuesIndex index, const char *value, for (uint8_t i = 0; i <= col; i++) { lv_table_set_col_width( auto_leveling_screen_table, i, - ((LV_HOR_RES) - (2 * CURRENT_BUTTON_PRESSED_OUTLINE)) / + ((LV_HOR_RES) - (2 * ESP3D_BUTTON_PRESSED_OUTLINE)) / (col + 1)); } } @@ -186,13 +186,13 @@ bool auto_leveling_value_cb(ESP3DValuesIndex index, const char *value, if (max_col != -1 && col == max_col && row == 1) { esp3d_log( "Max col found is:%d, col wdith:%d", max_col, - ((LV_HOR_RES) - (2 * CURRENT_BUTTON_PRESSED_OUTLINE)) / max_col); + ((LV_HOR_RES) - (2 * ESP3D_BUTTON_PRESSED_OUTLINE)) / max_col); lv_table_set_col_cnt(auto_leveling_screen_table, max_col + 1); for (uint8_t i = 0; i <= max_col; i++) { lv_table_set_col_width( auto_leveling_screen_table, i, - ((LV_HOR_RES) - (2 * CURRENT_BUTTON_PRESSED_OUTLINE)) / + ((LV_HOR_RES) - (2 * ESP3D_BUTTON_PRESSED_OUTLINE)) / (max_col + 1)); } } @@ -242,10 +242,10 @@ void event_button_auto_leveling_start_handler(lv_event_t *e) { void event_button_fan_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (auto_leveling_screen_delay_timer) return; auto_leveling_screen_delay_timer = lv_timer_create( - auto_leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + auto_leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { auto_leveling_screen_delay_timer_cb(NULL); } @@ -263,26 +263,26 @@ void auto_leveling_screen() { lv_obj_del(ui_current_screen); homing_done = false; - btn_back = backButton::create_back_button(ui_new_screen); + btn_back = backButton::create(ui_new_screen); lv_obj_add_event_cb(btn_back, event_button_fan_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_update_layout(btn_back); // Create a table auto_leveling_screen_table = lv_table_create(ui_new_screen); lv_obj_set_size(auto_leveling_screen_table, - (LV_HOR_RES) - (2 * CURRENT_BUTTON_PRESSED_OUTLINE), - LV_VER_RES - (3 * CURRENT_BUTTON_PRESSED_OUTLINE) - + (LV_HOR_RES) - (2 * ESP3D_BUTTON_PRESSED_OUTLINE), + LV_VER_RES - (3 * ESP3D_BUTTON_PRESSED_OUTLINE) - lv_obj_get_height(btn_back)); - lv_obj_set_pos(auto_leveling_screen_table, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(auto_leveling_screen_table, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_clear_flag(auto_leveling_screen_table, LV_OBJ_FLAG_SCROLL_ELASTIC); lv_obj_set_style_radius(auto_leveling_screen_table, - CURRENT_BUTTON_RADIUS_VALUE, 0); + ESP3D_BUTTON_RADIUS , 0); // button start btn_start = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_PLAY, BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_PLAY, ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); lv_obj_align_to(btn_start, auto_leveling_screen_table, - LV_ALIGN_OUT_BOTTOM_MID, 0, CURRENT_BUTTON_PRESSED_OUTLINE); + LV_ALIGN_OUT_BOTTOM_MID, 0, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_add_event_cb(btn_start, event_button_auto_leveling_start_handler, LV_EVENT_CLICKED, NULL); @@ -291,9 +291,9 @@ void auto_leveling_screen() { ESP3DStyle::apply(label_status, ESP3DStyleType::bg_label); lv_label_set_text(label_status, ""); lv_obj_align_to(label_status, auto_leveling_screen_table, - LV_ALIGN_OUT_BOTTOM_LEFT, 0, CURRENT_BUTTON_PRESSED_OUTLINE); + LV_ALIGN_OUT_BOTTOM_LEFT, 0, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_set_width(label_status, LV_HOR_RES - - (3 * CURRENT_BUTTON_PRESSED_OUTLINE) - + (3 * ESP3D_BUTTON_PRESSED_OUTLINE) - lv_obj_get_width(btn_start)); lv_label_set_long_mode(label_status, LV_LABEL_LONG_SCROLL_CIRCULAR); esp3dTftui.set_current_screen(ESP3DScreenType::auto_leveling); diff --git a/main/display/3dprinter/repetier/screens/fan_screen.cpp b/main/display/3dprinter/repetier/screens/fan_screen.cpp index 320c925f..4bc7e6bf 100644 --- a/main/display/3dprinter/repetier/screens/fan_screen.cpp +++ b/main/display/3dprinter/repetier/screens/fan_screen.cpp @@ -92,14 +92,14 @@ bool updateBtnMatrix() { ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); - lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); + lv_obj_set_size(btnm_target, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); esp3d_log("child count: %d", i); // lv_obj_add_state(obj, LV_STATE_DISABLED); if (fan_buttons_map_id > i) fan_buttons_map_id = 0; lv_btnmatrix_set_btn_ctrl(btnm_target, fan_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align_to(btnm_target, btnback, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); return true; } @@ -113,10 +113,10 @@ void fan_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_fan_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (fan_screen_delay_timer) return; fan_screen_delay_timer = lv_timer_create(fan_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { fan_screen_delay_timer_cb(NULL); } @@ -308,7 +308,7 @@ void fan_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - btnback = backButton::create_back_button(ui_new_screen); + btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_fan_back_handler, LV_EVENT_CLICKED, NULL); @@ -318,9 +318,9 @@ void fan_screen() { ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(fan_steps_buttons_map) / sizeof(fan_steps_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, fan_steps_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_add_event_cb(btnm, fan_steps_matrix_buttons_event_cb, @@ -331,7 +331,7 @@ void fan_screen() { lv_label_set_text(label_current_fan, fan_buttons_map[fan_buttons_map_id]); ESP3DStyle::apply(label_current_fan, ESP3DStyleType::bg_label); lv_obj_align(label_current_fan, LV_ALIGN_TOP_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_fan); // Current Fan value @@ -343,7 +343,7 @@ void fan_screen() { ESP3DStyle::apply(label_current_fan_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_fan_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_fan_value, label_current_fan, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit @@ -351,13 +351,13 @@ void fan_screen() { lv_label_set_text(label_unit1, "%"); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_fan_value, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_UP "\n" LV_SYMBOL_PLUS); lv_obj_align_to(btn_up, label_current_fan_value, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // fan input lv_obj_t *fan_ta = lv_textarea_create(ui_new_screen); lv_obj_add_event_cb(fan_ta, fan_ta_event_cb, LV_EVENT_VALUE_CHANGED, NULL); @@ -368,27 +368,27 @@ void fan_screen() { lv_obj_set_style_text_align(fan_ta, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_width(fan_ta, LV_HOR_RES / 6); lv_obj_align_to(fan_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_FAN); ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_align_to(label_ta, fan_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, "%"); ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, fan_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // button down lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, fan_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, fan_btn_down_event_cb, LV_EVENT_CLICKED, fan_ta); @@ -398,14 +398,14 @@ void fan_screen() { lv_obj_t *btn_ok = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_OK); lv_obj_align_to(btn_ok, label_unit2, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_ok, fan_btn_ok_event_cb, LV_EVENT_CLICKED, fan_ta); // Button Reset lv_obj_t *btn_reset = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_POWER); lv_obj_align_to(btn_reset, btn_ok, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_reset, fan_btn_reset_event_cb, LV_EVENT_CLICKED, fan_ta); @@ -414,11 +414,11 @@ void fan_screen() { lv_keyboard_set_mode(fan_kb, LV_KEYBOARD_MODE_NUMBER); lv_keyboard_set_textarea(fan_kb, NULL); lv_obj_align_to(fan_kb, fan_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_update_layout(fan_kb); lv_obj_set_content_width(fan_kb, LV_HOR_RES - lv_obj_get_x(fan_kb) - - 2 * CURRENT_BUTTON_PRESSED_OUTLINE); - lv_obj_set_style_radius(fan_kb, CURRENT_BUTTON_RADIUS_VALUE, LV_PART_MAIN); + 2 * ESP3D_BUTTON_PRESSED_OUTLINE); + lv_obj_set_style_radius(fan_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(fan_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(fan_ta, fan_ta_event_cb, LV_EVENT_ALL, fan_kb); diff --git a/main/display/3dprinter/repetier/screens/filament_screen.cpp b/main/display/3dprinter/repetier/screens/filament_screen.cpp index 5e277be1..149de819 100644 --- a/main/display/3dprinter/repetier/screens/filament_screen.cpp +++ b/main/display/3dprinter/repetier/screens/filament_screen.cpp @@ -94,14 +94,14 @@ bool updateBtnMatrix() { ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); - lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); + lv_obj_set_size(btnm_target, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); esp3d_log("child count: %d", i); // lv_obj_add_state(obj, LV_STATE_DISABLED); if (filament_buttons_map_id > i) filament_buttons_map_id = 0; lv_btnmatrix_set_btn_ctrl(btnm_target, filament_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align_to(btnm_target, btnback, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); return true; } @@ -124,10 +124,10 @@ void filament_screen_edit_delay_timer_cb(lv_timer_t *timer) { void event_button_filament_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (filament_screen_delay_timer) return; filament_screen_delay_timer = lv_timer_create( - filament_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + filament_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { filament_screen_delay_timer_cb(NULL); } @@ -135,10 +135,10 @@ void event_button_filament_back_handler(lv_event_t *e) { void event_button_filament_edit_handler(lv_event_t *e) { esp3d_log("edit Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (filament_screen_delay_timer) return; filament_screen_delay_timer = lv_timer_create( - filament_screen_edit_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + filament_screen_edit_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { filament_screen_edit_delay_timer_cb(NULL); } @@ -292,7 +292,7 @@ void filament_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - btnback = backButton::create_back_button(ui_new_screen); + btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_filament_back_handler, LV_EVENT_CLICKED, NULL); @@ -303,9 +303,9 @@ void filament_screen() { size_t i = (sizeof(filament_distance_steps_buttons_map) / sizeof(filament_distance_steps_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, filament_distance_steps_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); @@ -321,8 +321,8 @@ void filament_screen() { lv_obj_set_style_transform_angle(label_ta, 900, 0); lv_obj_update_layout(label_ta); - size_t x = lv_obj_get_width(label_ta) + (2 * CURRENT_BUTTON_PRESSED_OUTLINE); - size_t y = MATRIX_BUTTON_HEIGHT + CURRENT_BUTTON_PRESSED_OUTLINE; + size_t x = lv_obj_get_width(label_ta) + (2 * ESP3D_BUTTON_PRESSED_OUTLINE); + size_t y = ESP3D_MATRIX_BUTTON_HEIGHT + ESP3D_BUTTON_PRESSED_OUTLINE; // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( @@ -342,14 +342,14 @@ void filament_screen() { lv_obj_set_style_text_align(filament_ta, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_width(filament_ta, LV_HOR_RES / 6); lv_obj_align_to(filament_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btnm, filament_distance_steps_matrix_buttons_event_cb, LV_EVENT_VALUE_CHANGED, filament_ta); // Text area label lv_obj_align_to(label_ta, filament_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); @@ -357,7 +357,7 @@ void filament_screen() { esp3dTranslationService.translate(ESP3DLabel::millimeters)); ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, filament_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Current filament label label_current_temperature_filament = lv_label_create(ui_new_screen); @@ -365,7 +365,7 @@ void filament_screen() { filament_buttons_map[filament_buttons_map_id]); ESP3DStyle::apply(label_current_temperature_filament, ESP3DStyleType::bg_label); lv_obj_align_to(label_current_temperature_filament, label_unit2, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE * 3, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE * 3, 0); lv_obj_update_layout(label_current_temperature_filament); @@ -384,7 +384,7 @@ void filament_screen() { lv_obj_set_width(label_current_temperature_filament_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_temperature_filament_value, label_current_temperature_filament, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); @@ -392,13 +392,13 @@ void filament_screen() { esp3dTranslationService.translate(ESP3DLabel::celsius)); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_temperature_filament_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_t *btn_edit = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_EDIT); lv_obj_align_to(btn_edit, label_unit1, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_add_event_cb(btn_edit, event_button_filament_edit_handler, LV_EVENT_CLICKED, NULL); @@ -406,7 +406,7 @@ void filament_screen() { lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, filament_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, filament_btn_down_event_cb, LV_EVENT_CLICKED, filament_ta); @@ -418,11 +418,11 @@ void filament_screen() { lv_keyboard_set_mode(filament_kb, LV_KEYBOARD_MODE_NUMBER); lv_keyboard_set_textarea(filament_kb, NULL); lv_obj_align_to(filament_kb, filament_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_update_layout(filament_kb); lv_obj_set_content_width(filament_kb, LV_HOR_RES - lv_obj_get_x(filament_kb) - - 2 * CURRENT_BUTTON_PRESSED_OUTLINE); - lv_obj_set_style_radius(filament_kb, CURRENT_BUTTON_RADIUS_VALUE, + 2 * ESP3D_BUTTON_PRESSED_OUTLINE); + lv_obj_set_style_radius(filament_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(filament_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(filament_ta, filament_ta_event_cb, LV_EVENT_ALL, diff --git a/main/display/3dprinter/repetier/screens/informations_screen.cpp b/main/display/3dprinter/repetier/screens/informations_screen.cpp index dbf0d3de..3366ab62 100644 --- a/main/display/3dprinter/repetier/screens/informations_screen.cpp +++ b/main/display/3dprinter/repetier/screens/informations_screen.cpp @@ -64,10 +64,10 @@ void informations_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_informations_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (informations_screen_delay_timer) return; informations_screen_delay_timer = lv_timer_create( - informations_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + informations_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else informations_screen_delay_timer_cb(NULL); } @@ -97,7 +97,7 @@ void informations_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_informations_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_update_layout(btnback); @@ -107,16 +107,16 @@ void informations_screen() { ESP3DStyle::apply(ui_info_list_ctl, ESP3DStyleType::status_list); lv_obj_update_layout(ui_new_screen); - lv_obj_set_pos(ui_info_list_ctl, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(ui_info_list_ctl, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_set_size( - ui_info_list_ctl, LV_HOR_RES - CURRENT_BUTTON_PRESSED_OUTLINE * 2, - lv_obj_get_height(ui_new_screen) - (CURRENT_BUTTON_PRESSED_OUTLINE * 3) - + ui_info_list_ctl, LV_HOR_RES - ESP3D_BUTTON_PRESSED_OUTLINE * 2, + lv_obj_get_height(ui_new_screen) - (ESP3D_BUTTON_PRESSED_OUTLINE * 3) - lv_obj_get_height(btnback)); - lv_obj_set_style_radius(ui_info_list_ctl, CURRENT_CONTAINER_RADIUS, 0); - lv_obj_set_style_pad_left(ui_info_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_radius(ui_info_list_ctl, ESP3D_CONTAINER_RADIUS, 0); + lv_obj_set_style_pad_left(ui_info_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); - lv_obj_set_style_pad_right(ui_info_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_right(ui_info_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); addInformationToList(ui_info_list_ctl, ESP3DLabel::screen, TFT_TARGET); diff --git a/main/display/3dprinter/repetier/screens/leveling_screen.cpp b/main/display/3dprinter/repetier/screens/leveling_screen.cpp index 8c36e052..006e32a5 100644 --- a/main/display/3dprinter/repetier/screens/leveling_screen.cpp +++ b/main/display/3dprinter/repetier/screens/leveling_screen.cpp @@ -72,10 +72,10 @@ void event_button_leveling_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); if (leveling_screen_delay_timer) return; leveling_next_screen = ESP3DScreenType::menu; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (leveling_screen_delay_timer) return; leveling_screen_delay_timer = lv_timer_create( - leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { leveling_screen_delay_timer_cb(NULL); } @@ -85,10 +85,10 @@ void event_button_manual_handler(lv_event_t *e) { esp3d_log("MANUAL Clicked"); if (leveling_screen_delay_timer) return; leveling_next_screen = ESP3DScreenType::manual_leveling; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (leveling_screen_delay_timer) return; leveling_screen_delay_timer = lv_timer_create( - leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { leveling_screen_delay_timer_cb(NULL); } @@ -98,10 +98,10 @@ void event_button_auto_handler(lv_event_t *e) { esp3d_log("AUTO Clicked"); if (leveling_screen_delay_timer) return; leveling_next_screen = ESP3DScreenType::auto_leveling; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (leveling_screen_delay_timer) return; leveling_screen_delay_timer = lv_timer_create( - leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { leveling_screen_delay_timer_cb(NULL); } @@ -119,7 +119,7 @@ void leveling_screen(bool autoleveling) { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - btnback = backButton::create_back_button(ui_new_screen); + btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_leveling_back_handler, LV_EVENT_CLICKED, NULL); @@ -137,13 +137,13 @@ void leveling_screen(bool autoleveling) { // Create button and label for manual leveling btn = symbolButton::create_symbol_button( ui_buttons_container, LV_SYMBOL_MANUAL "\n" LV_SYMBOL_LEVELING, - BUTTON_WIDTH, BUTTON_WIDTH); + ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_WIDTH); lv_obj_add_event_cb(btn, event_button_manual_handler, LV_EVENT_CLICKED, NULL); // Create button and label for auto leveling btn = symbolButton::create_symbol_button( ui_buttons_container, LV_SYMBOL_AUTOMATIC "\n" LV_SYMBOL_LEVELING, - BUTTON_WIDTH, BUTTON_WIDTH); + ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_WIDTH); lv_obj_add_event_cb(btn, event_button_auto_handler, LV_EVENT_CLICKED, NULL); esp3dTftui.set_current_screen(ESP3DScreenType::leveling); } diff --git a/main/display/3dprinter/repetier/screens/main_screen.cpp b/main/display/3dprinter/repetier/screens/main_screen.cpp index 34d68a48..88a95282 100644 --- a/main/display/3dprinter/repetier/screens/main_screen.cpp +++ b/main/display/3dprinter/repetier/screens/main_screen.cpp @@ -505,10 +505,10 @@ void event_button_E0_handler(lv_event_t *e) { if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::temperatures; main_screen_temperature_target = 0; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -519,10 +519,10 @@ void event_button_E1_handler(lv_event_t *e) { if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::temperatures; main_screen_temperature_target = 1; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -533,10 +533,10 @@ void event_button_Bed_handler(lv_event_t *e) { if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::temperatures; main_screen_temperature_target = 2; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -546,10 +546,10 @@ void event_button_positions_handler(lv_event_t *e) { esp3d_log("Positions Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::positions; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -559,10 +559,10 @@ void event_button_fan_handler(lv_event_t *e) { esp3d_log("Fan Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::fan; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -572,10 +572,10 @@ void event_button_speed_handler(lv_event_t *e) { esp3d_log("Speed Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::speed; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -586,10 +586,10 @@ void event_button_files_handler(lv_event_t *e) { esp3d_log("Files Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::files; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -600,10 +600,10 @@ void event_button_menu_handler(lv_event_t *e) { esp3d_log("Menu Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::menu; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else main_screen_delay_timer_cb(NULL); } @@ -714,7 +714,7 @@ void main_screen() { // Create button and label for positions main_btn_positions = symbolButton::create_symbol_button( - ui_top_buttons_container, "", BUTTON_WIDTH * 1.5, BUTTON_HEIGHT); + ui_top_buttons_container, "", ESP3D_BUTTON_WIDTH * 1.5, ESP3D_BUTTON_HEIGHT); lv_obj_add_event_cb(main_btn_positions, event_button_positions_handler, LV_EVENT_CLICKED, NULL); @@ -724,8 +724,8 @@ void main_screen() { ESP3DStyle::apply(main_label_progression_area, ESP3DStyleType::status_bar); lv_obj_center(main_label_progression_area); - lv_obj_set_size(main_label_progression_area, CURRENT_STATUS_AREA_WIDTH, - CURRENT_STATUS_AREA_HEIGHT); + lv_obj_set_size(main_label_progression_area, ESP3D_STATUS_BAR_WIDTH, + ESP3D_STATUS_BAR_HEIGHT); if (show_fan_button) { // Create button and label for fan main_btn_fan = diff --git a/main/display/3dprinter/repetier/screens/manual_leveling_screen.cpp b/main/display/3dprinter/repetier/screens/manual_leveling_screen.cpp index fbf5e613..57a07185 100644 --- a/main/display/3dprinter/repetier/screens/manual_leveling_screen.cpp +++ b/main/display/3dprinter/repetier/screens/manual_leveling_screen.cpp @@ -84,10 +84,10 @@ void manual_leveling_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_manual_leveling_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (manual_leveling_screen_delay_timer) return; manual_leveling_screen_delay_timer = lv_timer_create( - manual_leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + manual_leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { manual_leveling_screen_delay_timer_cb(NULL); } @@ -372,7 +372,7 @@ void manual_leveling_screen(bool autoleveling) { lv_obj_del(ui_current_screen); // Button back - lv_obj_t *btn_back = backButton::create_back_button(ui_new_screen); + lv_obj_t *btn_back = backButton::create(ui_new_screen); lv_obj_add_event_cb(btn_back, event_button_manual_leveling_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_update_layout(btn_back); @@ -382,10 +382,10 @@ void manual_leveling_screen(bool autoleveling) { lv_btnmatrix_set_map(btnm_leveling_position, leveling_position_buttons_map); ESP3DStyle::apply(btnm_leveling_position, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_leveling_position); - lv_obj_set_pos(btnm_leveling_position, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(btnm_leveling_position, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_set_size(btnm_leveling_position, LV_HOR_RES / 2, - LV_VER_RES - (CURRENT_BUTTON_PRESSED_OUTLINE * 3) - + LV_VER_RES - (ESP3D_BUTTON_PRESSED_OUTLINE * 3) - lv_obj_get_height(btn_back)); lv_obj_add_event_cb(btnm_leveling_position, leveling_posiiton_matrix_buttons_event_cb, @@ -393,34 +393,34 @@ void manual_leveling_screen(bool autoleveling) { // Button Previous btn_previous = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_PREVIOUS, BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_PREVIOUS, ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); lv_obj_align(btn_previous, LV_ALIGN_BOTTOM_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, -CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, -ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_add_event_cb(btn_previous, event_button_manual_leveling_previous_handler, LV_EVENT_CLICKED, btnm_leveling_position); // Button Next btn_next = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_NEXT, BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_NEXT, ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); lv_obj_align_to(btn_next, btnm_leveling_position, LV_ALIGN_OUT_BOTTOM_RIGHT, - 0, CURRENT_BUTTON_PRESSED_OUTLINE); + 0, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_add_event_cb(btn_next, event_button_manual_leveling_next_handler, LV_EVENT_CLICKED, btnm_leveling_position); // Help button lv_obj_t *btn_help = symbolButton::create_symbol_button( - ui_new_screen, "?", BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); - lv_obj_align(btn_help, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + ui_new_screen, "?", ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); + lv_obj_align(btn_help, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_add_event_cb(btn_help, event_button_manual_leveling_help_handler, LV_EVENT_CLICKED, NULL); // Start button btn_start = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_PLAY); lv_obj_align_to(btn_start, btnm_leveling_position, LV_ALIGN_OUT_RIGHT_MID, - (LV_HOR_RES / 4) - SYMBOL_BUTTON_WIDTH / 2, 0); + (LV_HOR_RES / 4) - ESP3D_SYMBOL_BUTTON_WIDTH / 2, 0); lv_obj_add_event_cb(btn_start, event_button_manual_leveling_start_handler, LV_EVENT_CLICKED, btnm_leveling_position); @@ -429,11 +429,11 @@ void manual_leveling_screen(bool autoleveling) { ESP3DStyle::apply(status_container, ESP3DStyleType::text_container); lv_obj_set_size(status_container, - (LV_HOR_RES / 2) - (3 * CURRENT_BUTTON_PRESSED_OUTLINE), - LV_VER_RES - (CURRENT_BUTTON_PRESSED_OUTLINE * 4) - + (LV_HOR_RES / 2) - (3 * ESP3D_BUTTON_PRESSED_OUTLINE), + LV_VER_RES - (ESP3D_BUTTON_PRESSED_OUTLINE * 4) - lv_obj_get_height(btn_back) * 2); lv_obj_align_to(status_container, btn_help, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); // status text std::string t = diff --git a/main/display/3dprinter/repetier/screens/menu_screen.cpp b/main/display/3dprinter/repetier/screens/menu_screen.cpp index 85383e6e..9d6a50d5 100644 --- a/main/display/3dprinter/repetier/screens/menu_screen.cpp +++ b/main/display/3dprinter/repetier/screens/menu_screen.cpp @@ -133,10 +133,10 @@ void event_button_menu_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::main; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { menu_screen_delay_timer_cb(NULL); } @@ -146,10 +146,10 @@ void event_button_filament_handler(lv_event_t *e) { esp3d_log("filament Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::filament; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { menu_screen_delay_timer_cb(NULL); } @@ -160,10 +160,10 @@ void event_button_wifi_handler(lv_event_t *e) { esp3d_log("wifi Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::wifi; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { menu_screen_delay_timer_cb(NULL); } @@ -174,10 +174,10 @@ void event_button_settings_handler(lv_event_t *e) { esp3d_log("settings Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::settings; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else menu_screen_delay_timer_cb(NULL); } @@ -186,10 +186,10 @@ void event_button_leveling_handler(lv_event_t *e) { esp3d_log("leveling Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::leveling; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else menu_screen_delay_timer_cb(NULL); } @@ -198,10 +198,10 @@ void event_button_informations_handler(lv_event_t *e) { esp3d_log("informations Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::informations; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else menu_screen_delay_timer_cb(NULL); } @@ -234,7 +234,7 @@ void menu_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_menu_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_t *ui_main_container = mainContainer::create_main_container( @@ -258,7 +258,7 @@ void menu_screen() { // Create button and label for filament button lv_obj_t *btn1 = symbolButton::create_symbol_button( - ui_top_buttons_container, LV_SYMBOL_FILAMENT, BUTTON_WIDTH, BUTTON_HEIGHT, + ui_top_buttons_container, LV_SYMBOL_FILAMENT, ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_HEIGHT, true, false, 90); lv_obj_add_event_cb(btn1, event_button_filament_handler, LV_EVENT_CLICKED, NULL); @@ -272,7 +272,7 @@ void menu_screen() { // Create button and label for disable steppers button main_btn_disable_steppers = symbolButton::create_symbol_button( - ui_top_buttons_container, LV_SYMBOL_ENGINE, BUTTON_WIDTH, BUTTON_HEIGHT, + ui_top_buttons_container, LV_SYMBOL_ENGINE, ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_HEIGHT, true, true, 90); lv_obj_add_event_cb(main_btn_disable_steppers, event_button_disable_steppers_handler, LV_EVENT_CLICKED, diff --git a/main/display/3dprinter/repetier/screens/positions_screen.cpp b/main/display/3dprinter/repetier/screens/positions_screen.cpp index 44b60999..543ca46c 100644 --- a/main/display/3dprinter/repetier/screens/positions_screen.cpp +++ b/main/display/3dprinter/repetier/screens/positions_screen.cpp @@ -93,10 +93,10 @@ void positions_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_positions_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (positions_screen_delay_timer) return; positions_screen_delay_timer = lv_timer_create( - positions_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + positions_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { positions_screen_delay_timer_cb(NULL); } @@ -312,7 +312,7 @@ void positions_screen(uint8_t target_id) { lv_obj_del(ui_current_screen); // back button - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_positions_back_handler, LV_EVENT_CLICKED, NULL); @@ -322,9 +322,9 @@ void positions_screen(uint8_t target_id) { ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(positions_buttons_map) / sizeof(positions_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, positions_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_add_event_cb(btnm, positions_matrix_buttons_event_cb, @@ -335,18 +335,18 @@ void positions_screen(uint8_t target_id) { lv_btnmatrix_set_map(btnm_target, axis_buttons_map); ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); size_t i2 = (sizeof(axis_buttons_map) / sizeof(axis_buttons_map[0])) - 1; - lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i2, MATRIX_BUTTON_HEIGHT); + lv_obj_set_size(btnm_target, ESP3D_MATRIX_BUTTON_WIDTH * i2, ESP3D_MATRIX_BUTTON_HEIGHT); lv_btnmatrix_set_btn_ctrl(btnm_target, axis_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align_to(btnm_target, btnback, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); // Home all axis lv_obj_t *btn_home_all = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_HOME "xyz", MATRIX_BUTTON_WIDTH, - MATRIX_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_HOME "xyz", ESP3D_MATRIX_BUTTON_WIDTH, + ESP3D_MATRIX_BUTTON_HEIGHT); lv_obj_align_to(btn_home_all, btnm_target, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); // Label current axis label_current_position = lv_label_create(ui_new_screen); @@ -355,7 +355,7 @@ void positions_screen(uint8_t target_id) { // according axis ESP3DStyle::apply(label_current_position, ESP3DStyleType::bg_label); lv_obj_align(label_current_position, LV_ALIGN_TOP_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_position); // Label current axis e @@ -386,7 +386,7 @@ void positions_screen(uint8_t target_id) { ESP3DStyle::apply(label_current_position_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_position_value, LV_HOR_RES / 5); lv_obj_align_to(label_current_position_value, label_current_position, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); @@ -394,13 +394,13 @@ void positions_screen(uint8_t target_id) { esp3dTranslationService.translate(ESP3DLabel::millimeters)); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_position_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_UP "\n" LV_SYMBOL_PLUS); lv_obj_align_to(btn_up, label_current_position_value, LV_ALIGN_OUT_BOTTOM_MID, - 0, CURRENT_BUTTON_PRESSED_OUTLINE); + 0, ESP3D_BUTTON_PRESSED_OUTLINE); // Text area position_ta = lv_textarea_create(ui_new_screen); lv_obj_add_event_cb(position_ta, position_ta_event_cb, LV_EVENT_VALUE_CHANGED, @@ -419,7 +419,7 @@ void positions_screen(uint8_t target_id) { lv_obj_set_width(position_ta, LV_HOR_RES / 5); lv_obj_align_to(position_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_up, positions_btn_up_event_cb, LV_EVENT_CLICKED, position_ta); @@ -431,7 +431,7 @@ void positions_screen(uint8_t target_id) { // axis ESP3DStyle::apply(label_target, ESP3DStyleType::bg_label); lv_obj_align_to(label_target, position_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); @@ -440,18 +440,18 @@ void positions_screen(uint8_t target_id) { ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, position_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // set button btn_set = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_OK); lv_obj_align_to(btn_set, label_unit2, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_set, positions_btn_ok_event_cb, LV_EVENT_CLICKED, position_ta); // Home axis lv_obj_t *btn_home_axis = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_HOME); lv_obj_align_to(btn_home_axis, btn_set, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_home_axis, positions_btn_home_axis_event_cb, LV_EVENT_CLICKED, position_ta); lv_obj_add_event_cb(btn_home_all, home_all_axis_button_event_cb, @@ -469,7 +469,7 @@ void positions_screen(uint8_t target_id) { &absolute_position); lv_obj_align_to(btn_mode, btnm, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // Keyboard lv_obj_t *positions_kb = lv_keyboard_create(ui_new_screen); @@ -478,11 +478,11 @@ void positions_screen(uint8_t target_id) { lv_obj_update_layout(label_unit2); lv_obj_set_content_width(positions_kb, LV_HOR_RES - (lv_obj_get_x(label_unit2) + - CURRENT_BUTTON_PRESSED_OUTLINE)); + ESP3D_BUTTON_PRESSED_OUTLINE)); lv_obj_align_to(positions_kb, position_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2); - lv_obj_set_style_radius(positions_kb, CURRENT_BUTTON_RADIUS_VALUE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2, + -ESP3D_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_style_radius(positions_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(positions_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(position_ta, position_ta_event_cb, LV_EVENT_ALL, @@ -491,7 +491,7 @@ void positions_screen(uint8_t target_id) { lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, position_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, positions_btn_down_event_cb, LV_EVENT_CLICKED, position_ta); updateMode(absolute_position); diff --git a/main/display/3dprinter/repetier/screens/settings_screen.cpp b/main/display/3dprinter/repetier/screens/settings_screen.cpp index 7601a4ac..0e0b3685 100644 --- a/main/display/3dprinter/repetier/screens/settings_screen.cpp +++ b/main/display/3dprinter/repetier/screens/settings_screen.cpp @@ -556,7 +556,7 @@ void event_button_edit_setting_cb(lv_event_t *e) { } data.value = lv_label_get_text(data.label); if (data.choices.size() > 0) { - choiceEditor::create_choice_editor(lv_scr_act(), data.value.c_str(), + choiceEditor::create(lv_scr_act(), data.value.c_str(), title.c_str(), data.choices, setting_edit_done_cb, (void *)(&data)); } else { @@ -598,10 +598,10 @@ void event_button_edit_setting_cb(lv_event_t *e) { // event_button_settings_back_handler void event_button_settings_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (settings_screen_delay_timer) return; settings_screen_delay_timer = lv_timer_create( - settings_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + settings_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { settings_screen_delay_timer_cb(NULL); } @@ -618,32 +618,32 @@ void settings_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_settings_back_handler, LV_EVENT_CLICKED, NULL); ui_settings_list_ctl = lv_list_create(ui_new_screen); lv_obj_clear_flag(ui_settings_list_ctl, LV_OBJ_FLAG_SCROLL_ELASTIC); - lv_obj_set_style_pad_left(ui_settings_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_left(ui_settings_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); - lv_obj_set_style_pad_right(ui_settings_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_right(ui_settings_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); lv_obj_set_size( - ui_settings_list_ctl, LV_HOR_RES - CURRENT_BUTTON_PRESSED_OUTLINE * 2, + ui_settings_list_ctl, LV_HOR_RES - ESP3D_BUTTON_PRESSED_OUTLINE * 2, LV_VER_RES - - ((3 * CURRENT_BUTTON_PRESSED_OUTLINE) + lv_obj_get_height(btnback))); + ((3 * ESP3D_BUTTON_PRESSED_OUTLINE) + lv_obj_get_height(btnback))); - lv_obj_set_pos(ui_settings_list_ctl, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(ui_settings_list_ctl, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_t *line_container = NULL; std::string LabelStr = ""; // Language - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::ui_language); if (line_container) { std::string ui_language; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_ui_language); esp3d_log("Looking for index %d", @@ -661,19 +661,19 @@ void settings_screen() { ui_language = "English"; } language_label = - listLine::add_label_to_line(ui_language.c_str(), line_container, true); + listLine::add_label(ui_language.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } // Hostname - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::hostname); if (line_container) { std::string hostname; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_hostname); if (settingPtr) { @@ -682,9 +682,9 @@ void settings_screen() { out_str, settingPtr->size); } hostname_label = - listLine::add_label_to_line(hostname.c_str(), line_container, true); + listLine::add_label(hostname.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -692,23 +692,23 @@ void settings_screen() { // Extensions static ESP3DSettingIndex extensions_setting_index = ESP3DSettingIndex::esp3d_extensions; - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::extensions); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); - extensions_label = listLine::add_label_to_line("", line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); + extensions_label = listLine::add_label("", line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)&(extensions_setting_index)); } #if ESP3D_USB_SERIAL_FEATURE // USB Serial - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::output_client); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_output_client); if (settingPtr) { @@ -721,9 +721,9 @@ void settings_screen() { ? esp3dTranslationService.translate(ESP3DLabel::usb) : "???"; output_client_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -731,10 +731,10 @@ void settings_screen() { #endif // ESP3D_USB_SERIAL_FEATURE // Serial Baud rate - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::serial_baud_rate); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_baud_rate); if (settingPtr) { @@ -742,9 +742,9 @@ void settings_screen() { esp3dTftsettings.readUint32(ESP3DSettingIndex::esp3d_baud_rate); std::string value = std::to_string(val); serial_baud_rate_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -752,10 +752,10 @@ void settings_screen() { #if ESP3D_USB_SERIAL_FEATURE // USB serial Baud rate - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::usb_baud_rate); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr( ESP3DSettingIndex::esp3d_usb_serial_baud_rate); if (settingPtr) { @@ -763,9 +763,9 @@ void settings_screen() { ESP3DSettingIndex::esp3d_usb_serial_baud_rate); std::string value = std::to_string(val); usb_serial_baud_rate_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -773,10 +773,10 @@ void settings_screen() { #endif // ESP3D_USB_SERIAL_FEATURE // Jog type - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::jog_type); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_jog_type); if (settingPtr) { @@ -786,19 +786,19 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::relative) : esp3dTranslationService.translate(ESP3DLabel::absolute); jog_type_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } } // Polling on - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::polling); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_polling_on); if (settingPtr) { @@ -808,9 +808,9 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); polling_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -820,23 +820,23 @@ void settings_screen() { // show fan controls static ESP3DSettingIndex show_fan_controls_setting_index = ESP3DSettingIndex::esp3d_show_fan_controls; - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::fan_controls); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); show_fan_controls_label = - listLine::add_label_to_line("", line_container, true); + listLine::add_label("", line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)&(show_fan_controls_setting_index)); } // Auto level on - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::auto_leveling); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_auto_level_on); if (settingPtr) { @@ -846,20 +846,20 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); auto_leveling_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } } // Bed width - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::bed_width); if (line_container) { std::string bed_width_str; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_bed_width); if (settingPtr) { @@ -869,20 +869,20 @@ void settings_screen() { } else { esp3d_log_e("Failed to get bed width setting"); } - bed_width_label = listLine::add_label_to_line(bed_width_str.c_str(), + bed_width_label = listLine::add_label(bed_width_str.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } // Bed depth - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::bed_depth); if (line_container) { std::string bed_depth_str; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_bed_depth); if (settingPtr) { @@ -892,19 +892,19 @@ void settings_screen() { } else { esp3d_log_e("Failed to get bed depth setting"); } - bed_depth_label = listLine::add_label_to_line(bed_depth_str.c_str(), + bed_depth_label = listLine::add_label(bed_depth_str.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } // Invert X axis - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::invert_axis, "X"); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_inverved_x); if (settingPtr) { @@ -914,19 +914,19 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); inverted_x_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } } // Invert Y axis - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::invert_axis, "Y"); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_inverved_y); if (settingPtr) { @@ -936,9 +936,9 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); inverted_y_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } diff --git a/main/display/3dprinter/repetier/screens/speed_screen.cpp b/main/display/3dprinter/repetier/screens/speed_screen.cpp index 4f8c496b..cca7df8a 100644 --- a/main/display/3dprinter/repetier/screens/speed_screen.cpp +++ b/main/display/3dprinter/repetier/screens/speed_screen.cpp @@ -52,10 +52,10 @@ void speed_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_speed_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (speed_screen_delay_timer) return; speed_screen_delay_timer = lv_timer_create(speed_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { speed_screen_delay_timer_cb(NULL); } @@ -165,7 +165,7 @@ void speed_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_speed_back_handler, LV_EVENT_CLICKED, NULL); @@ -174,9 +174,9 @@ void speed_screen() { lv_btnmatrix_set_map(btnm, speed_buttons_map); ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(speed_buttons_map) / sizeof(speed_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, speed_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_add_event_cb(btnm, speed_matrix_buttons_event_cb, @@ -187,7 +187,7 @@ void speed_screen() { lv_label_set_text(label_current_speed, LV_SYMBOL_SPEED); ESP3DStyle::apply(label_current_speed, ESP3DStyleType::bg_label); lv_obj_align(label_current_speed, LV_ALIGN_TOP_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_speed); // Current Speed value @@ -200,7 +200,7 @@ void speed_screen() { ESP3DStyle::apply(label_current_speed_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_speed_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_speed_value, label_current_speed, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit @@ -208,14 +208,14 @@ void speed_screen() { lv_label_set_text(label_unit1, "%"); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_speed_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_UP "\n" LV_SYMBOL_PLUS); lv_obj_align_to(btn_up, label_current_speed_value, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // speed input lv_obj_t *speed_ta = lv_textarea_create(ui_new_screen); lv_obj_add_event_cb(speed_ta, speed_ta_event_cb, LV_EVENT_VALUE_CHANGED, @@ -227,27 +227,27 @@ void speed_screen() { lv_obj_set_style_text_align(speed_ta, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_width(speed_ta, LV_HOR_RES / 6); lv_obj_align_to(speed_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_SPEED); ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_align_to(label_ta, speed_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, "%"); ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, speed_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // button down lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, speed_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, speed_btn_down_event_cb, LV_EVENT_CLICKED, speed_ta); @@ -258,7 +258,7 @@ void speed_screen() { lv_obj_t *btn_ok = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_OK); lv_obj_align_to(btn_ok, label_unit2, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_ok, speed_btn_ok_event_cb, LV_EVENT_CLICKED, speed_ta); @@ -266,7 +266,7 @@ void speed_screen() { lv_obj_t *btn_reset = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_GAUGE); lv_obj_align_to(btn_reset, btn_ok, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_reset, speed_btn_reset_event_cb, LV_EVENT_CLICKED, speed_ta); @@ -275,11 +275,11 @@ void speed_screen() { lv_keyboard_set_mode(speed_kb, LV_KEYBOARD_MODE_NUMBER); lv_keyboard_set_textarea(speed_kb, NULL); lv_obj_align_to(speed_kb, speed_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_update_layout(speed_kb); lv_obj_set_content_width(speed_kb, LV_HOR_RES - lv_obj_get_x(speed_kb) - - 2 * CURRENT_BUTTON_PRESSED_OUTLINE); - lv_obj_set_style_radius(speed_kb, CURRENT_BUTTON_RADIUS_VALUE, LV_PART_MAIN); + 2 * ESP3D_BUTTON_PRESSED_OUTLINE); + lv_obj_set_style_radius(speed_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(speed_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(speed_ta, speed_ta_event_cb, LV_EVENT_ALL, speed_kb); diff --git a/main/display/3dprinter/repetier/screens/temperatures_screen.cpp b/main/display/3dprinter/repetier/screens/temperatures_screen.cpp index fb9dbaa6..2a563f68 100644 --- a/main/display/3dprinter/repetier/screens/temperatures_screen.cpp +++ b/main/display/3dprinter/repetier/screens/temperatures_screen.cpp @@ -132,14 +132,14 @@ bool updateBtnMatrix() { ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); - lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); + lv_obj_set_size(btnm_target, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); esp3d_log("child count: %d", i); // lv_obj_add_state(obj, LV_STATE_DISABLED); if (heater_buttons_map_id > i) heater_buttons_map_id = 0; lv_btnmatrix_set_btn_ctrl(btnm_target, heater_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align_to(btnm_target, btnback, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); return true; } @@ -181,10 +181,10 @@ void temperatures_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_temperatures_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (temperatures_screen_delay_timer) return; temperatures_screen_delay_timer = lv_timer_create( - temperatures_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + temperatures_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { temperatures_screen_delay_timer_cb(NULL); } @@ -446,7 +446,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_del(ui_current_screen); // back button - btnback = backButton::create_back_button(ui_new_screen); + btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_temperatures_back_handler, LV_EVENT_CLICKED, NULL); @@ -457,9 +457,9 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { size_t i = (sizeof(temperatures_buttons_map) / sizeof(temperatures_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, temperatures_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_add_event_cb(btnm, temperatures_matrix_buttons_event_cb, @@ -472,10 +472,10 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // Power off all heater lv_obj_t *btn_power_off_all = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_POWER "...", MATRIX_BUTTON_WIDTH, - MATRIX_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_POWER "...", ESP3D_MATRIX_BUTTON_WIDTH, + ESP3D_MATRIX_BUTTON_HEIGHT); lv_obj_align_to(btn_power_off_all, btnm_target, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); // Label current heater label_current_temperature = lv_label_create(ui_new_screen); @@ -486,7 +486,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // heater ESP3DStyle::apply(label_current_temperature, ESP3DStyleType::bg_label); lv_obj_align(label_current_temperature, LV_ALIGN_TOP_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_temperature); // Label current heater e @@ -526,7 +526,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { ESP3DStyle::apply(label_current_temperature_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_temperature_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_temperature_value, label_current_temperature, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); @@ -534,14 +534,14 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { esp3dTranslationService.translate(ESP3DLabel::celsius)); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_temperature_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_UP "\n" LV_SYMBOL_PLUS); lv_obj_align_to(btn_up, label_current_temperature_value, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // Text area lv_obj_t *temperatures_ta = lv_textarea_create(ui_new_screen); lv_obj_add_event_cb(temperatures_ta, temperatures_ta_event_cb, @@ -559,7 +559,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_set_width(temperatures_ta, LV_HOR_RES / 6); lv_obj_align_to(temperatures_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_up, temperatures_btn_up_event_cb, LV_EVENT_CLICKED, temperatures_ta); @@ -575,7 +575,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // heater ESP3DStyle::apply(label_target, ESP3DStyleType::bg_label); lv_obj_align_to(label_target, temperatures_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); @@ -584,19 +584,19 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, temperatures_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // set button lv_obj_t *btn_set = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_OK); lv_obj_align_to(btn_set, label_unit2, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_set, temperatures_btn_ok_event_cb, LV_EVENT_CLICKED, temperatures_ta); // Power off button to 0 lv_obj_t *btn_stop = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_POWER); lv_obj_align_to(btn_stop, btn_set, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_stop, temperatures_btn_power_off_event_cb, LV_EVENT_CLICKED, temperatures_ta); // Keyboard @@ -606,11 +606,11 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_update_layout(label_unit2); lv_obj_set_content_width(temperatures_kb, LV_HOR_RES - (lv_obj_get_x(label_unit2) + - CURRENT_BUTTON_PRESSED_OUTLINE)); + ESP3D_BUTTON_PRESSED_OUTLINE)); lv_obj_align_to(temperatures_kb, temperatures_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2); - lv_obj_set_style_radius(temperatures_kb, CURRENT_BUTTON_RADIUS_VALUE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2, + -ESP3D_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_style_radius(temperatures_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(temperatures_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(temperatures_ta, temperatures_ta_event_cb, LV_EVENT_ALL, @@ -619,7 +619,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, temperatures_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, temperatures_btn_down_event_cb, LV_EVENT_CLICKED, temperatures_ta); @@ -633,7 +633,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_set_width(label_target_temperature_value, LV_HOR_RES / 6); lv_obj_align_to(label_target_temperature_value, btn_down, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // unit label_unit1 = lv_label_create(ui_new_screen); @@ -641,7 +641,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { esp3dTranslationService.translate(ESP3DLabel::celsius)); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_target_temperature_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Label target heater @@ -653,7 +653,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { ESP3DStyle::apply(label_target_temperature, ESP3DStyleType::bg_label); lv_obj_align_to(label_target_temperature, label_target_temperature_value, - LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_LEFT_MID, -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); esp3dTftui.set_current_screen(ESP3DScreenType::temperatures); diff --git a/main/display/3dprinter/smoothieware/esp3d_styles.cpp b/main/display/3dprinter/smoothieware/esp3d_styles.cpp index 36c2e232..df0545db 100644 --- a/main/display/3dprinter/smoothieware/esp3d_styles.cpp +++ b/main/display/3dprinter/smoothieware/esp3d_styles.cpp @@ -26,21 +26,21 @@ #define ESP3D_SCREEN_BACKGROUND_TEXT_COLOR lv_color_hex(0xFFFFFF) -#define CURRENT_STATUS_BAR_TEXT_COLOR lv_color_hex(0x000000) -#define CURRENT_STATUS_BAR_BG_COLOR lv_color_hex(0xFFFFFF) +#define ESP3D_STATUS_BAR_TEXT_COLOR lv_color_hex(0x000000) +#define ESP3D_STATUS_BAR_BG_COLOR lv_color_hex(0xFFFFFF) -#define CURRENT_STATUS_BAR_BORDER_COLOR lv_palette_main(LV_PALETTE_GREY) +#define ESP3D_STATUS_BAR_BORDER_COLOR lv_palette_main(LV_PALETTE_GREY) -#define CURRENT_BUTTON_COLOR_PALETTE LV_PALETTE_GREY -#define CURRENT_BUTTON_COLOR_PALETTE_DARKEN 2 +#define ESP3D_BUTTON_COLOR_PALETTE LV_PALETTE_GREY +#define ESP3D_BUTTON_COLOR_PALETTE_DARKEN 2 -#define CURRENT_BUTTON_BORDER_COLOR \ +#define ESP3D_BUTTON_BORDER_COLOR \ lv_color_hex(0xFFFFFF) // lv_palette_main(LV_PALETTE_GREY) -#define CURRENT_BUTTON_TEXT_COLOR lv_color_hex(0xFFFFFF) -#define CURRENT_BUTTON_OUTLINE_COLOR_PALETTE LV_PALETTE_GREEN -#define CURRENT_BUTTON_PRESSED_COLOR_PALETTE LV_PALETTE_GREY -#define CURRENT_BUTTON_PRESSED_TEXT_COLOR lv_color_hex(0x00FF00) -#define CURRENT_BUTTON_PRESSED_BORDER_COLOR lv_color_hex(0x00FF00) +#define ESP3D_BUTTON_TEXT_COLOR lv_color_hex(0xFFFFFF) +#define ESP3D_BUTTON_OUTLINE_COLOR_PALETTE LV_PALETTE_GREEN +#define ESP3D_BUTTON_PRESSED_COLOR_PALETTE LV_PALETTE_GREY +#define ESP3D_BUTTON_PRESSED_TEXT_COLOR lv_color_hex(0x00FF00) +#define ESP3D_BUTTON_PRESSED_BORDER_COLOR lv_color_hex(0x00FF00) // Create styles for main background lv_style_t style_main_bg; @@ -121,14 +121,14 @@ bool ESP3DStyle::init() { lv_style_set_text_opa(&style_read_only_value, LV_OPA_COVER); lv_style_set_text_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); lv_style_set_bg_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_COLOR); - lv_style_set_radius(&style_read_only_value, CURRENT_STATUS_BAR_RADIUS); + lv_style_set_radius(&style_read_only_value, ESP3D_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_value, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_read_only_value, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); lv_style_set_text_align(&style_read_only_value, LV_TEXT_ALIGN_CENTER); - lv_style_set_pad_top(&style_read_only_value, CURRENT_BUTTON_PAD); - lv_style_set_pad_bottom(&style_read_only_value, CURRENT_BUTTON_PAD); + lv_style_set_pad_top(&style_read_only_value, ESP3D_BUTTON_PAD); + lv_style_set_pad_bottom(&style_read_only_value, ESP3D_BUTTON_PAD); /* read only setting on main background @@ -136,16 +136,16 @@ bool ESP3DStyle::init() { lv_style_init(&style_read_only_setting); lv_style_set_text_opa(&style_read_only_setting, LV_OPA_COVER); lv_style_set_text_color(&style_read_only_setting, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_bg_color(&style_read_only_setting, ESP3D_SCREEN_BACKGROUND_COLOR); - lv_style_set_radius(&style_read_only_setting, CURRENT_STATUS_BAR_RADIUS); + lv_style_set_radius(&style_read_only_setting, ESP3D_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_setting, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_read_only_setting, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); lv_style_set_text_align(&style_read_only_setting, LV_TEXT_ALIGN_CENTER); - lv_style_set_pad_top(&style_read_only_setting, CURRENT_BUTTON_PAD); - lv_style_set_pad_bottom(&style_read_only_setting, CURRENT_BUTTON_PAD); + lv_style_set_pad_top(&style_read_only_setting, ESP3D_BUTTON_PAD); + lv_style_set_pad_bottom(&style_read_only_setting, ESP3D_BUTTON_PAD); /* Status bar @@ -154,16 +154,16 @@ bool ESP3DStyle::init() { lv_style_set_text_opa(&style_status_bar_default, LV_OPA_COVER); lv_style_set_text_color(&style_status_bar_default, - CURRENT_STATUS_BAR_TEXT_COLOR); + ESP3D_STATUS_BAR_TEXT_COLOR); lv_style_set_bg_opa(&style_status_bar_default, LV_OPA_COVER); - lv_style_set_bg_color(&style_status_bar_default, CURRENT_STATUS_BAR_BG_COLOR); - lv_style_set_radius(&style_status_bar_default, CURRENT_STATUS_BAR_RADIUS); - lv_style_set_pad_hor(&style_status_bar_default, CURRENT_STATUS_BAR_H_PAD); - lv_style_set_pad_ver(&style_status_bar_default, CURRENT_STATUS_BAR_V_PAD); + lv_style_set_bg_color(&style_status_bar_default, ESP3D_STATUS_BAR_BG_COLOR); + lv_style_set_radius(&style_status_bar_default, ESP3D_STATUS_BAR_RADIUS); + lv_style_set_pad_hor(&style_status_bar_default, ESP3D_STATUS_BAR_H_PAD); + lv_style_set_pad_ver(&style_status_bar_default, ESP3D_STATUS_BAR_V_PAD); lv_style_set_border_width(&style_status_bar_default, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_status_bar_default, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); /* Scrollbar @@ -171,7 +171,7 @@ bool ESP3DStyle::init() { // Create style for scrollbar default state lv_style_init(&style_scrollbar_default); - lv_style_set_width(&style_scrollbar_default, CURRENT_SCROLL_BAR_WIDTH); + lv_style_set_width(&style_scrollbar_default, ESP3D_SCROLL_BAR_WIDTH); lv_style_set_bg_opa(&style_scrollbar_default, LV_OPA_COVER); lv_style_set_bg_color(&style_scrollbar_default, lv_palette_main(LV_PALETTE_GREY)); @@ -179,12 +179,12 @@ bool ESP3DStyle::init() { lv_style_set_border_color( &style_scrollbar_default, lv_palette_darken(LV_PALETTE_GREY, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_border_opa(&style_scrollbar_default, LV_OPA_COVER); lv_style_set_border_width(&style_scrollbar_default, - CURRENT_BUTTON_BORDER_VALUE); - lv_style_set_radius(&style_scrollbar_default, CURRENT_SCROLL_BAR_RADIUS); + ESP3D_BUTTON_BORDER_SIZE); + lv_style_set_radius(&style_scrollbar_default, ESP3D_SCROLL_BAR_RADIUS); lv_style_set_pad_all(&style_scrollbar_default, 8); // Create style for scrollbar active state lv_style_init(&style_scrollbar_active); @@ -192,11 +192,11 @@ bool ESP3DStyle::init() { lv_style_set_bg_color(&style_scrollbar_active, lv_palette_main(LV_PALETTE_GREEN)); lv_style_set_shadow_width(&style_scrollbar_active, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_shadow_color(&style_scrollbar_active, lv_palette_main(LV_PALETTE_GREEN)); lv_style_set_shadow_spread(&style_scrollbar_active, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); /* Radio Buttons @@ -207,16 +207,16 @@ bool ESP3DStyle::init() { lv_style_set_border_color( &style_btn_radio_default, lv_palette_darken(LV_PALETTE_GREY, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); // Create style for button pressed state lv_style_init(&style_btn_radio_pressed); lv_style_set_shadow_width(&style_btn_radio_pressed, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_shadow_color(&style_btn_radio_pressed, lv_palette_main(LV_PALETTE_GREEN)); lv_style_set_shadow_spread(&style_btn_radio_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_btn_radio_pressed, lv_palette_main(LV_PALETTE_GREEN)); @@ -232,57 +232,57 @@ bool ESP3DStyle::init() { // Create style for button default state lv_style_init(&style_btn_default); - lv_style_set_radius(&style_btn_default, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_default, ESP3D_BUTTON_RADIUS ); lv_style_set_bg_opa(&style_btn_default, LV_OPA_100); lv_style_set_bg_color(&style_btn_default, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_btn_default, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_btn_default, LV_GRAD_DIR_VER); lv_style_set_border_opa(&style_btn_default, LV_OPA_40); - lv_style_set_border_width(&style_btn_default, CURRENT_BUTTON_BORDER_VALUE); - lv_style_set_border_color(&style_btn_default, CURRENT_BUTTON_BORDER_COLOR); + lv_style_set_border_width(&style_btn_default, ESP3D_BUTTON_BORDER_SIZE); + lv_style_set_border_color(&style_btn_default, ESP3D_BUTTON_BORDER_COLOR); lv_style_set_outline_opa(&style_btn_default, LV_OPA_COVER); lv_style_set_outline_color( &style_btn_default, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); - lv_style_set_text_color(&style_btn_default, CURRENT_BUTTON_TEXT_COLOR); - lv_style_set_pad_all(&style_btn_default, CURRENT_BUTTON_PAD); + lv_style_set_text_color(&style_btn_default, ESP3D_BUTTON_TEXT_COLOR); + lv_style_set_pad_all(&style_btn_default, ESP3D_BUTTON_PAD); // Create style for button pressed state lv_style_init(&style_btn_pressed); /*Add a large outline when pressed*/ lv_style_set_outline_width(&style_btn_pressed, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_outline_opa(&style_btn_pressed, LV_OPA_TRANSP); lv_style_set_shadow_ofs_y(&style_btn_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_color( &style_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_text_color(&style_btn_pressed, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_border_color(&style_btn_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); - if (BUTTON_ANIMATION_DELAY) { + ESP3D_BUTTON_PRESSED_BORDER_COLOR); + if (ESP3D_BUTTON_ANIMATION_DELAY) { /*Add a transition to the outline*/ static lv_style_transition_dsc_t trans; static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, LV_STYLE_PROP_INV}; lv_style_transition_dsc_init(&trans, props, lv_anim_path_linear, - BUTTON_ANIMATION_DELAY, 0, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, 0, NULL); lv_style_set_transition(&style_btn_pressed, &trans); } @@ -295,44 +295,44 @@ bool ESP3DStyle::init() { lv_style_set_radius(&style_embedded_btn_default, 0); lv_style_set_bg_opa(&style_embedded_btn_default, LV_OPA_100); lv_style_set_bg_color(&style_embedded_btn_default, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_embedded_btn_default, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_embedded_btn_default, LV_GRAD_DIR_VER); lv_style_set_border_opa(&style_embedded_btn_default, LV_OPA_40); lv_style_set_border_width(&style_embedded_btn_default, - CURRENT_BUTTON_BORDER_VALUE); + ESP3D_BUTTON_BORDER_SIZE); lv_style_set_border_color(&style_embedded_btn_default, - CURRENT_BUTTON_BORDER_COLOR); + ESP3D_BUTTON_BORDER_COLOR); lv_style_set_outline_opa(&style_embedded_btn_default, LV_OPA_COVER); lv_style_set_outline_color( &style_embedded_btn_default, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); lv_style_set_text_color(&style_embedded_btn_default, - CURRENT_BUTTON_TEXT_COLOR); - lv_style_set_pad_all(&style_embedded_btn_default, CURRENT_BUTTON_PAD); + ESP3D_BUTTON_TEXT_COLOR); + lv_style_set_pad_all(&style_embedded_btn_default, ESP3D_BUTTON_PAD); // Create style for embedded button pressed state lv_style_init(&style_embedded_btn_pressed); lv_style_set_shadow_ofs_y(&style_embedded_btn_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_embedded_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_color( &style_embedded_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_text_color(&style_embedded_btn_pressed, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_border_color(&style_embedded_btn_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); + ESP3D_BUTTON_PRESSED_BORDER_COLOR); /* Buttons matrix @@ -343,33 +343,33 @@ bool ESP3DStyle::init() { lv_style_set_pad_all(&style_btn_matrix_bar, 1); lv_style_set_pad_gap(&style_btn_matrix_bar, 0); lv_style_set_clip_corner(&style_btn_matrix_bar, true); - lv_style_set_radius(&style_btn_matrix_bar, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_bar, ESP3D_BUTTON_RADIUS ); lv_style_set_pad_left(&style_btn_matrix_bar, 4); lv_style_set_pad_top(&style_btn_matrix_bar, 4); // border lv_style_set_border_opa(&style_btn_matrix_bar, LV_OPA_40); - lv_style_set_border_width(&style_btn_matrix_bar, CURRENT_BUTTON_BORDER_VALUE); - lv_style_set_border_color(&style_btn_matrix_bar, CURRENT_BUTTON_BORDER_COLOR); + lv_style_set_border_width(&style_btn_matrix_bar, ESP3D_BUTTON_BORDER_SIZE); + lv_style_set_border_color(&style_btn_matrix_bar, ESP3D_BUTTON_BORDER_COLOR); // bg lv_style_set_bg_opa(&style_btn_matrix_bar, LV_OPA_100); lv_style_set_bg_color(&style_btn_matrix_bar, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_btn_matrix_bar, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_btn_matrix_bar, LV_GRAD_DIR_VER); // text - lv_style_set_text_color(&style_btn_matrix_bar, CURRENT_BUTTON_TEXT_COLOR); + lv_style_set_text_color(&style_btn_matrix_bar, ESP3D_BUTTON_TEXT_COLOR); //***************************************************************** // Default lv_style_init(&style_btn_matrix_default); - lv_style_set_radius(&style_btn_matrix_default, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_default, ESP3D_BUTTON_RADIUS ); // bg // text @@ -380,32 +380,32 @@ bool ESP3DStyle::init() { // Pressed lv_style_init(&style_btn_matrix_pressed); lv_style_set_pad_all(&style_btn_matrix_pressed, 10); - lv_style_set_radius(&style_btn_matrix_pressed, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_pressed, ESP3D_BUTTON_RADIUS ); lv_style_set_outline_opa(&style_btn_matrix_pressed, LV_OPA_40); lv_style_set_outline_color( &style_btn_matrix_pressed, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); lv_style_set_outline_width(&style_btn_matrix_pressed, 1); // bg lv_style_set_bg_opa(&style_btn_matrix_pressed, LV_OPA_60); lv_style_set_bg_color( &style_btn_matrix_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_bg_grad_color( &style_btn_matrix_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); // text lv_style_set_text_color( &style_btn_matrix_pressed, - lv_palette_darken(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); // border lv_style_set_border_color(&style_btn_matrix_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); + ESP3D_BUTTON_PRESSED_BORDER_COLOR); lv_style_set_border_width(&style_btn_matrix_pressed, 3); lv_style_set_border_opa(&style_btn_matrix_pressed, LV_OPA_60); @@ -413,24 +413,24 @@ bool ESP3DStyle::init() { // checked lv_style_init(&style_btn_matrix_checked); lv_style_set_pad_all(&style_btn_matrix_checked, 10); - lv_style_set_radius(&style_btn_matrix_checked, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_checked, ESP3D_BUTTON_RADIUS ); // bg lv_style_set_bg_opa(&style_btn_matrix_checked, LV_OPA_40); lv_style_set_bg_color( &style_btn_matrix_checked, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_bg_grad_color( &style_btn_matrix_checked, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); // text lv_style_set_text_color(&style_btn_matrix_checked, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); // border lv_style_set_border_color(&style_btn_matrix_checked, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); + ESP3D_BUTTON_PRESSED_BORDER_COLOR); lv_style_set_border_width(&style_btn_matrix_checked, 2); lv_style_set_border_opa(&style_btn_matrix_checked, LV_OPA_40); @@ -439,30 +439,30 @@ bool ESP3DStyle::init() { */ /*Default*/ lv_style_init(&style_btn_msb_box_default); - lv_style_set_radius(&style_btn_msb_box_default, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_msb_box_default, ESP3D_BUTTON_RADIUS ); lv_style_set_bg_opa(&style_btn_msb_box_default, LV_OPA_100); lv_style_set_bg_color(&style_btn_msb_box_default, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_btn_msb_box_default, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_btn_msb_box_default, LV_GRAD_DIR_VER); lv_style_set_border_opa(&style_btn_msb_box_default, LV_OPA_40); lv_style_set_border_width(&style_btn_msb_box_default, - CURRENT_BUTTON_BORDER_VALUE); + ESP3D_BUTTON_BORDER_SIZE); lv_style_set_border_color(&style_btn_msb_box_default, - CURRENT_BUTTON_BORDER_COLOR); + ESP3D_BUTTON_BORDER_COLOR); lv_style_set_outline_opa(&style_btn_msb_box_default, LV_OPA_COVER); lv_style_set_outline_color( &style_btn_msb_box_default, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); lv_style_set_text_color(&style_btn_msb_box_default, - CURRENT_BUTTON_TEXT_COLOR); - lv_style_set_pad_all(&style_btn_msb_box_default, CURRENT_BUTTON_PAD); + ESP3D_BUTTON_TEXT_COLOR); + lv_style_set_pad_all(&style_btn_msb_box_default, ESP3D_BUTTON_PAD); /*Pressed*/ @@ -470,30 +470,30 @@ bool ESP3DStyle::init() { /*Add a large outline when pressed*/ lv_style_set_outline_width(&style_btn_msb_box_pressed, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_outline_opa(&style_btn_msb_box_pressed, LV_OPA_TRANSP); lv_style_set_shadow_ofs_y(&style_btn_msb_box_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_btn_msb_box_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_color( &style_btn_msb_box_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_text_color(&style_btn_msb_box_pressed, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_border_color(&style_btn_msb_box_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); - if (BUTTON_ANIMATION_DELAY) { + ESP3D_BUTTON_PRESSED_BORDER_COLOR); + if (ESP3D_BUTTON_ANIMATION_DELAY) { /*Add a transition to the outline*/ static lv_style_transition_dsc_t trans; static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, LV_STYLE_PROP_INV}; lv_style_transition_dsc_init(&trans, props, lv_anim_path_linear, - BUTTON_ANIMATION_DELAY, 0, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, 0, NULL); lv_style_set_transition(&style_btn_msb_box_pressed, &trans); } @@ -503,24 +503,24 @@ bool ESP3DStyle::init() { lv_style_init(&style_status_list_default); lv_style_set_text_opa(&style_status_list_default, LV_OPA_COVER); lv_style_set_text_color(&style_status_list_default, - CURRENT_STATUS_BAR_TEXT_COLOR); + ESP3D_STATUS_BAR_TEXT_COLOR); lv_style_set_bg_opa(&style_status_list_default, LV_OPA_COVER); lv_style_set_bg_color(&style_status_list_default, - CURRENT_STATUS_BAR_BG_COLOR); + ESP3D_STATUS_BAR_BG_COLOR); lv_style_set_radius(&style_status_list_default, 0); // lv_style_set_pad_hor(&style_status_list_default, - // CURRENT_STATUS_BAR_H_PAD); + // ESP3D_STATUS_BAR_H_PAD); // lv_style_set_pad_ver(&style_status_list_default, - // CURRENT_STATUS_BAR_V_PAD); + // ESP3D_STATUS_BAR_V_PAD); lv_style_set_border_width(&style_status_list_default, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_status_list_default, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); /* Col Container */ lv_style_init(&style_col_container_default); - lv_style_set_radius(&style_col_container_default, CURRENT_CONTAINER_RADIUS); + lv_style_set_radius(&style_col_container_default, ESP3D_CONTAINER_RADIUS); lv_style_set_layout(&style_col_container_default, LV_LAYOUT_FLEX); lv_style_set_flex_flow(&style_col_container_default, LV_FLEX_FLOW_COLUMN); lv_style_set_flex_main_place(&style_col_container_default, @@ -530,7 +530,7 @@ bool ESP3DStyle::init() { Row Container */ lv_style_init(&style_row_container_default); - lv_style_set_radius(&style_row_container_default, CURRENT_CONTAINER_RADIUS); + lv_style_set_radius(&style_row_container_default, ESP3D_CONTAINER_RADIUS); lv_style_set_layout(&style_row_container_default, LV_LAYOUT_FLEX); lv_style_set_flex_flow(&style_row_container_default, LV_FLEX_FLOW_ROW); lv_style_set_flex_main_place(&style_row_container_default, @@ -627,8 +627,8 @@ bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { lv_obj_set_width(obj, LV_PCT(80)); ESP3DStyle::apply(lv_msgbox_get_close_btn(obj), ESP3DStyleType::button); ESP3DStyle::apply(lv_msgbox_get_btns(obj), ESP3DStyleType::buttons_msgbox); - lv_obj_set_height(lv_msgbox_get_btns(obj), SYMBOL_BUTTON_HEIGHT); - lv_obj_set_width(lv_msgbox_get_btns(obj), MSGBOX_BUTTON_WIDTH); + lv_obj_set_height(lv_msgbox_get_btns(obj), ESP3D_SYMBOL_BUTTON_HEIGHT); + lv_obj_set_width(lv_msgbox_get_btns(obj), ESP3D_MSGBOX_BUTTON_WIDTH); break; case ESP3DStyleType::embedded_button: lv_obj_add_style(obj, &style_embedded_btn_default, LV_STATE_DEFAULT); @@ -638,16 +638,16 @@ bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { case ESP3DStyleType::row_container: lv_obj_add_style(obj, &style_row_container_default, LV_STATE_DEFAULT); lv_obj_set_style_clip_corner(obj, true, 0); - lv_obj_set_style_pad_column(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_column(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); break; case ESP3DStyleType::col_container: lv_obj_add_style(obj, &style_col_container_default, LV_STATE_DEFAULT); lv_obj_set_style_clip_corner(obj, true, 0); - lv_obj_set_style_pad_top(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_top(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_bottom(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_bottom(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); break; case ESP3DStyleType::list_container: @@ -655,10 +655,10 @@ bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_ELASTIC); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_scrollbar_mode(obj, LV_SCROLLBAR_MODE_AUTO); - lv_obj_set_style_pad_row(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_row(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_set_style_flex_main_place(obj, LV_FLEX_ALIGN_START, LV_PART_MAIN); - lv_obj_set_style_pad_all(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_all(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_add_style(obj, &style_scrollbar_default, LV_PART_SCROLLBAR); #pragma GCC diagnostic push @@ -689,10 +689,10 @@ bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { } bool ESP3DStyle::add_pad(lv_obj_t* obj) { - lv_obj_set_style_pad_left(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_right(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_top(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_bottom(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_left(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_set_style_pad_right(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_set_style_pad_top(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_set_style_pad_bottom(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); return true; } \ No newline at end of file diff --git a/main/display/3dprinter/smoothieware/res_320_240/esp3d_styles_res.h b/main/display/3dprinter/smoothieware/res_320_240/esp3d_styles_res.h index b55f6ce1..f460a318 100644 --- a/main/display/3dprinter/smoothieware/res_320_240/esp3d_styles_res.h +++ b/main/display/3dprinter/smoothieware/res_320_240/esp3d_styles_res.h @@ -20,48 +20,48 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 4 -#define CURRENT_STATUS_BAR_H_PAD 5 -#define CURRENT_STATUS_BAR_V_PAD 3 -#define CURRENT_STATUS_BAR_BORDER_VALUE 1 -#define CURRENT_STATUS_AREA_HEIGHT 40 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 10) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 2 +#define ESP3D_STATUS_BAR_RADIUS 4 +#define ESP3D_STATUS_BAR_H_PAD 5 +#define ESP3D_STATUS_BAR_V_PAD 3 +#define ESP3D_STATUS_BAR_BORDER_VALUE 1 +#define ESP3D_STATUS_BAR_HEIGHT 40 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 10) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 2 -#define CURRENT_BUTTON_RADIUS_VALUE 4 -#define CURRENT_BUTTON_BORDER_VALUE 2 +#define ESP3D_BUTTON_RADIUS 4 +#define ESP3D_BUTTON_BORDER_SIZE 2 -#define CURRENT_BUTTON_PRESSED_OUTLINE 5 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 3 +#define ESP3D_BUTTON_PRESSED_OUTLINE 5 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 3 -#define CURRENT_CONTAINER_RADIUS 5 +#define ESP3D_CONTAINER_RADIUS 5 -#define BUTTON_WIDTH 60 -#define BUTTON_HEIGHT 60 +#define ESP3D_BUTTON_WIDTH 60 +#define ESP3D_BUTTON_HEIGHT 60 -#define SYMBOL_BUTTON_WIDTH 50 -#define SYMBOL_BUTTON_HEIGHT 44 +#define ESP3D_SYMBOL_BUTTON_WIDTH 50 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 44 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 0 -#endif // BUTTON_ANIMATION_DELAY +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 0 +#endif // ESP3D_BUTTON_ANIMATION_DELAY -#define CURRENT_SPINNER_SIZE 70 +#define ESP3D_SPINNER_SIZE 70 -#define BACK_BUTTON_WIDTH 50 -#define BACK_BUTTON_HEIGHT 40 -#define MATRIX_BUTTON_WIDTH 48 -#define MATRIX_BUTTON_HEIGHT 40 -#define MSGBOX_BUTTON_WIDTH 100 +#define ESP3D_BACK_BUTTON_WIDTH 50 +#define ESP3D_BACK_BUTTON_HEIGHT 40 +#define ESP3D_MATRIX_BUTTON_WIDTH 48 +#define ESP3D_MATRIX_BUTTON_HEIGHT 40 +#define ESP3D_MATRIX_BUTTON_WIDTH 100 -#define LIST_CONTAINER_LR_PAD 6 -#define LIST_LINE_HEIGHT 36 -#define LIST_LINE_BORDER_WIDTH 2 -#define LIST_LINE_BUTTON_WIDTH 40 +#define ESP3D_LIST_CONTAINER_LR_PAD 6 +#define ESP3D_LIST_LINE_HEIGHT 36 +#define ESP3D_LIST_LINE_BORDER_SIZE 2 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 40 -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 1 #define FW_LOGO_Y -1 diff --git a/main/display/3dprinter/smoothieware/res_480_272/esp3d_styles_res.h b/main/display/3dprinter/smoothieware/res_480_272/esp3d_styles_res.h index b0f1df2f..175a9061 100644 --- a/main/display/3dprinter/smoothieware/res_480_272/esp3d_styles_res.h +++ b/main/display/3dprinter/smoothieware/res_480_272/esp3d_styles_res.h @@ -20,48 +20,48 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 5 -#define CURRENT_STATUS_BAR_H_PAD 5 -#define CURRENT_STATUS_BAR_V_PAD 3 -#define CURRENT_STATUS_BAR_BORDER_VALUE 1 -#define CURRENT_STATUS_AREA_HEIGHT 50 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 15) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 3 +#define ESP3D_STATUS_BAR_RADIUS 5 +#define ESP3D_STATUS_BAR_H_PAD 5 +#define ESP3D_STATUS_BAR_V_PAD 3 +#define ESP3D_STATUS_BAR_BORDER_VALUE 1 +#define ESP3D_STATUS_BAR_HEIGHT 50 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 15) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 3 -#define CURRENT_BUTTON_RADIUS_VALUE 5 -#define CURRENT_BUTTON_BORDER_VALUE 2 +#define ESP3D_BUTTON_RADIUS 5 +#define ESP3D_BUTTON_BORDER_SIZE 2 -#define CURRENT_BUTTON_PRESSED_OUTLINE 8 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 4 +#define ESP3D_BUTTON_PRESSED_OUTLINE 8 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 4 -#define CURRENT_CONTAINER_RADIUS 5 +#define ESP3D_CONTAINER_RADIUS 5 -#define BUTTON_WIDTH (LV_HOR_RES / 6) -#define BUTTON_HEIGHT BUTTON_WIDTH +#define ESP3D_BUTTON_WIDTH (LV_HOR_RES / 6) +#define ESP3D_BUTTON_HEIGHT ESP3D_BUTTON_WIDTH -#define SYMBOL_BUTTON_WIDTH 70 -#define SYMBOL_BUTTON_HEIGHT 50 +#define ESP3D_SYMBOL_BUTTON_WIDTH 70 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 50 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 300 -#endif // BUTTON_ANIMATION_DELAY +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 300 +#endif // ESP3D_BUTTON_ANIMATION_DELAY -#define CURRENT_SPINNER_SIZE 100 +#define ESP3D_SPINNER_SIZE 100 -#define BACK_BUTTON_WIDTH 70 -#define BACK_BUTTON_HEIGHT 33 -#define MATRIX_BUTTON_WIDTH 70 -#define MATRIX_BUTTON_HEIGHT 33 -#define MSGBOX_BUTTON_WIDTH 130 +#define ESP3D_BACK_BUTTON_WIDTH 70 +#define ESP3D_BACK_BUTTON_HEIGHT 33 +#define ESP3D_MATRIX_BUTTON_WIDTH 70 +#define ESP3D_MATRIX_BUTTON_HEIGHT 33 +#define ESP3D_MATRIX_BUTTON_WIDTH 130 -#define LIST_CONTAINER_LR_PAD 10 -#define LIST_LINE_HEIGHT 42 -#define LIST_LINE_BORDER_WIDTH 2 -#define LIST_LINE_BUTTON_WIDTH 50 +#define ESP3D_LIST_CONTAINER_LR_PAD 10 +#define ESP3D_LIST_LINE_HEIGHT 42 +#define ESP3D_LIST_LINE_BORDER_SIZE 2 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 50 -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 10 #define FW_LOGO_Y -1 diff --git a/main/display/3dprinter/smoothieware/res_480_320/esp3d_styles_res.h b/main/display/3dprinter/smoothieware/res_480_320/esp3d_styles_res.h index e920c267..5a51ebaf 100644 --- a/main/display/3dprinter/smoothieware/res_480_320/esp3d_styles_res.h +++ b/main/display/3dprinter/smoothieware/res_480_320/esp3d_styles_res.h @@ -20,48 +20,48 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 5 -#define CURRENT_STATUS_BAR_H_PAD 5 -#define CURRENT_STATUS_BAR_V_PAD 3 -#define CURRENT_STATUS_BAR_BORDER_VALUE 1 -#define CURRENT_STATUS_AREA_HEIGHT 50 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 15) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 3 +#define ESP3D_STATUS_BAR_RADIUS 5 +#define ESP3D_STATUS_BAR_H_PAD 5 +#define ESP3D_STATUS_BAR_V_PAD 3 +#define ESP3D_STATUS_BAR_BORDER_VALUE 1 +#define ESP3D_STATUS_BAR_HEIGHT 50 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 15) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 3 -#define CURRENT_BUTTON_RADIUS_VALUE 5 -#define CURRENT_BUTTON_BORDER_VALUE 2 +#define ESP3D_BUTTON_RADIUS 5 +#define ESP3D_BUTTON_BORDER_SIZE 2 -#define CURRENT_BUTTON_PRESSED_OUTLINE 10 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 4 +#define ESP3D_BUTTON_PRESSED_OUTLINE 10 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 4 -#define CURRENT_CONTAINER_RADIUS 5 +#define ESP3D_CONTAINER_RADIUS 5 -#define BUTTON_WIDTH (LV_HOR_RES / 6) -#define BUTTON_HEIGHT BUTTON_WIDTH +#define ESP3D_BUTTON_WIDTH (LV_HOR_RES / 6) +#define ESP3D_BUTTON_HEIGHT ESP3D_BUTTON_WIDTH -#define SYMBOL_BUTTON_WIDTH 70 -#define SYMBOL_BUTTON_HEIGHT 56 +#define ESP3D_SYMBOL_BUTTON_WIDTH 70 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 56 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 300 -#endif // BUTTON_ANIMATION_DELAY +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 300 +#endif // ESP3D_BUTTON_ANIMATION_DELAY -#define CURRENT_SPINNER_SIZE 100 +#define ESP3D_SPINNER_SIZE 100 -#define BACK_BUTTON_WIDTH 70 -#define BACK_BUTTON_HEIGHT 50 -#define MATRIX_BUTTON_WIDTH 70 -#define MATRIX_BUTTON_HEIGHT 50 -#define MSGBOX_BUTTON_WIDTH 130 +#define ESP3D_BACK_BUTTON_WIDTH 70 +#define ESP3D_BACK_BUTTON_HEIGHT 50 +#define ESP3D_MATRIX_BUTTON_WIDTH 70 +#define ESP3D_MATRIX_BUTTON_HEIGHT 50 +#define ESP3D_MATRIX_BUTTON_WIDTH 130 -#define LIST_CONTAINER_LR_PAD 10 -#define LIST_LINE_HEIGHT 45 -#define LIST_LINE_BORDER_WIDTH 3 -#define LIST_LINE_BUTTON_WIDTH 50 +#define ESP3D_LIST_CONTAINER_LR_PAD 10 +#define ESP3D_LIST_LINE_HEIGHT 45 +#define ESP3D_LIST_LINE_BORDER_SIZE 3 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 50 -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 10 #define FW_LOGO_Y -10 \ No newline at end of file diff --git a/main/display/3dprinter/smoothieware/res_800_480/esp3d_styles_res.h b/main/display/3dprinter/smoothieware/res_800_480/esp3d_styles_res.h index 6c0f54ba..e3d7c9b0 100644 --- a/main/display/3dprinter/smoothieware/res_800_480/esp3d_styles_res.h +++ b/main/display/3dprinter/smoothieware/res_800_480/esp3d_styles_res.h @@ -20,47 +20,47 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 10 -#define CURRENT_STATUS_BAR_H_PAD 10 -#define CURRENT_STATUS_BAR_V_PAD 4 -#define CURRENT_STATUS_BAR_BORDER_VALUE 2 -#define CURRENT_STATUS_AREA_HEIGHT 80 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 30) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 3 - -#define CURRENT_BUTTON_RADIUS_VALUE 10 -#define CURRENT_BUTTON_BORDER_VALUE 2 - -#define CURRENT_BUTTON_PRESSED_OUTLINE 20 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 10 - -#define CURRENT_CONTAINER_RADIUS 10 - -#define BUTTON_WIDTH (LV_HOR_RES / 6) -#define BUTTON_HEIGHT BUTTON_WIDTH - -#define SYMBOL_BUTTON_WIDTH 100 -#define SYMBOL_BUTTON_HEIGHT 85 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 300 -#endif // BUTTON_ANIMATION_DELAY - -#define CURRENT_SPINNER_SIZE 100 - -#define BACK_BUTTON_WIDTH 100 -#define BACK_BUTTON_HEIGHT 75 -#define MATRIX_BUTTON_WIDTH 100 -#define MATRIX_BUTTON_HEIGHT 75 -#define MSGBOX_BUTTON_WIDTH 220 - -#define LIST_CONTAINER_LR_PAD 20 -#define LIST_LINE_HEIGHT 64 -#define LIST_LINE_BORDER_WIDTH 4 -#define LIST_LINE_BUTTON_WIDTH 80 - -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_STATUS_BAR_RADIUS 10 +#define ESP3D_STATUS_BAR_H_PAD 10 +#define ESP3D_STATUS_BAR_V_PAD 4 +#define ESP3D_STATUS_BAR_BORDER_VALUE 2 +#define ESP3D_STATUS_BAR_HEIGHT 80 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 30) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 3 + +#define ESP3D_BUTTON_RADIUS 10 +#define ESP3D_BUTTON_BORDER_SIZE 2 + +#define ESP3D_BUTTON_PRESSED_OUTLINE 20 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 10 + +#define ESP3D_CONTAINER_RADIUS 10 + +#define ESP3D_BUTTON_WIDTH (LV_HOR_RES / 6) +#define ESP3D_BUTTON_HEIGHT ESP3D_BUTTON_WIDTH + +#define ESP3D_SYMBOL_BUTTON_WIDTH 100 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 85 +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 300 +#endif // ESP3D_BUTTON_ANIMATION_DELAY + +#define ESP3D_SPINNER_SIZE 100 + +#define ESP3D_BACK_BUTTON_WIDTH 100 +#define ESP3D_BACK_BUTTON_HEIGHT 75 +#define ESP3D_MATRIX_BUTTON_WIDTH 100 +#define ESP3D_MATRIX_BUTTON_HEIGHT 75 +#define ESP3D_MATRIX_BUTTON_WIDTH 220 + +#define ESP3D_LIST_CONTAINER_LR_PAD 20 +#define ESP3D_LIST_LINE_HEIGHT 64 +#define ESP3D_LIST_LINE_BORDER_SIZE 4 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 80 + +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 10 #define FW_LOGO_Y -10 \ No newline at end of file diff --git a/main/display/3dprinter/smoothieware/screens/auto_leveling_screen.cpp b/main/display/3dprinter/smoothieware/screens/auto_leveling_screen.cpp index 9eba2990..f5f5b072 100644 --- a/main/display/3dprinter/smoothieware/screens/auto_leveling_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/auto_leveling_screen.cpp @@ -159,7 +159,7 @@ bool auto_leveling_value_cb(ESP3DValuesIndex index, const char *value, for (uint8_t i = 0; i <= col; i++) { lv_table_set_col_width( auto_leveling_screen_table, i, - ((LV_HOR_RES) - (2 * CURRENT_BUTTON_PRESSED_OUTLINE)) / + ((LV_HOR_RES) - (2 * ESP3D_BUTTON_PRESSED_OUTLINE)) / (col + 1)); } } @@ -186,13 +186,13 @@ bool auto_leveling_value_cb(ESP3DValuesIndex index, const char *value, if (max_col != -1 && col == max_col && row == 1) { esp3d_log( "Max col found is:%d, col wdith:%d", max_col, - ((LV_HOR_RES) - (2 * CURRENT_BUTTON_PRESSED_OUTLINE)) / max_col); + ((LV_HOR_RES) - (2 * ESP3D_BUTTON_PRESSED_OUTLINE)) / max_col); lv_table_set_col_cnt(auto_leveling_screen_table, max_col + 1); for (uint8_t i = 0; i <= max_col; i++) { lv_table_set_col_width( auto_leveling_screen_table, i, - ((LV_HOR_RES) - (2 * CURRENT_BUTTON_PRESSED_OUTLINE)) / + ((LV_HOR_RES) - (2 * ESP3D_BUTTON_PRESSED_OUTLINE)) / (max_col + 1)); } } @@ -242,10 +242,10 @@ void event_button_auto_leveling_start_handler(lv_event_t *e) { void event_button_fan_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (auto_leveling_screen_delay_timer) return; auto_leveling_screen_delay_timer = lv_timer_create( - auto_leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + auto_leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { auto_leveling_screen_delay_timer_cb(NULL); } @@ -263,26 +263,26 @@ void auto_leveling_screen() { lv_obj_del(ui_current_screen); homing_done = false; - btn_back = backButton::create_back_button(ui_new_screen); + btn_back = backButton::create(ui_new_screen); lv_obj_add_event_cb(btn_back, event_button_fan_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_update_layout(btn_back); // Create a table auto_leveling_screen_table = lv_table_create(ui_new_screen); lv_obj_set_size(auto_leveling_screen_table, - (LV_HOR_RES) - (2 * CURRENT_BUTTON_PRESSED_OUTLINE), - LV_VER_RES - (3 * CURRENT_BUTTON_PRESSED_OUTLINE) - + (LV_HOR_RES) - (2 * ESP3D_BUTTON_PRESSED_OUTLINE), + LV_VER_RES - (3 * ESP3D_BUTTON_PRESSED_OUTLINE) - lv_obj_get_height(btn_back)); - lv_obj_set_pos(auto_leveling_screen_table, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(auto_leveling_screen_table, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_clear_flag(auto_leveling_screen_table, LV_OBJ_FLAG_SCROLL_ELASTIC); lv_obj_set_style_radius(auto_leveling_screen_table, - CURRENT_BUTTON_RADIUS_VALUE, 0); + ESP3D_BUTTON_RADIUS , 0); // button start btn_start = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_PLAY, BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_PLAY, ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); lv_obj_align_to(btn_start, auto_leveling_screen_table, - LV_ALIGN_OUT_BOTTOM_MID, 0, CURRENT_BUTTON_PRESSED_OUTLINE); + LV_ALIGN_OUT_BOTTOM_MID, 0, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_add_event_cb(btn_start, event_button_auto_leveling_start_handler, LV_EVENT_CLICKED, NULL); @@ -291,9 +291,9 @@ void auto_leveling_screen() { ESP3DStyle::apply(label_status, ESP3DStyleType::bg_label); lv_label_set_text(label_status, ""); lv_obj_align_to(label_status, auto_leveling_screen_table, - LV_ALIGN_OUT_BOTTOM_LEFT, 0, CURRENT_BUTTON_PRESSED_OUTLINE); + LV_ALIGN_OUT_BOTTOM_LEFT, 0, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_set_width(label_status, LV_HOR_RES - - (3 * CURRENT_BUTTON_PRESSED_OUTLINE) - + (3 * ESP3D_BUTTON_PRESSED_OUTLINE) - lv_obj_get_width(btn_start)); lv_label_set_long_mode(label_status, LV_LABEL_LONG_SCROLL_CIRCULAR); esp3dTftui.set_current_screen(ESP3DScreenType::auto_leveling); diff --git a/main/display/3dprinter/smoothieware/screens/fan_screen.cpp b/main/display/3dprinter/smoothieware/screens/fan_screen.cpp index 320c925f..4bc7e6bf 100644 --- a/main/display/3dprinter/smoothieware/screens/fan_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/fan_screen.cpp @@ -92,14 +92,14 @@ bool updateBtnMatrix() { ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); - lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); + lv_obj_set_size(btnm_target, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); esp3d_log("child count: %d", i); // lv_obj_add_state(obj, LV_STATE_DISABLED); if (fan_buttons_map_id > i) fan_buttons_map_id = 0; lv_btnmatrix_set_btn_ctrl(btnm_target, fan_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align_to(btnm_target, btnback, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); return true; } @@ -113,10 +113,10 @@ void fan_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_fan_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (fan_screen_delay_timer) return; fan_screen_delay_timer = lv_timer_create(fan_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { fan_screen_delay_timer_cb(NULL); } @@ -308,7 +308,7 @@ void fan_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - btnback = backButton::create_back_button(ui_new_screen); + btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_fan_back_handler, LV_EVENT_CLICKED, NULL); @@ -318,9 +318,9 @@ void fan_screen() { ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(fan_steps_buttons_map) / sizeof(fan_steps_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, fan_steps_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_add_event_cb(btnm, fan_steps_matrix_buttons_event_cb, @@ -331,7 +331,7 @@ void fan_screen() { lv_label_set_text(label_current_fan, fan_buttons_map[fan_buttons_map_id]); ESP3DStyle::apply(label_current_fan, ESP3DStyleType::bg_label); lv_obj_align(label_current_fan, LV_ALIGN_TOP_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_fan); // Current Fan value @@ -343,7 +343,7 @@ void fan_screen() { ESP3DStyle::apply(label_current_fan_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_fan_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_fan_value, label_current_fan, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit @@ -351,13 +351,13 @@ void fan_screen() { lv_label_set_text(label_unit1, "%"); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_fan_value, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_UP "\n" LV_SYMBOL_PLUS); lv_obj_align_to(btn_up, label_current_fan_value, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // fan input lv_obj_t *fan_ta = lv_textarea_create(ui_new_screen); lv_obj_add_event_cb(fan_ta, fan_ta_event_cb, LV_EVENT_VALUE_CHANGED, NULL); @@ -368,27 +368,27 @@ void fan_screen() { lv_obj_set_style_text_align(fan_ta, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_width(fan_ta, LV_HOR_RES / 6); lv_obj_align_to(fan_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_FAN); ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_align_to(label_ta, fan_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, "%"); ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, fan_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // button down lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, fan_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, fan_btn_down_event_cb, LV_EVENT_CLICKED, fan_ta); @@ -398,14 +398,14 @@ void fan_screen() { lv_obj_t *btn_ok = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_OK); lv_obj_align_to(btn_ok, label_unit2, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_ok, fan_btn_ok_event_cb, LV_EVENT_CLICKED, fan_ta); // Button Reset lv_obj_t *btn_reset = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_POWER); lv_obj_align_to(btn_reset, btn_ok, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_reset, fan_btn_reset_event_cb, LV_EVENT_CLICKED, fan_ta); @@ -414,11 +414,11 @@ void fan_screen() { lv_keyboard_set_mode(fan_kb, LV_KEYBOARD_MODE_NUMBER); lv_keyboard_set_textarea(fan_kb, NULL); lv_obj_align_to(fan_kb, fan_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_update_layout(fan_kb); lv_obj_set_content_width(fan_kb, LV_HOR_RES - lv_obj_get_x(fan_kb) - - 2 * CURRENT_BUTTON_PRESSED_OUTLINE); - lv_obj_set_style_radius(fan_kb, CURRENT_BUTTON_RADIUS_VALUE, LV_PART_MAIN); + 2 * ESP3D_BUTTON_PRESSED_OUTLINE); + lv_obj_set_style_radius(fan_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(fan_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(fan_ta, fan_ta_event_cb, LV_EVENT_ALL, fan_kb); diff --git a/main/display/3dprinter/smoothieware/screens/filament_screen.cpp b/main/display/3dprinter/smoothieware/screens/filament_screen.cpp index 5e277be1..149de819 100644 --- a/main/display/3dprinter/smoothieware/screens/filament_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/filament_screen.cpp @@ -94,14 +94,14 @@ bool updateBtnMatrix() { ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); - lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); + lv_obj_set_size(btnm_target, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); esp3d_log("child count: %d", i); // lv_obj_add_state(obj, LV_STATE_DISABLED); if (filament_buttons_map_id > i) filament_buttons_map_id = 0; lv_btnmatrix_set_btn_ctrl(btnm_target, filament_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align_to(btnm_target, btnback, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); return true; } @@ -124,10 +124,10 @@ void filament_screen_edit_delay_timer_cb(lv_timer_t *timer) { void event_button_filament_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (filament_screen_delay_timer) return; filament_screen_delay_timer = lv_timer_create( - filament_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + filament_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { filament_screen_delay_timer_cb(NULL); } @@ -135,10 +135,10 @@ void event_button_filament_back_handler(lv_event_t *e) { void event_button_filament_edit_handler(lv_event_t *e) { esp3d_log("edit Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (filament_screen_delay_timer) return; filament_screen_delay_timer = lv_timer_create( - filament_screen_edit_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + filament_screen_edit_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { filament_screen_edit_delay_timer_cb(NULL); } @@ -292,7 +292,7 @@ void filament_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - btnback = backButton::create_back_button(ui_new_screen); + btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_filament_back_handler, LV_EVENT_CLICKED, NULL); @@ -303,9 +303,9 @@ void filament_screen() { size_t i = (sizeof(filament_distance_steps_buttons_map) / sizeof(filament_distance_steps_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, filament_distance_steps_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); @@ -321,8 +321,8 @@ void filament_screen() { lv_obj_set_style_transform_angle(label_ta, 900, 0); lv_obj_update_layout(label_ta); - size_t x = lv_obj_get_width(label_ta) + (2 * CURRENT_BUTTON_PRESSED_OUTLINE); - size_t y = MATRIX_BUTTON_HEIGHT + CURRENT_BUTTON_PRESSED_OUTLINE; + size_t x = lv_obj_get_width(label_ta) + (2 * ESP3D_BUTTON_PRESSED_OUTLINE); + size_t y = ESP3D_MATRIX_BUTTON_HEIGHT + ESP3D_BUTTON_PRESSED_OUTLINE; // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( @@ -342,14 +342,14 @@ void filament_screen() { lv_obj_set_style_text_align(filament_ta, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_width(filament_ta, LV_HOR_RES / 6); lv_obj_align_to(filament_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btnm, filament_distance_steps_matrix_buttons_event_cb, LV_EVENT_VALUE_CHANGED, filament_ta); // Text area label lv_obj_align_to(label_ta, filament_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); @@ -357,7 +357,7 @@ void filament_screen() { esp3dTranslationService.translate(ESP3DLabel::millimeters)); ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, filament_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Current filament label label_current_temperature_filament = lv_label_create(ui_new_screen); @@ -365,7 +365,7 @@ void filament_screen() { filament_buttons_map[filament_buttons_map_id]); ESP3DStyle::apply(label_current_temperature_filament, ESP3DStyleType::bg_label); lv_obj_align_to(label_current_temperature_filament, label_unit2, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE * 3, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE * 3, 0); lv_obj_update_layout(label_current_temperature_filament); @@ -384,7 +384,7 @@ void filament_screen() { lv_obj_set_width(label_current_temperature_filament_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_temperature_filament_value, label_current_temperature_filament, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); @@ -392,13 +392,13 @@ void filament_screen() { esp3dTranslationService.translate(ESP3DLabel::celsius)); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_temperature_filament_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_t *btn_edit = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_EDIT); lv_obj_align_to(btn_edit, label_unit1, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_add_event_cb(btn_edit, event_button_filament_edit_handler, LV_EVENT_CLICKED, NULL); @@ -406,7 +406,7 @@ void filament_screen() { lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, filament_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, filament_btn_down_event_cb, LV_EVENT_CLICKED, filament_ta); @@ -418,11 +418,11 @@ void filament_screen() { lv_keyboard_set_mode(filament_kb, LV_KEYBOARD_MODE_NUMBER); lv_keyboard_set_textarea(filament_kb, NULL); lv_obj_align_to(filament_kb, filament_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_update_layout(filament_kb); lv_obj_set_content_width(filament_kb, LV_HOR_RES - lv_obj_get_x(filament_kb) - - 2 * CURRENT_BUTTON_PRESSED_OUTLINE); - lv_obj_set_style_radius(filament_kb, CURRENT_BUTTON_RADIUS_VALUE, + 2 * ESP3D_BUTTON_PRESSED_OUTLINE); + lv_obj_set_style_radius(filament_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(filament_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(filament_ta, filament_ta_event_cb, LV_EVENT_ALL, diff --git a/main/display/3dprinter/smoothieware/screens/informations_screen.cpp b/main/display/3dprinter/smoothieware/screens/informations_screen.cpp index 096d8f4c..06005d55 100644 --- a/main/display/3dprinter/smoothieware/screens/informations_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/informations_screen.cpp @@ -64,10 +64,10 @@ void informations_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_informations_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (informations_screen_delay_timer) return; informations_screen_delay_timer = lv_timer_create( - informations_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + informations_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else informations_screen_delay_timer_cb(NULL); } @@ -97,7 +97,7 @@ void informations_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_informations_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_update_layout(btnback); @@ -107,16 +107,16 @@ void informations_screen() { ESP3DStyle::apply(ui_info_list_ctl, ESP3DStyleType::status_list); lv_obj_update_layout(ui_new_screen); - lv_obj_set_pos(ui_info_list_ctl, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(ui_info_list_ctl, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_set_size( - ui_info_list_ctl, LV_HOR_RES - CURRENT_BUTTON_PRESSED_OUTLINE * 2, - lv_obj_get_height(ui_new_screen) - (CURRENT_BUTTON_PRESSED_OUTLINE * 3) - + ui_info_list_ctl, LV_HOR_RES - ESP3D_BUTTON_PRESSED_OUTLINE * 2, + lv_obj_get_height(ui_new_screen) - (ESP3D_BUTTON_PRESSED_OUTLINE * 3) - lv_obj_get_height(btnback)); - lv_obj_set_style_radius(ui_info_list_ctl, CURRENT_CONTAINER_RADIUS, 0); - lv_obj_set_style_pad_left(ui_info_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_radius(ui_info_list_ctl, ESP3D_CONTAINER_RADIUS, 0); + lv_obj_set_style_pad_left(ui_info_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); - lv_obj_set_style_pad_right(ui_info_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_right(ui_info_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); addInformationToList(ui_info_list_ctl, ESP3DLabel::screen, TFT_TARGET); diff --git a/main/display/3dprinter/smoothieware/screens/leveling_screen.cpp b/main/display/3dprinter/smoothieware/screens/leveling_screen.cpp index 8c36e052..006e32a5 100644 --- a/main/display/3dprinter/smoothieware/screens/leveling_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/leveling_screen.cpp @@ -72,10 +72,10 @@ void event_button_leveling_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); if (leveling_screen_delay_timer) return; leveling_next_screen = ESP3DScreenType::menu; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (leveling_screen_delay_timer) return; leveling_screen_delay_timer = lv_timer_create( - leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { leveling_screen_delay_timer_cb(NULL); } @@ -85,10 +85,10 @@ void event_button_manual_handler(lv_event_t *e) { esp3d_log("MANUAL Clicked"); if (leveling_screen_delay_timer) return; leveling_next_screen = ESP3DScreenType::manual_leveling; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (leveling_screen_delay_timer) return; leveling_screen_delay_timer = lv_timer_create( - leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { leveling_screen_delay_timer_cb(NULL); } @@ -98,10 +98,10 @@ void event_button_auto_handler(lv_event_t *e) { esp3d_log("AUTO Clicked"); if (leveling_screen_delay_timer) return; leveling_next_screen = ESP3DScreenType::auto_leveling; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (leveling_screen_delay_timer) return; leveling_screen_delay_timer = lv_timer_create( - leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { leveling_screen_delay_timer_cb(NULL); } @@ -119,7 +119,7 @@ void leveling_screen(bool autoleveling) { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - btnback = backButton::create_back_button(ui_new_screen); + btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_leveling_back_handler, LV_EVENT_CLICKED, NULL); @@ -137,13 +137,13 @@ void leveling_screen(bool autoleveling) { // Create button and label for manual leveling btn = symbolButton::create_symbol_button( ui_buttons_container, LV_SYMBOL_MANUAL "\n" LV_SYMBOL_LEVELING, - BUTTON_WIDTH, BUTTON_WIDTH); + ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_WIDTH); lv_obj_add_event_cb(btn, event_button_manual_handler, LV_EVENT_CLICKED, NULL); // Create button and label for auto leveling btn = symbolButton::create_symbol_button( ui_buttons_container, LV_SYMBOL_AUTOMATIC "\n" LV_SYMBOL_LEVELING, - BUTTON_WIDTH, BUTTON_WIDTH); + ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_WIDTH); lv_obj_add_event_cb(btn, event_button_auto_handler, LV_EVENT_CLICKED, NULL); esp3dTftui.set_current_screen(ESP3DScreenType::leveling); } diff --git a/main/display/3dprinter/smoothieware/screens/main_screen.cpp b/main/display/3dprinter/smoothieware/screens/main_screen.cpp index 34d68a48..88a95282 100644 --- a/main/display/3dprinter/smoothieware/screens/main_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/main_screen.cpp @@ -505,10 +505,10 @@ void event_button_E0_handler(lv_event_t *e) { if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::temperatures; main_screen_temperature_target = 0; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -519,10 +519,10 @@ void event_button_E1_handler(lv_event_t *e) { if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::temperatures; main_screen_temperature_target = 1; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -533,10 +533,10 @@ void event_button_Bed_handler(lv_event_t *e) { if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::temperatures; main_screen_temperature_target = 2; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -546,10 +546,10 @@ void event_button_positions_handler(lv_event_t *e) { esp3d_log("Positions Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::positions; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -559,10 +559,10 @@ void event_button_fan_handler(lv_event_t *e) { esp3d_log("Fan Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::fan; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -572,10 +572,10 @@ void event_button_speed_handler(lv_event_t *e) { esp3d_log("Speed Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::speed; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -586,10 +586,10 @@ void event_button_files_handler(lv_event_t *e) { esp3d_log("Files Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::files; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -600,10 +600,10 @@ void event_button_menu_handler(lv_event_t *e) { esp3d_log("Menu Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::menu; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else main_screen_delay_timer_cb(NULL); } @@ -714,7 +714,7 @@ void main_screen() { // Create button and label for positions main_btn_positions = symbolButton::create_symbol_button( - ui_top_buttons_container, "", BUTTON_WIDTH * 1.5, BUTTON_HEIGHT); + ui_top_buttons_container, "", ESP3D_BUTTON_WIDTH * 1.5, ESP3D_BUTTON_HEIGHT); lv_obj_add_event_cb(main_btn_positions, event_button_positions_handler, LV_EVENT_CLICKED, NULL); @@ -724,8 +724,8 @@ void main_screen() { ESP3DStyle::apply(main_label_progression_area, ESP3DStyleType::status_bar); lv_obj_center(main_label_progression_area); - lv_obj_set_size(main_label_progression_area, CURRENT_STATUS_AREA_WIDTH, - CURRENT_STATUS_AREA_HEIGHT); + lv_obj_set_size(main_label_progression_area, ESP3D_STATUS_BAR_WIDTH, + ESP3D_STATUS_BAR_HEIGHT); if (show_fan_button) { // Create button and label for fan main_btn_fan = diff --git a/main/display/3dprinter/smoothieware/screens/manual_leveling_screen.cpp b/main/display/3dprinter/smoothieware/screens/manual_leveling_screen.cpp index fbf5e613..57a07185 100644 --- a/main/display/3dprinter/smoothieware/screens/manual_leveling_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/manual_leveling_screen.cpp @@ -84,10 +84,10 @@ void manual_leveling_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_manual_leveling_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (manual_leveling_screen_delay_timer) return; manual_leveling_screen_delay_timer = lv_timer_create( - manual_leveling_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + manual_leveling_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { manual_leveling_screen_delay_timer_cb(NULL); } @@ -372,7 +372,7 @@ void manual_leveling_screen(bool autoleveling) { lv_obj_del(ui_current_screen); // Button back - lv_obj_t *btn_back = backButton::create_back_button(ui_new_screen); + lv_obj_t *btn_back = backButton::create(ui_new_screen); lv_obj_add_event_cb(btn_back, event_button_manual_leveling_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_update_layout(btn_back); @@ -382,10 +382,10 @@ void manual_leveling_screen(bool autoleveling) { lv_btnmatrix_set_map(btnm_leveling_position, leveling_position_buttons_map); ESP3DStyle::apply(btnm_leveling_position, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_leveling_position); - lv_obj_set_pos(btnm_leveling_position, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(btnm_leveling_position, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_set_size(btnm_leveling_position, LV_HOR_RES / 2, - LV_VER_RES - (CURRENT_BUTTON_PRESSED_OUTLINE * 3) - + LV_VER_RES - (ESP3D_BUTTON_PRESSED_OUTLINE * 3) - lv_obj_get_height(btn_back)); lv_obj_add_event_cb(btnm_leveling_position, leveling_posiiton_matrix_buttons_event_cb, @@ -393,34 +393,34 @@ void manual_leveling_screen(bool autoleveling) { // Button Previous btn_previous = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_PREVIOUS, BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_PREVIOUS, ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); lv_obj_align(btn_previous, LV_ALIGN_BOTTOM_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, -CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, -ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_add_event_cb(btn_previous, event_button_manual_leveling_previous_handler, LV_EVENT_CLICKED, btnm_leveling_position); // Button Next btn_next = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_NEXT, BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_NEXT, ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); lv_obj_align_to(btn_next, btnm_leveling_position, LV_ALIGN_OUT_BOTTOM_RIGHT, - 0, CURRENT_BUTTON_PRESSED_OUTLINE); + 0, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_add_event_cb(btn_next, event_button_manual_leveling_next_handler, LV_EVENT_CLICKED, btnm_leveling_position); // Help button lv_obj_t *btn_help = symbolButton::create_symbol_button( - ui_new_screen, "?", BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); - lv_obj_align(btn_help, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + ui_new_screen, "?", ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); + lv_obj_align(btn_help, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_add_event_cb(btn_help, event_button_manual_leveling_help_handler, LV_EVENT_CLICKED, NULL); // Start button btn_start = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_PLAY); lv_obj_align_to(btn_start, btnm_leveling_position, LV_ALIGN_OUT_RIGHT_MID, - (LV_HOR_RES / 4) - SYMBOL_BUTTON_WIDTH / 2, 0); + (LV_HOR_RES / 4) - ESP3D_SYMBOL_BUTTON_WIDTH / 2, 0); lv_obj_add_event_cb(btn_start, event_button_manual_leveling_start_handler, LV_EVENT_CLICKED, btnm_leveling_position); @@ -429,11 +429,11 @@ void manual_leveling_screen(bool autoleveling) { ESP3DStyle::apply(status_container, ESP3DStyleType::text_container); lv_obj_set_size(status_container, - (LV_HOR_RES / 2) - (3 * CURRENT_BUTTON_PRESSED_OUTLINE), - LV_VER_RES - (CURRENT_BUTTON_PRESSED_OUTLINE * 4) - + (LV_HOR_RES / 2) - (3 * ESP3D_BUTTON_PRESSED_OUTLINE), + LV_VER_RES - (ESP3D_BUTTON_PRESSED_OUTLINE * 4) - lv_obj_get_height(btn_back) * 2); lv_obj_align_to(status_container, btn_help, LV_ALIGN_OUT_BOTTOM_RIGHT, 0, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); // status text std::string t = diff --git a/main/display/3dprinter/smoothieware/screens/menu_screen.cpp b/main/display/3dprinter/smoothieware/screens/menu_screen.cpp index 85383e6e..9d6a50d5 100644 --- a/main/display/3dprinter/smoothieware/screens/menu_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/menu_screen.cpp @@ -133,10 +133,10 @@ void event_button_menu_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::main; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { menu_screen_delay_timer_cb(NULL); } @@ -146,10 +146,10 @@ void event_button_filament_handler(lv_event_t *e) { esp3d_log("filament Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::filament; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { menu_screen_delay_timer_cb(NULL); } @@ -160,10 +160,10 @@ void event_button_wifi_handler(lv_event_t *e) { esp3d_log("wifi Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::wifi; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { menu_screen_delay_timer_cb(NULL); } @@ -174,10 +174,10 @@ void event_button_settings_handler(lv_event_t *e) { esp3d_log("settings Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::settings; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else menu_screen_delay_timer_cb(NULL); } @@ -186,10 +186,10 @@ void event_button_leveling_handler(lv_event_t *e) { esp3d_log("leveling Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::leveling; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else menu_screen_delay_timer_cb(NULL); } @@ -198,10 +198,10 @@ void event_button_informations_handler(lv_event_t *e) { esp3d_log("informations Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::informations; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else menu_screen_delay_timer_cb(NULL); } @@ -234,7 +234,7 @@ void menu_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_menu_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_t *ui_main_container = mainContainer::create_main_container( @@ -258,7 +258,7 @@ void menu_screen() { // Create button and label for filament button lv_obj_t *btn1 = symbolButton::create_symbol_button( - ui_top_buttons_container, LV_SYMBOL_FILAMENT, BUTTON_WIDTH, BUTTON_HEIGHT, + ui_top_buttons_container, LV_SYMBOL_FILAMENT, ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_HEIGHT, true, false, 90); lv_obj_add_event_cb(btn1, event_button_filament_handler, LV_EVENT_CLICKED, NULL); @@ -272,7 +272,7 @@ void menu_screen() { // Create button and label for disable steppers button main_btn_disable_steppers = symbolButton::create_symbol_button( - ui_top_buttons_container, LV_SYMBOL_ENGINE, BUTTON_WIDTH, BUTTON_HEIGHT, + ui_top_buttons_container, LV_SYMBOL_ENGINE, ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_HEIGHT, true, true, 90); lv_obj_add_event_cb(main_btn_disable_steppers, event_button_disable_steppers_handler, LV_EVENT_CLICKED, diff --git a/main/display/3dprinter/smoothieware/screens/positions_screen.cpp b/main/display/3dprinter/smoothieware/screens/positions_screen.cpp index 44b60999..543ca46c 100644 --- a/main/display/3dprinter/smoothieware/screens/positions_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/positions_screen.cpp @@ -93,10 +93,10 @@ void positions_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_positions_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (positions_screen_delay_timer) return; positions_screen_delay_timer = lv_timer_create( - positions_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + positions_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { positions_screen_delay_timer_cb(NULL); } @@ -312,7 +312,7 @@ void positions_screen(uint8_t target_id) { lv_obj_del(ui_current_screen); // back button - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_positions_back_handler, LV_EVENT_CLICKED, NULL); @@ -322,9 +322,9 @@ void positions_screen(uint8_t target_id) { ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(positions_buttons_map) / sizeof(positions_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, positions_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_add_event_cb(btnm, positions_matrix_buttons_event_cb, @@ -335,18 +335,18 @@ void positions_screen(uint8_t target_id) { lv_btnmatrix_set_map(btnm_target, axis_buttons_map); ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); size_t i2 = (sizeof(axis_buttons_map) / sizeof(axis_buttons_map[0])) - 1; - lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i2, MATRIX_BUTTON_HEIGHT); + lv_obj_set_size(btnm_target, ESP3D_MATRIX_BUTTON_WIDTH * i2, ESP3D_MATRIX_BUTTON_HEIGHT); lv_btnmatrix_set_btn_ctrl(btnm_target, axis_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align_to(btnm_target, btnback, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); // Home all axis lv_obj_t *btn_home_all = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_HOME "xyz", MATRIX_BUTTON_WIDTH, - MATRIX_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_HOME "xyz", ESP3D_MATRIX_BUTTON_WIDTH, + ESP3D_MATRIX_BUTTON_HEIGHT); lv_obj_align_to(btn_home_all, btnm_target, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); // Label current axis label_current_position = lv_label_create(ui_new_screen); @@ -355,7 +355,7 @@ void positions_screen(uint8_t target_id) { // according axis ESP3DStyle::apply(label_current_position, ESP3DStyleType::bg_label); lv_obj_align(label_current_position, LV_ALIGN_TOP_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_position); // Label current axis e @@ -386,7 +386,7 @@ void positions_screen(uint8_t target_id) { ESP3DStyle::apply(label_current_position_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_position_value, LV_HOR_RES / 5); lv_obj_align_to(label_current_position_value, label_current_position, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); @@ -394,13 +394,13 @@ void positions_screen(uint8_t target_id) { esp3dTranslationService.translate(ESP3DLabel::millimeters)); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_position_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_UP "\n" LV_SYMBOL_PLUS); lv_obj_align_to(btn_up, label_current_position_value, LV_ALIGN_OUT_BOTTOM_MID, - 0, CURRENT_BUTTON_PRESSED_OUTLINE); + 0, ESP3D_BUTTON_PRESSED_OUTLINE); // Text area position_ta = lv_textarea_create(ui_new_screen); lv_obj_add_event_cb(position_ta, position_ta_event_cb, LV_EVENT_VALUE_CHANGED, @@ -419,7 +419,7 @@ void positions_screen(uint8_t target_id) { lv_obj_set_width(position_ta, LV_HOR_RES / 5); lv_obj_align_to(position_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_up, positions_btn_up_event_cb, LV_EVENT_CLICKED, position_ta); @@ -431,7 +431,7 @@ void positions_screen(uint8_t target_id) { // axis ESP3DStyle::apply(label_target, ESP3DStyleType::bg_label); lv_obj_align_to(label_target, position_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); @@ -440,18 +440,18 @@ void positions_screen(uint8_t target_id) { ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, position_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // set button btn_set = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_OK); lv_obj_align_to(btn_set, label_unit2, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_set, positions_btn_ok_event_cb, LV_EVENT_CLICKED, position_ta); // Home axis lv_obj_t *btn_home_axis = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_HOME); lv_obj_align_to(btn_home_axis, btn_set, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_home_axis, positions_btn_home_axis_event_cb, LV_EVENT_CLICKED, position_ta); lv_obj_add_event_cb(btn_home_all, home_all_axis_button_event_cb, @@ -469,7 +469,7 @@ void positions_screen(uint8_t target_id) { &absolute_position); lv_obj_align_to(btn_mode, btnm, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // Keyboard lv_obj_t *positions_kb = lv_keyboard_create(ui_new_screen); @@ -478,11 +478,11 @@ void positions_screen(uint8_t target_id) { lv_obj_update_layout(label_unit2); lv_obj_set_content_width(positions_kb, LV_HOR_RES - (lv_obj_get_x(label_unit2) + - CURRENT_BUTTON_PRESSED_OUTLINE)); + ESP3D_BUTTON_PRESSED_OUTLINE)); lv_obj_align_to(positions_kb, position_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2); - lv_obj_set_style_radius(positions_kb, CURRENT_BUTTON_RADIUS_VALUE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2, + -ESP3D_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_style_radius(positions_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(positions_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(position_ta, position_ta_event_cb, LV_EVENT_ALL, @@ -491,7 +491,7 @@ void positions_screen(uint8_t target_id) { lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, position_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, positions_btn_down_event_cb, LV_EVENT_CLICKED, position_ta); updateMode(absolute_position); diff --git a/main/display/3dprinter/smoothieware/screens/settings_screen.cpp b/main/display/3dprinter/smoothieware/screens/settings_screen.cpp index 7601a4ac..0e0b3685 100644 --- a/main/display/3dprinter/smoothieware/screens/settings_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/settings_screen.cpp @@ -556,7 +556,7 @@ void event_button_edit_setting_cb(lv_event_t *e) { } data.value = lv_label_get_text(data.label); if (data.choices.size() > 0) { - choiceEditor::create_choice_editor(lv_scr_act(), data.value.c_str(), + choiceEditor::create(lv_scr_act(), data.value.c_str(), title.c_str(), data.choices, setting_edit_done_cb, (void *)(&data)); } else { @@ -598,10 +598,10 @@ void event_button_edit_setting_cb(lv_event_t *e) { // event_button_settings_back_handler void event_button_settings_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (settings_screen_delay_timer) return; settings_screen_delay_timer = lv_timer_create( - settings_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + settings_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { settings_screen_delay_timer_cb(NULL); } @@ -618,32 +618,32 @@ void settings_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_settings_back_handler, LV_EVENT_CLICKED, NULL); ui_settings_list_ctl = lv_list_create(ui_new_screen); lv_obj_clear_flag(ui_settings_list_ctl, LV_OBJ_FLAG_SCROLL_ELASTIC); - lv_obj_set_style_pad_left(ui_settings_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_left(ui_settings_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); - lv_obj_set_style_pad_right(ui_settings_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_right(ui_settings_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); lv_obj_set_size( - ui_settings_list_ctl, LV_HOR_RES - CURRENT_BUTTON_PRESSED_OUTLINE * 2, + ui_settings_list_ctl, LV_HOR_RES - ESP3D_BUTTON_PRESSED_OUTLINE * 2, LV_VER_RES - - ((3 * CURRENT_BUTTON_PRESSED_OUTLINE) + lv_obj_get_height(btnback))); + ((3 * ESP3D_BUTTON_PRESSED_OUTLINE) + lv_obj_get_height(btnback))); - lv_obj_set_pos(ui_settings_list_ctl, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(ui_settings_list_ctl, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_t *line_container = NULL; std::string LabelStr = ""; // Language - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::ui_language); if (line_container) { std::string ui_language; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_ui_language); esp3d_log("Looking for index %d", @@ -661,19 +661,19 @@ void settings_screen() { ui_language = "English"; } language_label = - listLine::add_label_to_line(ui_language.c_str(), line_container, true); + listLine::add_label(ui_language.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } // Hostname - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::hostname); if (line_container) { std::string hostname; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_hostname); if (settingPtr) { @@ -682,9 +682,9 @@ void settings_screen() { out_str, settingPtr->size); } hostname_label = - listLine::add_label_to_line(hostname.c_str(), line_container, true); + listLine::add_label(hostname.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -692,23 +692,23 @@ void settings_screen() { // Extensions static ESP3DSettingIndex extensions_setting_index = ESP3DSettingIndex::esp3d_extensions; - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::extensions); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); - extensions_label = listLine::add_label_to_line("", line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); + extensions_label = listLine::add_label("", line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)&(extensions_setting_index)); } #if ESP3D_USB_SERIAL_FEATURE // USB Serial - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::output_client); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_output_client); if (settingPtr) { @@ -721,9 +721,9 @@ void settings_screen() { ? esp3dTranslationService.translate(ESP3DLabel::usb) : "???"; output_client_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -731,10 +731,10 @@ void settings_screen() { #endif // ESP3D_USB_SERIAL_FEATURE // Serial Baud rate - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::serial_baud_rate); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_baud_rate); if (settingPtr) { @@ -742,9 +742,9 @@ void settings_screen() { esp3dTftsettings.readUint32(ESP3DSettingIndex::esp3d_baud_rate); std::string value = std::to_string(val); serial_baud_rate_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -752,10 +752,10 @@ void settings_screen() { #if ESP3D_USB_SERIAL_FEATURE // USB serial Baud rate - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::usb_baud_rate); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr( ESP3DSettingIndex::esp3d_usb_serial_baud_rate); if (settingPtr) { @@ -763,9 +763,9 @@ void settings_screen() { ESP3DSettingIndex::esp3d_usb_serial_baud_rate); std::string value = std::to_string(val); usb_serial_baud_rate_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -773,10 +773,10 @@ void settings_screen() { #endif // ESP3D_USB_SERIAL_FEATURE // Jog type - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::jog_type); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_jog_type); if (settingPtr) { @@ -786,19 +786,19 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::relative) : esp3dTranslationService.translate(ESP3DLabel::absolute); jog_type_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } } // Polling on - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::polling); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_polling_on); if (settingPtr) { @@ -808,9 +808,9 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); polling_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -820,23 +820,23 @@ void settings_screen() { // show fan controls static ESP3DSettingIndex show_fan_controls_setting_index = ESP3DSettingIndex::esp3d_show_fan_controls; - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::fan_controls); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); show_fan_controls_label = - listLine::add_label_to_line("", line_container, true); + listLine::add_label("", line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)&(show_fan_controls_setting_index)); } // Auto level on - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::auto_leveling); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_auto_level_on); if (settingPtr) { @@ -846,20 +846,20 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); auto_leveling_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } } // Bed width - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::bed_width); if (line_container) { std::string bed_width_str; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_bed_width); if (settingPtr) { @@ -869,20 +869,20 @@ void settings_screen() { } else { esp3d_log_e("Failed to get bed width setting"); } - bed_width_label = listLine::add_label_to_line(bed_width_str.c_str(), + bed_width_label = listLine::add_label(bed_width_str.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } // Bed depth - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::bed_depth); if (line_container) { std::string bed_depth_str; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_bed_depth); if (settingPtr) { @@ -892,19 +892,19 @@ void settings_screen() { } else { esp3d_log_e("Failed to get bed depth setting"); } - bed_depth_label = listLine::add_label_to_line(bed_depth_str.c_str(), + bed_depth_label = listLine::add_label(bed_depth_str.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } // Invert X axis - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::invert_axis, "X"); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_inverved_x); if (settingPtr) { @@ -914,19 +914,19 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); inverted_x_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } } // Invert Y axis - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::invert_axis, "Y"); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_inverved_y); if (settingPtr) { @@ -936,9 +936,9 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); inverted_y_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } diff --git a/main/display/3dprinter/smoothieware/screens/speed_screen.cpp b/main/display/3dprinter/smoothieware/screens/speed_screen.cpp index 4f8c496b..cca7df8a 100644 --- a/main/display/3dprinter/smoothieware/screens/speed_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/speed_screen.cpp @@ -52,10 +52,10 @@ void speed_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_speed_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (speed_screen_delay_timer) return; speed_screen_delay_timer = lv_timer_create(speed_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { speed_screen_delay_timer_cb(NULL); } @@ -165,7 +165,7 @@ void speed_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_speed_back_handler, LV_EVENT_CLICKED, NULL); @@ -174,9 +174,9 @@ void speed_screen() { lv_btnmatrix_set_map(btnm, speed_buttons_map); ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(speed_buttons_map) / sizeof(speed_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, speed_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_add_event_cb(btnm, speed_matrix_buttons_event_cb, @@ -187,7 +187,7 @@ void speed_screen() { lv_label_set_text(label_current_speed, LV_SYMBOL_SPEED); ESP3DStyle::apply(label_current_speed, ESP3DStyleType::bg_label); lv_obj_align(label_current_speed, LV_ALIGN_TOP_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_speed); // Current Speed value @@ -200,7 +200,7 @@ void speed_screen() { ESP3DStyle::apply(label_current_speed_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_speed_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_speed_value, label_current_speed, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit @@ -208,14 +208,14 @@ void speed_screen() { lv_label_set_text(label_unit1, "%"); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_speed_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_UP "\n" LV_SYMBOL_PLUS); lv_obj_align_to(btn_up, label_current_speed_value, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // speed input lv_obj_t *speed_ta = lv_textarea_create(ui_new_screen); lv_obj_add_event_cb(speed_ta, speed_ta_event_cb, LV_EVENT_VALUE_CHANGED, @@ -227,27 +227,27 @@ void speed_screen() { lv_obj_set_style_text_align(speed_ta, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_width(speed_ta, LV_HOR_RES / 6); lv_obj_align_to(speed_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_SPEED); ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_align_to(label_ta, speed_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, "%"); ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, speed_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // button down lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, speed_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, speed_btn_down_event_cb, LV_EVENT_CLICKED, speed_ta); @@ -258,7 +258,7 @@ void speed_screen() { lv_obj_t *btn_ok = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_OK); lv_obj_align_to(btn_ok, label_unit2, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_ok, speed_btn_ok_event_cb, LV_EVENT_CLICKED, speed_ta); @@ -266,7 +266,7 @@ void speed_screen() { lv_obj_t *btn_reset = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_GAUGE); lv_obj_align_to(btn_reset, btn_ok, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_reset, speed_btn_reset_event_cb, LV_EVENT_CLICKED, speed_ta); @@ -275,11 +275,11 @@ void speed_screen() { lv_keyboard_set_mode(speed_kb, LV_KEYBOARD_MODE_NUMBER); lv_keyboard_set_textarea(speed_kb, NULL); lv_obj_align_to(speed_kb, speed_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); lv_obj_update_layout(speed_kb); lv_obj_set_content_width(speed_kb, LV_HOR_RES - lv_obj_get_x(speed_kb) - - 2 * CURRENT_BUTTON_PRESSED_OUTLINE); - lv_obj_set_style_radius(speed_kb, CURRENT_BUTTON_RADIUS_VALUE, LV_PART_MAIN); + 2 * ESP3D_BUTTON_PRESSED_OUTLINE); + lv_obj_set_style_radius(speed_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(speed_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(speed_ta, speed_ta_event_cb, LV_EVENT_ALL, speed_kb); diff --git a/main/display/3dprinter/smoothieware/screens/temperatures_screen.cpp b/main/display/3dprinter/smoothieware/screens/temperatures_screen.cpp index fb9dbaa6..2a563f68 100644 --- a/main/display/3dprinter/smoothieware/screens/temperatures_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/temperatures_screen.cpp @@ -132,14 +132,14 @@ bool updateBtnMatrix() { ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); - lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); + lv_obj_set_size(btnm_target, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); esp3d_log("child count: %d", i); // lv_obj_add_state(obj, LV_STATE_DISABLED); if (heater_buttons_map_id > i) heater_buttons_map_id = 0; lv_btnmatrix_set_btn_ctrl(btnm_target, heater_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_align_to(btnm_target, btnback, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); return true; } @@ -181,10 +181,10 @@ void temperatures_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_temperatures_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (temperatures_screen_delay_timer) return; temperatures_screen_delay_timer = lv_timer_create( - temperatures_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + temperatures_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { temperatures_screen_delay_timer_cb(NULL); } @@ -446,7 +446,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_del(ui_current_screen); // back button - btnback = backButton::create_back_button(ui_new_screen); + btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_temperatures_back_handler, LV_EVENT_CLICKED, NULL); @@ -457,9 +457,9 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { size_t i = (sizeof(temperatures_buttons_map) / sizeof(temperatures_buttons_map[0])) - 1; - lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); - lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_size(btnm, ESP3D_MATRIX_BUTTON_WIDTH * i, ESP3D_MATRIX_BUTTON_HEIGHT); + lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_btnmatrix_set_btn_ctrl(btnm, temperatures_buttons_map_id, LV_BTNMATRIX_CTRL_CHECKED); lv_obj_add_event_cb(btnm, temperatures_matrix_buttons_event_cb, @@ -472,10 +472,10 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // Power off all heater lv_obj_t *btn_power_off_all = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_POWER "...", MATRIX_BUTTON_WIDTH, - MATRIX_BUTTON_HEIGHT); + ui_new_screen, LV_SYMBOL_POWER "...", ESP3D_MATRIX_BUTTON_WIDTH, + ESP3D_MATRIX_BUTTON_HEIGHT); lv_obj_align_to(btn_power_off_all, btnm_target, LV_ALIGN_OUT_LEFT_BOTTOM, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); // Label current heater label_current_temperature = lv_label_create(ui_new_screen); @@ -486,7 +486,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // heater ESP3DStyle::apply(label_current_temperature, ESP3DStyleType::bg_label); lv_obj_align(label_current_temperature, LV_ALIGN_TOP_LEFT, - CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE, ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_temperature); // Label current heater e @@ -526,7 +526,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { ESP3DStyle::apply(label_current_temperature_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_temperature_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_temperature_value, label_current_temperature, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); @@ -534,14 +534,14 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { esp3dTranslationService.translate(ESP3DLabel::celsius)); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_temperature_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Button up lv_obj_t *btn_up = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_UP "\n" LV_SYMBOL_PLUS); lv_obj_align_to(btn_up, label_current_temperature_value, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // Text area lv_obj_t *temperatures_ta = lv_textarea_create(ui_new_screen); lv_obj_add_event_cb(temperatures_ta, temperatures_ta_event_cb, @@ -559,7 +559,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_set_width(temperatures_ta, LV_HOR_RES / 6); lv_obj_align_to(temperatures_ta, btn_up, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_up, temperatures_btn_up_event_cb, LV_EVENT_CLICKED, temperatures_ta); @@ -575,7 +575,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // heater ESP3DStyle::apply(label_target, ESP3DStyleType::bg_label); lv_obj_align_to(label_target, temperatures_ta, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); @@ -584,19 +584,19 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, temperatures_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // set button lv_obj_t *btn_set = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_OK); lv_obj_align_to(btn_set, label_unit2, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_set, temperatures_btn_ok_event_cb, LV_EVENT_CLICKED, temperatures_ta); // Power off button to 0 lv_obj_t *btn_stop = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_POWER); lv_obj_align_to(btn_stop, btn_set, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE, 0); + ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btn_stop, temperatures_btn_power_off_event_cb, LV_EVENT_CLICKED, temperatures_ta); // Keyboard @@ -606,11 +606,11 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_update_layout(label_unit2); lv_obj_set_content_width(temperatures_kb, LV_HOR_RES - (lv_obj_get_x(label_unit2) + - CURRENT_BUTTON_PRESSED_OUTLINE)); + ESP3D_BUTTON_PRESSED_OUTLINE)); lv_obj_align_to(temperatures_kb, temperatures_ta, LV_ALIGN_OUT_RIGHT_MID, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, - -CURRENT_BUTTON_PRESSED_OUTLINE / 2); - lv_obj_set_style_radius(temperatures_kb, CURRENT_BUTTON_RADIUS_VALUE, + ESP3D_BUTTON_PRESSED_OUTLINE / 2, + -ESP3D_BUTTON_PRESSED_OUTLINE / 2); + lv_obj_set_style_radius(temperatures_kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_flag(temperatures_kb, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(temperatures_ta, temperatures_ta_event_cb, LV_EVENT_ALL, @@ -619,7 +619,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_t *btn_down = symbolButton::create_symbol_button( ui_new_screen, LV_SYMBOL_MINUS "\n" LV_SYMBOL_DOWN); lv_obj_align_to(btn_down, temperatures_ta, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); lv_obj_add_event_cb(btn_down, temperatures_btn_down_event_cb, LV_EVENT_CLICKED, temperatures_ta); @@ -633,7 +633,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_set_width(label_target_temperature_value, LV_HOR_RES / 6); lv_obj_align_to(label_target_temperature_value, btn_down, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE / 2); + ESP3D_BUTTON_PRESSED_OUTLINE / 2); // unit label_unit1 = lv_label_create(ui_new_screen); @@ -641,7 +641,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { esp3dTranslationService.translate(ESP3DLabel::celsius)); ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_target_temperature_value, - LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_RIGHT_MID, ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); // Label target heater @@ -653,7 +653,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { ESP3DStyle::apply(label_target_temperature, ESP3DStyleType::bg_label); lv_obj_align_to(label_target_temperature, label_target_temperature_value, - LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, + LV_ALIGN_OUT_LEFT_MID, -ESP3D_BUTTON_PRESSED_OUTLINE / 2, 0); esp3dTftui.set_current_screen(ESP3DScreenType::temperatures); diff --git a/main/display/cnc/grbl/esp3d_styles.cpp b/main/display/cnc/grbl/esp3d_styles.cpp index 36c2e232..df0545db 100644 --- a/main/display/cnc/grbl/esp3d_styles.cpp +++ b/main/display/cnc/grbl/esp3d_styles.cpp @@ -26,21 +26,21 @@ #define ESP3D_SCREEN_BACKGROUND_TEXT_COLOR lv_color_hex(0xFFFFFF) -#define CURRENT_STATUS_BAR_TEXT_COLOR lv_color_hex(0x000000) -#define CURRENT_STATUS_BAR_BG_COLOR lv_color_hex(0xFFFFFF) +#define ESP3D_STATUS_BAR_TEXT_COLOR lv_color_hex(0x000000) +#define ESP3D_STATUS_BAR_BG_COLOR lv_color_hex(0xFFFFFF) -#define CURRENT_STATUS_BAR_BORDER_COLOR lv_palette_main(LV_PALETTE_GREY) +#define ESP3D_STATUS_BAR_BORDER_COLOR lv_palette_main(LV_PALETTE_GREY) -#define CURRENT_BUTTON_COLOR_PALETTE LV_PALETTE_GREY -#define CURRENT_BUTTON_COLOR_PALETTE_DARKEN 2 +#define ESP3D_BUTTON_COLOR_PALETTE LV_PALETTE_GREY +#define ESP3D_BUTTON_COLOR_PALETTE_DARKEN 2 -#define CURRENT_BUTTON_BORDER_COLOR \ +#define ESP3D_BUTTON_BORDER_COLOR \ lv_color_hex(0xFFFFFF) // lv_palette_main(LV_PALETTE_GREY) -#define CURRENT_BUTTON_TEXT_COLOR lv_color_hex(0xFFFFFF) -#define CURRENT_BUTTON_OUTLINE_COLOR_PALETTE LV_PALETTE_GREEN -#define CURRENT_BUTTON_PRESSED_COLOR_PALETTE LV_PALETTE_GREY -#define CURRENT_BUTTON_PRESSED_TEXT_COLOR lv_color_hex(0x00FF00) -#define CURRENT_BUTTON_PRESSED_BORDER_COLOR lv_color_hex(0x00FF00) +#define ESP3D_BUTTON_TEXT_COLOR lv_color_hex(0xFFFFFF) +#define ESP3D_BUTTON_OUTLINE_COLOR_PALETTE LV_PALETTE_GREEN +#define ESP3D_BUTTON_PRESSED_COLOR_PALETTE LV_PALETTE_GREY +#define ESP3D_BUTTON_PRESSED_TEXT_COLOR lv_color_hex(0x00FF00) +#define ESP3D_BUTTON_PRESSED_BORDER_COLOR lv_color_hex(0x00FF00) // Create styles for main background lv_style_t style_main_bg; @@ -121,14 +121,14 @@ bool ESP3DStyle::init() { lv_style_set_text_opa(&style_read_only_value, LV_OPA_COVER); lv_style_set_text_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); lv_style_set_bg_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_COLOR); - lv_style_set_radius(&style_read_only_value, CURRENT_STATUS_BAR_RADIUS); + lv_style_set_radius(&style_read_only_value, ESP3D_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_value, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_read_only_value, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); lv_style_set_text_align(&style_read_only_value, LV_TEXT_ALIGN_CENTER); - lv_style_set_pad_top(&style_read_only_value, CURRENT_BUTTON_PAD); - lv_style_set_pad_bottom(&style_read_only_value, CURRENT_BUTTON_PAD); + lv_style_set_pad_top(&style_read_only_value, ESP3D_BUTTON_PAD); + lv_style_set_pad_bottom(&style_read_only_value, ESP3D_BUTTON_PAD); /* read only setting on main background @@ -136,16 +136,16 @@ bool ESP3DStyle::init() { lv_style_init(&style_read_only_setting); lv_style_set_text_opa(&style_read_only_setting, LV_OPA_COVER); lv_style_set_text_color(&style_read_only_setting, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_bg_color(&style_read_only_setting, ESP3D_SCREEN_BACKGROUND_COLOR); - lv_style_set_radius(&style_read_only_setting, CURRENT_STATUS_BAR_RADIUS); + lv_style_set_radius(&style_read_only_setting, ESP3D_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_setting, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_read_only_setting, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); lv_style_set_text_align(&style_read_only_setting, LV_TEXT_ALIGN_CENTER); - lv_style_set_pad_top(&style_read_only_setting, CURRENT_BUTTON_PAD); - lv_style_set_pad_bottom(&style_read_only_setting, CURRENT_BUTTON_PAD); + lv_style_set_pad_top(&style_read_only_setting, ESP3D_BUTTON_PAD); + lv_style_set_pad_bottom(&style_read_only_setting, ESP3D_BUTTON_PAD); /* Status bar @@ -154,16 +154,16 @@ bool ESP3DStyle::init() { lv_style_set_text_opa(&style_status_bar_default, LV_OPA_COVER); lv_style_set_text_color(&style_status_bar_default, - CURRENT_STATUS_BAR_TEXT_COLOR); + ESP3D_STATUS_BAR_TEXT_COLOR); lv_style_set_bg_opa(&style_status_bar_default, LV_OPA_COVER); - lv_style_set_bg_color(&style_status_bar_default, CURRENT_STATUS_BAR_BG_COLOR); - lv_style_set_radius(&style_status_bar_default, CURRENT_STATUS_BAR_RADIUS); - lv_style_set_pad_hor(&style_status_bar_default, CURRENT_STATUS_BAR_H_PAD); - lv_style_set_pad_ver(&style_status_bar_default, CURRENT_STATUS_BAR_V_PAD); + lv_style_set_bg_color(&style_status_bar_default, ESP3D_STATUS_BAR_BG_COLOR); + lv_style_set_radius(&style_status_bar_default, ESP3D_STATUS_BAR_RADIUS); + lv_style_set_pad_hor(&style_status_bar_default, ESP3D_STATUS_BAR_H_PAD); + lv_style_set_pad_ver(&style_status_bar_default, ESP3D_STATUS_BAR_V_PAD); lv_style_set_border_width(&style_status_bar_default, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_status_bar_default, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); /* Scrollbar @@ -171,7 +171,7 @@ bool ESP3DStyle::init() { // Create style for scrollbar default state lv_style_init(&style_scrollbar_default); - lv_style_set_width(&style_scrollbar_default, CURRENT_SCROLL_BAR_WIDTH); + lv_style_set_width(&style_scrollbar_default, ESP3D_SCROLL_BAR_WIDTH); lv_style_set_bg_opa(&style_scrollbar_default, LV_OPA_COVER); lv_style_set_bg_color(&style_scrollbar_default, lv_palette_main(LV_PALETTE_GREY)); @@ -179,12 +179,12 @@ bool ESP3DStyle::init() { lv_style_set_border_color( &style_scrollbar_default, lv_palette_darken(LV_PALETTE_GREY, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_border_opa(&style_scrollbar_default, LV_OPA_COVER); lv_style_set_border_width(&style_scrollbar_default, - CURRENT_BUTTON_BORDER_VALUE); - lv_style_set_radius(&style_scrollbar_default, CURRENT_SCROLL_BAR_RADIUS); + ESP3D_BUTTON_BORDER_SIZE); + lv_style_set_radius(&style_scrollbar_default, ESP3D_SCROLL_BAR_RADIUS); lv_style_set_pad_all(&style_scrollbar_default, 8); // Create style for scrollbar active state lv_style_init(&style_scrollbar_active); @@ -192,11 +192,11 @@ bool ESP3DStyle::init() { lv_style_set_bg_color(&style_scrollbar_active, lv_palette_main(LV_PALETTE_GREEN)); lv_style_set_shadow_width(&style_scrollbar_active, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_shadow_color(&style_scrollbar_active, lv_palette_main(LV_PALETTE_GREEN)); lv_style_set_shadow_spread(&style_scrollbar_active, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); /* Radio Buttons @@ -207,16 +207,16 @@ bool ESP3DStyle::init() { lv_style_set_border_color( &style_btn_radio_default, lv_palette_darken(LV_PALETTE_GREY, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); // Create style for button pressed state lv_style_init(&style_btn_radio_pressed); lv_style_set_shadow_width(&style_btn_radio_pressed, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_shadow_color(&style_btn_radio_pressed, lv_palette_main(LV_PALETTE_GREEN)); lv_style_set_shadow_spread(&style_btn_radio_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_btn_radio_pressed, lv_palette_main(LV_PALETTE_GREEN)); @@ -232,57 +232,57 @@ bool ESP3DStyle::init() { // Create style for button default state lv_style_init(&style_btn_default); - lv_style_set_radius(&style_btn_default, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_default, ESP3D_BUTTON_RADIUS ); lv_style_set_bg_opa(&style_btn_default, LV_OPA_100); lv_style_set_bg_color(&style_btn_default, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_btn_default, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_btn_default, LV_GRAD_DIR_VER); lv_style_set_border_opa(&style_btn_default, LV_OPA_40); - lv_style_set_border_width(&style_btn_default, CURRENT_BUTTON_BORDER_VALUE); - lv_style_set_border_color(&style_btn_default, CURRENT_BUTTON_BORDER_COLOR); + lv_style_set_border_width(&style_btn_default, ESP3D_BUTTON_BORDER_SIZE); + lv_style_set_border_color(&style_btn_default, ESP3D_BUTTON_BORDER_COLOR); lv_style_set_outline_opa(&style_btn_default, LV_OPA_COVER); lv_style_set_outline_color( &style_btn_default, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); - lv_style_set_text_color(&style_btn_default, CURRENT_BUTTON_TEXT_COLOR); - lv_style_set_pad_all(&style_btn_default, CURRENT_BUTTON_PAD); + lv_style_set_text_color(&style_btn_default, ESP3D_BUTTON_TEXT_COLOR); + lv_style_set_pad_all(&style_btn_default, ESP3D_BUTTON_PAD); // Create style for button pressed state lv_style_init(&style_btn_pressed); /*Add a large outline when pressed*/ lv_style_set_outline_width(&style_btn_pressed, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_outline_opa(&style_btn_pressed, LV_OPA_TRANSP); lv_style_set_shadow_ofs_y(&style_btn_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_color( &style_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_text_color(&style_btn_pressed, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_border_color(&style_btn_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); - if (BUTTON_ANIMATION_DELAY) { + ESP3D_BUTTON_PRESSED_BORDER_COLOR); + if (ESP3D_BUTTON_ANIMATION_DELAY) { /*Add a transition to the outline*/ static lv_style_transition_dsc_t trans; static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, LV_STYLE_PROP_INV}; lv_style_transition_dsc_init(&trans, props, lv_anim_path_linear, - BUTTON_ANIMATION_DELAY, 0, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, 0, NULL); lv_style_set_transition(&style_btn_pressed, &trans); } @@ -295,44 +295,44 @@ bool ESP3DStyle::init() { lv_style_set_radius(&style_embedded_btn_default, 0); lv_style_set_bg_opa(&style_embedded_btn_default, LV_OPA_100); lv_style_set_bg_color(&style_embedded_btn_default, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_embedded_btn_default, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_embedded_btn_default, LV_GRAD_DIR_VER); lv_style_set_border_opa(&style_embedded_btn_default, LV_OPA_40); lv_style_set_border_width(&style_embedded_btn_default, - CURRENT_BUTTON_BORDER_VALUE); + ESP3D_BUTTON_BORDER_SIZE); lv_style_set_border_color(&style_embedded_btn_default, - CURRENT_BUTTON_BORDER_COLOR); + ESP3D_BUTTON_BORDER_COLOR); lv_style_set_outline_opa(&style_embedded_btn_default, LV_OPA_COVER); lv_style_set_outline_color( &style_embedded_btn_default, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); lv_style_set_text_color(&style_embedded_btn_default, - CURRENT_BUTTON_TEXT_COLOR); - lv_style_set_pad_all(&style_embedded_btn_default, CURRENT_BUTTON_PAD); + ESP3D_BUTTON_TEXT_COLOR); + lv_style_set_pad_all(&style_embedded_btn_default, ESP3D_BUTTON_PAD); // Create style for embedded button pressed state lv_style_init(&style_embedded_btn_pressed); lv_style_set_shadow_ofs_y(&style_embedded_btn_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_embedded_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_color( &style_embedded_btn_pressed, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_text_color(&style_embedded_btn_pressed, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_border_color(&style_embedded_btn_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); + ESP3D_BUTTON_PRESSED_BORDER_COLOR); /* Buttons matrix @@ -343,33 +343,33 @@ bool ESP3DStyle::init() { lv_style_set_pad_all(&style_btn_matrix_bar, 1); lv_style_set_pad_gap(&style_btn_matrix_bar, 0); lv_style_set_clip_corner(&style_btn_matrix_bar, true); - lv_style_set_radius(&style_btn_matrix_bar, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_bar, ESP3D_BUTTON_RADIUS ); lv_style_set_pad_left(&style_btn_matrix_bar, 4); lv_style_set_pad_top(&style_btn_matrix_bar, 4); // border lv_style_set_border_opa(&style_btn_matrix_bar, LV_OPA_40); - lv_style_set_border_width(&style_btn_matrix_bar, CURRENT_BUTTON_BORDER_VALUE); - lv_style_set_border_color(&style_btn_matrix_bar, CURRENT_BUTTON_BORDER_COLOR); + lv_style_set_border_width(&style_btn_matrix_bar, ESP3D_BUTTON_BORDER_SIZE); + lv_style_set_border_color(&style_btn_matrix_bar, ESP3D_BUTTON_BORDER_COLOR); // bg lv_style_set_bg_opa(&style_btn_matrix_bar, LV_OPA_100); lv_style_set_bg_color(&style_btn_matrix_bar, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_btn_matrix_bar, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_btn_matrix_bar, LV_GRAD_DIR_VER); // text - lv_style_set_text_color(&style_btn_matrix_bar, CURRENT_BUTTON_TEXT_COLOR); + lv_style_set_text_color(&style_btn_matrix_bar, ESP3D_BUTTON_TEXT_COLOR); //***************************************************************** // Default lv_style_init(&style_btn_matrix_default); - lv_style_set_radius(&style_btn_matrix_default, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_default, ESP3D_BUTTON_RADIUS ); // bg // text @@ -380,32 +380,32 @@ bool ESP3DStyle::init() { // Pressed lv_style_init(&style_btn_matrix_pressed); lv_style_set_pad_all(&style_btn_matrix_pressed, 10); - lv_style_set_radius(&style_btn_matrix_pressed, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_pressed, ESP3D_BUTTON_RADIUS ); lv_style_set_outline_opa(&style_btn_matrix_pressed, LV_OPA_40); lv_style_set_outline_color( &style_btn_matrix_pressed, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); lv_style_set_outline_width(&style_btn_matrix_pressed, 1); // bg lv_style_set_bg_opa(&style_btn_matrix_pressed, LV_OPA_60); lv_style_set_bg_color( &style_btn_matrix_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_bg_grad_color( &style_btn_matrix_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); // text lv_style_set_text_color( &style_btn_matrix_pressed, - lv_palette_darken(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); // border lv_style_set_border_color(&style_btn_matrix_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); + ESP3D_BUTTON_PRESSED_BORDER_COLOR); lv_style_set_border_width(&style_btn_matrix_pressed, 3); lv_style_set_border_opa(&style_btn_matrix_pressed, LV_OPA_60); @@ -413,24 +413,24 @@ bool ESP3DStyle::init() { // checked lv_style_init(&style_btn_matrix_checked); lv_style_set_pad_all(&style_btn_matrix_checked, 10); - lv_style_set_radius(&style_btn_matrix_checked, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_matrix_checked, ESP3D_BUTTON_RADIUS ); // bg lv_style_set_bg_opa(&style_btn_matrix_checked, LV_OPA_40); lv_style_set_bg_color( &style_btn_matrix_checked, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_bg_grad_color( &style_btn_matrix_checked, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); // text lv_style_set_text_color(&style_btn_matrix_checked, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); // border lv_style_set_border_color(&style_btn_matrix_checked, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); + ESP3D_BUTTON_PRESSED_BORDER_COLOR); lv_style_set_border_width(&style_btn_matrix_checked, 2); lv_style_set_border_opa(&style_btn_matrix_checked, LV_OPA_40); @@ -439,30 +439,30 @@ bool ESP3DStyle::init() { */ /*Default*/ lv_style_init(&style_btn_msb_box_default); - lv_style_set_radius(&style_btn_msb_box_default, CURRENT_BUTTON_RADIUS_VALUE); + lv_style_set_radius(&style_btn_msb_box_default, ESP3D_BUTTON_RADIUS ); lv_style_set_bg_opa(&style_btn_msb_box_default, LV_OPA_100); lv_style_set_bg_color(&style_btn_msb_box_default, - lv_palette_main(CURRENT_BUTTON_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_COLOR_PALETTE)); lv_style_set_bg_grad_color( &style_btn_msb_box_default, - lv_palette_darken(CURRENT_BUTTON_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_dir(&style_btn_msb_box_default, LV_GRAD_DIR_VER); lv_style_set_border_opa(&style_btn_msb_box_default, LV_OPA_40); lv_style_set_border_width(&style_btn_msb_box_default, - CURRENT_BUTTON_BORDER_VALUE); + ESP3D_BUTTON_BORDER_SIZE); lv_style_set_border_color(&style_btn_msb_box_default, - CURRENT_BUTTON_BORDER_COLOR); + ESP3D_BUTTON_BORDER_COLOR); lv_style_set_outline_opa(&style_btn_msb_box_default, LV_OPA_COVER); lv_style_set_outline_color( &style_btn_msb_box_default, - lv_palette_main(CURRENT_BUTTON_OUTLINE_COLOR_PALETTE)); + lv_palette_main(ESP3D_BUTTON_OUTLINE_COLOR_PALETTE)); lv_style_set_text_color(&style_btn_msb_box_default, - CURRENT_BUTTON_TEXT_COLOR); - lv_style_set_pad_all(&style_btn_msb_box_default, CURRENT_BUTTON_PAD); + ESP3D_BUTTON_TEXT_COLOR); + lv_style_set_pad_all(&style_btn_msb_box_default, ESP3D_BUTTON_PAD); /*Pressed*/ @@ -470,30 +470,30 @@ bool ESP3DStyle::init() { /*Add a large outline when pressed*/ lv_style_set_outline_width(&style_btn_msb_box_pressed, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_style_set_outline_opa(&style_btn_msb_box_pressed, LV_OPA_TRANSP); lv_style_set_shadow_ofs_y(&style_btn_msb_box_pressed, - CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET); + ESP3D_BUTTON_PRESSED_SHADOW_OFFSET); lv_style_set_bg_color(&style_btn_msb_box_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN)); lv_style_set_bg_grad_color( &style_btn_msb_box_pressed, - lv_palette_darken(CURRENT_BUTTON_PRESSED_COLOR_PALETTE, - CURRENT_BUTTON_COLOR_PALETTE_DARKEN * 2)); + lv_palette_darken(ESP3D_BUTTON_PRESSED_COLOR_PALETTE, + ESP3D_BUTTON_COLOR_PALETTE_DARKEN * 2)); lv_style_set_text_color(&style_btn_msb_box_pressed, - CURRENT_BUTTON_PRESSED_TEXT_COLOR); + ESP3D_BUTTON_PRESSED_TEXT_COLOR); lv_style_set_border_color(&style_btn_msb_box_pressed, - CURRENT_BUTTON_PRESSED_BORDER_COLOR); - if (BUTTON_ANIMATION_DELAY) { + ESP3D_BUTTON_PRESSED_BORDER_COLOR); + if (ESP3D_BUTTON_ANIMATION_DELAY) { /*Add a transition to the outline*/ static lv_style_transition_dsc_t trans; static lv_style_prop_t props[] = {LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_OPA, LV_STYLE_PROP_INV}; lv_style_transition_dsc_init(&trans, props, lv_anim_path_linear, - BUTTON_ANIMATION_DELAY, 0, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, 0, NULL); lv_style_set_transition(&style_btn_msb_box_pressed, &trans); } @@ -503,24 +503,24 @@ bool ESP3DStyle::init() { lv_style_init(&style_status_list_default); lv_style_set_text_opa(&style_status_list_default, LV_OPA_COVER); lv_style_set_text_color(&style_status_list_default, - CURRENT_STATUS_BAR_TEXT_COLOR); + ESP3D_STATUS_BAR_TEXT_COLOR); lv_style_set_bg_opa(&style_status_list_default, LV_OPA_COVER); lv_style_set_bg_color(&style_status_list_default, - CURRENT_STATUS_BAR_BG_COLOR); + ESP3D_STATUS_BAR_BG_COLOR); lv_style_set_radius(&style_status_list_default, 0); // lv_style_set_pad_hor(&style_status_list_default, - // CURRENT_STATUS_BAR_H_PAD); + // ESP3D_STATUS_BAR_H_PAD); // lv_style_set_pad_ver(&style_status_list_default, - // CURRENT_STATUS_BAR_V_PAD); + // ESP3D_STATUS_BAR_V_PAD); lv_style_set_border_width(&style_status_list_default, - CURRENT_STATUS_BAR_BORDER_VALUE); + ESP3D_STATUS_BAR_BORDER_VALUE); lv_style_set_border_color(&style_status_list_default, - CURRENT_STATUS_BAR_BORDER_COLOR); + ESP3D_STATUS_BAR_BORDER_COLOR); /* Col Container */ lv_style_init(&style_col_container_default); - lv_style_set_radius(&style_col_container_default, CURRENT_CONTAINER_RADIUS); + lv_style_set_radius(&style_col_container_default, ESP3D_CONTAINER_RADIUS); lv_style_set_layout(&style_col_container_default, LV_LAYOUT_FLEX); lv_style_set_flex_flow(&style_col_container_default, LV_FLEX_FLOW_COLUMN); lv_style_set_flex_main_place(&style_col_container_default, @@ -530,7 +530,7 @@ bool ESP3DStyle::init() { Row Container */ lv_style_init(&style_row_container_default); - lv_style_set_radius(&style_row_container_default, CURRENT_CONTAINER_RADIUS); + lv_style_set_radius(&style_row_container_default, ESP3D_CONTAINER_RADIUS); lv_style_set_layout(&style_row_container_default, LV_LAYOUT_FLEX); lv_style_set_flex_flow(&style_row_container_default, LV_FLEX_FLOW_ROW); lv_style_set_flex_main_place(&style_row_container_default, @@ -627,8 +627,8 @@ bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { lv_obj_set_width(obj, LV_PCT(80)); ESP3DStyle::apply(lv_msgbox_get_close_btn(obj), ESP3DStyleType::button); ESP3DStyle::apply(lv_msgbox_get_btns(obj), ESP3DStyleType::buttons_msgbox); - lv_obj_set_height(lv_msgbox_get_btns(obj), SYMBOL_BUTTON_HEIGHT); - lv_obj_set_width(lv_msgbox_get_btns(obj), MSGBOX_BUTTON_WIDTH); + lv_obj_set_height(lv_msgbox_get_btns(obj), ESP3D_SYMBOL_BUTTON_HEIGHT); + lv_obj_set_width(lv_msgbox_get_btns(obj), ESP3D_MSGBOX_BUTTON_WIDTH); break; case ESP3DStyleType::embedded_button: lv_obj_add_style(obj, &style_embedded_btn_default, LV_STATE_DEFAULT); @@ -638,16 +638,16 @@ bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { case ESP3DStyleType::row_container: lv_obj_add_style(obj, &style_row_container_default, LV_STATE_DEFAULT); lv_obj_set_style_clip_corner(obj, true, 0); - lv_obj_set_style_pad_column(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_column(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); break; case ESP3DStyleType::col_container: lv_obj_add_style(obj, &style_col_container_default, LV_STATE_DEFAULT); lv_obj_set_style_clip_corner(obj, true, 0); - lv_obj_set_style_pad_top(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_top(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_bottom(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_bottom(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); break; case ESP3DStyleType::list_container: @@ -655,10 +655,10 @@ bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_ELASTIC); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_scrollbar_mode(obj, LV_SCROLLBAR_MODE_AUTO); - lv_obj_set_style_pad_row(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_row(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_set_style_flex_main_place(obj, LV_FLEX_ALIGN_START, LV_PART_MAIN); - lv_obj_set_style_pad_all(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_all(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_add_style(obj, &style_scrollbar_default, LV_PART_SCROLLBAR); #pragma GCC diagnostic push @@ -689,10 +689,10 @@ bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { } bool ESP3DStyle::add_pad(lv_obj_t* obj) { - lv_obj_set_style_pad_left(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_right(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_top(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_bottom(obj, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_left(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_set_style_pad_right(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_set_style_pad_top(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_set_style_pad_bottom(obj, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); return true; } \ No newline at end of file diff --git a/main/display/cnc/grbl/res_320_240/esp3d_styles_res.h b/main/display/cnc/grbl/res_320_240/esp3d_styles_res.h index b55f6ce1..f460a318 100644 --- a/main/display/cnc/grbl/res_320_240/esp3d_styles_res.h +++ b/main/display/cnc/grbl/res_320_240/esp3d_styles_res.h @@ -20,48 +20,48 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 4 -#define CURRENT_STATUS_BAR_H_PAD 5 -#define CURRENT_STATUS_BAR_V_PAD 3 -#define CURRENT_STATUS_BAR_BORDER_VALUE 1 -#define CURRENT_STATUS_AREA_HEIGHT 40 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 10) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 2 +#define ESP3D_STATUS_BAR_RADIUS 4 +#define ESP3D_STATUS_BAR_H_PAD 5 +#define ESP3D_STATUS_BAR_V_PAD 3 +#define ESP3D_STATUS_BAR_BORDER_VALUE 1 +#define ESP3D_STATUS_BAR_HEIGHT 40 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 10) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 2 -#define CURRENT_BUTTON_RADIUS_VALUE 4 -#define CURRENT_BUTTON_BORDER_VALUE 2 +#define ESP3D_BUTTON_RADIUS 4 +#define ESP3D_BUTTON_BORDER_SIZE 2 -#define CURRENT_BUTTON_PRESSED_OUTLINE 5 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 3 +#define ESP3D_BUTTON_PRESSED_OUTLINE 5 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 3 -#define CURRENT_CONTAINER_RADIUS 5 +#define ESP3D_CONTAINER_RADIUS 5 -#define BUTTON_WIDTH 60 -#define BUTTON_HEIGHT 60 +#define ESP3D_BUTTON_WIDTH 60 +#define ESP3D_BUTTON_HEIGHT 60 -#define SYMBOL_BUTTON_WIDTH 50 -#define SYMBOL_BUTTON_HEIGHT 44 +#define ESP3D_SYMBOL_BUTTON_WIDTH 50 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 44 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 0 -#endif // BUTTON_ANIMATION_DELAY +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 0 +#endif // ESP3D_BUTTON_ANIMATION_DELAY -#define CURRENT_SPINNER_SIZE 70 +#define ESP3D_SPINNER_SIZE 70 -#define BACK_BUTTON_WIDTH 50 -#define BACK_BUTTON_HEIGHT 40 -#define MATRIX_BUTTON_WIDTH 48 -#define MATRIX_BUTTON_HEIGHT 40 -#define MSGBOX_BUTTON_WIDTH 100 +#define ESP3D_BACK_BUTTON_WIDTH 50 +#define ESP3D_BACK_BUTTON_HEIGHT 40 +#define ESP3D_MATRIX_BUTTON_WIDTH 48 +#define ESP3D_MATRIX_BUTTON_HEIGHT 40 +#define ESP3D_MATRIX_BUTTON_WIDTH 100 -#define LIST_CONTAINER_LR_PAD 6 -#define LIST_LINE_HEIGHT 36 -#define LIST_LINE_BORDER_WIDTH 2 -#define LIST_LINE_BUTTON_WIDTH 40 +#define ESP3D_LIST_CONTAINER_LR_PAD 6 +#define ESP3D_LIST_LINE_HEIGHT 36 +#define ESP3D_LIST_LINE_BORDER_SIZE 2 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 40 -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 1 #define FW_LOGO_Y -1 diff --git a/main/display/cnc/grbl/res_480_272/esp3d_styles_res.h b/main/display/cnc/grbl/res_480_272/esp3d_styles_res.h index b0f1df2f..175a9061 100644 --- a/main/display/cnc/grbl/res_480_272/esp3d_styles_res.h +++ b/main/display/cnc/grbl/res_480_272/esp3d_styles_res.h @@ -20,48 +20,48 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 5 -#define CURRENT_STATUS_BAR_H_PAD 5 -#define CURRENT_STATUS_BAR_V_PAD 3 -#define CURRENT_STATUS_BAR_BORDER_VALUE 1 -#define CURRENT_STATUS_AREA_HEIGHT 50 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 15) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 3 +#define ESP3D_STATUS_BAR_RADIUS 5 +#define ESP3D_STATUS_BAR_H_PAD 5 +#define ESP3D_STATUS_BAR_V_PAD 3 +#define ESP3D_STATUS_BAR_BORDER_VALUE 1 +#define ESP3D_STATUS_BAR_HEIGHT 50 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 15) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 3 -#define CURRENT_BUTTON_RADIUS_VALUE 5 -#define CURRENT_BUTTON_BORDER_VALUE 2 +#define ESP3D_BUTTON_RADIUS 5 +#define ESP3D_BUTTON_BORDER_SIZE 2 -#define CURRENT_BUTTON_PRESSED_OUTLINE 8 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 4 +#define ESP3D_BUTTON_PRESSED_OUTLINE 8 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 4 -#define CURRENT_CONTAINER_RADIUS 5 +#define ESP3D_CONTAINER_RADIUS 5 -#define BUTTON_WIDTH (LV_HOR_RES / 6) -#define BUTTON_HEIGHT BUTTON_WIDTH +#define ESP3D_BUTTON_WIDTH (LV_HOR_RES / 6) +#define ESP3D_BUTTON_HEIGHT ESP3D_BUTTON_WIDTH -#define SYMBOL_BUTTON_WIDTH 70 -#define SYMBOL_BUTTON_HEIGHT 50 +#define ESP3D_SYMBOL_BUTTON_WIDTH 70 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 50 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 300 -#endif // BUTTON_ANIMATION_DELAY +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 300 +#endif // ESP3D_BUTTON_ANIMATION_DELAY -#define CURRENT_SPINNER_SIZE 100 +#define ESP3D_SPINNER_SIZE 100 -#define BACK_BUTTON_WIDTH 70 -#define BACK_BUTTON_HEIGHT 33 -#define MATRIX_BUTTON_WIDTH 70 -#define MATRIX_BUTTON_HEIGHT 33 -#define MSGBOX_BUTTON_WIDTH 130 +#define ESP3D_BACK_BUTTON_WIDTH 70 +#define ESP3D_BACK_BUTTON_HEIGHT 33 +#define ESP3D_MATRIX_BUTTON_WIDTH 70 +#define ESP3D_MATRIX_BUTTON_HEIGHT 33 +#define ESP3D_MATRIX_BUTTON_WIDTH 130 -#define LIST_CONTAINER_LR_PAD 10 -#define LIST_LINE_HEIGHT 42 -#define LIST_LINE_BORDER_WIDTH 2 -#define LIST_LINE_BUTTON_WIDTH 50 +#define ESP3D_LIST_CONTAINER_LR_PAD 10 +#define ESP3D_LIST_LINE_HEIGHT 42 +#define ESP3D_LIST_LINE_BORDER_SIZE 2 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 50 -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 10 #define FW_LOGO_Y -1 diff --git a/main/display/cnc/grbl/res_480_320/esp3d_styles_res.h b/main/display/cnc/grbl/res_480_320/esp3d_styles_res.h index e920c267..5a51ebaf 100644 --- a/main/display/cnc/grbl/res_480_320/esp3d_styles_res.h +++ b/main/display/cnc/grbl/res_480_320/esp3d_styles_res.h @@ -20,48 +20,48 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 5 -#define CURRENT_STATUS_BAR_H_PAD 5 -#define CURRENT_STATUS_BAR_V_PAD 3 -#define CURRENT_STATUS_BAR_BORDER_VALUE 1 -#define CURRENT_STATUS_AREA_HEIGHT 50 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 15) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 3 +#define ESP3D_STATUS_BAR_RADIUS 5 +#define ESP3D_STATUS_BAR_H_PAD 5 +#define ESP3D_STATUS_BAR_V_PAD 3 +#define ESP3D_STATUS_BAR_BORDER_VALUE 1 +#define ESP3D_STATUS_BAR_HEIGHT 50 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 15) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 3 -#define CURRENT_BUTTON_RADIUS_VALUE 5 -#define CURRENT_BUTTON_BORDER_VALUE 2 +#define ESP3D_BUTTON_RADIUS 5 +#define ESP3D_BUTTON_BORDER_SIZE 2 -#define CURRENT_BUTTON_PRESSED_OUTLINE 10 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 4 +#define ESP3D_BUTTON_PRESSED_OUTLINE 10 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 4 -#define CURRENT_CONTAINER_RADIUS 5 +#define ESP3D_CONTAINER_RADIUS 5 -#define BUTTON_WIDTH (LV_HOR_RES / 6) -#define BUTTON_HEIGHT BUTTON_WIDTH +#define ESP3D_BUTTON_WIDTH (LV_HOR_RES / 6) +#define ESP3D_BUTTON_HEIGHT ESP3D_BUTTON_WIDTH -#define SYMBOL_BUTTON_WIDTH 70 -#define SYMBOL_BUTTON_HEIGHT 56 +#define ESP3D_SYMBOL_BUTTON_WIDTH 70 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 56 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 300 -#endif // BUTTON_ANIMATION_DELAY +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 300 +#endif // ESP3D_BUTTON_ANIMATION_DELAY -#define CURRENT_SPINNER_SIZE 100 +#define ESP3D_SPINNER_SIZE 100 -#define BACK_BUTTON_WIDTH 70 -#define BACK_BUTTON_HEIGHT 50 -#define MATRIX_BUTTON_WIDTH 70 -#define MATRIX_BUTTON_HEIGHT 50 -#define MSGBOX_BUTTON_WIDTH 130 +#define ESP3D_BACK_BUTTON_WIDTH 70 +#define ESP3D_BACK_BUTTON_HEIGHT 50 +#define ESP3D_MATRIX_BUTTON_WIDTH 70 +#define ESP3D_MATRIX_BUTTON_HEIGHT 50 +#define ESP3D_MATRIX_BUTTON_WIDTH 130 -#define LIST_CONTAINER_LR_PAD 10 -#define LIST_LINE_HEIGHT 45 -#define LIST_LINE_BORDER_WIDTH 3 -#define LIST_LINE_BUTTON_WIDTH 50 +#define ESP3D_LIST_CONTAINER_LR_PAD 10 +#define ESP3D_LIST_LINE_HEIGHT 45 +#define ESP3D_LIST_LINE_BORDER_SIZE 3 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 50 -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 10 #define FW_LOGO_Y -10 \ No newline at end of file diff --git a/main/display/cnc/grbl/res_800_480/esp3d_styles_res.h b/main/display/cnc/grbl/res_800_480/esp3d_styles_res.h index 6c0f54ba..e3d7c9b0 100644 --- a/main/display/cnc/grbl/res_800_480/esp3d_styles_res.h +++ b/main/display/cnc/grbl/res_800_480/esp3d_styles_res.h @@ -20,47 +20,47 @@ #pragma once -#define CURRENT_STATUS_BAR_RADIUS 10 -#define CURRENT_STATUS_BAR_H_PAD 10 -#define CURRENT_STATUS_BAR_V_PAD 4 -#define CURRENT_STATUS_BAR_BORDER_VALUE 2 -#define CURRENT_STATUS_AREA_HEIGHT 80 -#define CURRENT_STATUS_AREA_WIDTH LV_HOR_RES - (2 * 30) -#define CURRENT_CHOICE_LIST_WIDTH LV_HOR_RES / 3 - -#define CURRENT_BUTTON_RADIUS_VALUE 10 -#define CURRENT_BUTTON_BORDER_VALUE 2 - -#define CURRENT_BUTTON_PRESSED_OUTLINE 20 -#define CURRENT_BUTTON_COLOR_PRESSED_SHADOW_OFFSET 3 -#define CURRENT_BUTTON_PAD 10 - -#define CURRENT_CONTAINER_RADIUS 10 - -#define BUTTON_WIDTH (LV_HOR_RES / 6) -#define BUTTON_HEIGHT BUTTON_WIDTH - -#define SYMBOL_BUTTON_WIDTH 100 -#define SYMBOL_BUTTON_HEIGHT 85 -#ifndef BUTTON_ANIMATION_DELAY -#define BUTTON_ANIMATION_DELAY 300 -#endif // BUTTON_ANIMATION_DELAY - -#define CURRENT_SPINNER_SIZE 100 - -#define BACK_BUTTON_WIDTH 100 -#define BACK_BUTTON_HEIGHT 75 -#define MATRIX_BUTTON_WIDTH 100 -#define MATRIX_BUTTON_HEIGHT 75 -#define MSGBOX_BUTTON_WIDTH 220 - -#define LIST_CONTAINER_LR_PAD 20 -#define LIST_LINE_HEIGHT 64 -#define LIST_LINE_BORDER_WIDTH 4 -#define LIST_LINE_BUTTON_WIDTH 80 - -#define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 +#define ESP3D_STATUS_BAR_RADIUS 10 +#define ESP3D_STATUS_BAR_H_PAD 10 +#define ESP3D_STATUS_BAR_V_PAD 4 +#define ESP3D_STATUS_BAR_BORDER_VALUE 2 +#define ESP3D_STATUS_BAR_HEIGHT 80 +#define ESP3D_STATUS_BAR_WIDTH LV_HOR_RES - (2 * 30) +#define ESP3D_CHOICE_LIST_WIDTH LV_HOR_RES / 3 + +#define ESP3D_BUTTON_RADIUS 10 +#define ESP3D_BUTTON_BORDER_SIZE 2 + +#define ESP3D_BUTTON_PRESSED_OUTLINE 20 +#define ESP3D_BUTTON_PRESSED_SHADOW_OFFSET 3 +#define ESP3D_BUTTON_PAD 10 + +#define ESP3D_CONTAINER_RADIUS 10 + +#define ESP3D_BUTTON_WIDTH (LV_HOR_RES / 6) +#define ESP3D_BUTTON_HEIGHT ESP3D_BUTTON_WIDTH + +#define ESP3D_SYMBOL_BUTTON_WIDTH 100 +#define ESP3D_SYMBOL_BUTTON_HEIGHT 85 +#ifndef ESP3D_BUTTON_ANIMATION_DELAY +#define ESP3D_BUTTON_ANIMATION_DELAY 300 +#endif // ESP3D_BUTTON_ANIMATION_DELAY + +#define ESP3D_SPINNER_SIZE 100 + +#define ESP3D_BACK_BUTTON_WIDTH 100 +#define ESP3D_BACK_BUTTON_HEIGHT 75 +#define ESP3D_MATRIX_BUTTON_WIDTH 100 +#define ESP3D_MATRIX_BUTTON_HEIGHT 75 +#define ESP3D_MATRIX_BUTTON_WIDTH 220 + +#define ESP3D_LIST_CONTAINER_LR_PAD 20 +#define ESP3D_LIST_LINE_HEIGHT 64 +#define ESP3D_LIST_LINE_BORDER_SIZE 4 +#define ESP3D_LIST_LINE_BUTTON_WIDTH 80 + +#define ESP3D_SCROLL_BAR_WIDTH 10 +#define ESP3D_SCROLL_BAR_RADIUS 5 #define FW_LOGO_X 10 #define FW_LOGO_Y -10 \ No newline at end of file diff --git a/main/display/cnc/grbl/screens/informations_screen.cpp b/main/display/cnc/grbl/screens/informations_screen.cpp index a6e0e54f..07a84c5e 100644 --- a/main/display/cnc/grbl/screens/informations_screen.cpp +++ b/main/display/cnc/grbl/screens/informations_screen.cpp @@ -64,10 +64,10 @@ void informations_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_informations_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (informations_screen_delay_timer) return; informations_screen_delay_timer = lv_timer_create( - informations_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + informations_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else informations_screen_delay_timer_cb(NULL); } @@ -97,7 +97,7 @@ void informations_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_informations_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_update_layout(btnback); @@ -107,16 +107,16 @@ void informations_screen() { ESP3DStyle::apply(ui_info_list_ctl, ESP3DStyleType::status_list); lv_obj_update_layout(ui_new_screen); - lv_obj_set_pos(ui_info_list_ctl, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(ui_info_list_ctl, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_set_size( - ui_info_list_ctl, LV_HOR_RES - CURRENT_BUTTON_PRESSED_OUTLINE * 2, - lv_obj_get_height(ui_new_screen) - (CURRENT_BUTTON_PRESSED_OUTLINE * 3) - + ui_info_list_ctl, LV_HOR_RES - ESP3D_BUTTON_PRESSED_OUTLINE * 2, + lv_obj_get_height(ui_new_screen) - (ESP3D_BUTTON_PRESSED_OUTLINE * 3) - lv_obj_get_height(btnback)); - lv_obj_set_style_radius(ui_info_list_ctl, CURRENT_CONTAINER_RADIUS, 0); - lv_obj_set_style_pad_left(ui_info_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_radius(ui_info_list_ctl, ESP3D_CONTAINER_RADIUS, 0); + lv_obj_set_style_pad_left(ui_info_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); - lv_obj_set_style_pad_right(ui_info_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_right(ui_info_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); addInformationToList(ui_info_list_ctl, ESP3DLabel::screen, TFT_TARGET); diff --git a/main/display/cnc/grbl/screens/main_screen.cpp b/main/display/cnc/grbl/screens/main_screen.cpp index fb5da9e4..447df4f3 100644 --- a/main/display/cnc/grbl/screens/main_screen.cpp +++ b/main/display/cnc/grbl/screens/main_screen.cpp @@ -294,10 +294,10 @@ void event_button_positions_handler(lv_event_t *e) { esp3d_log("Positions Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::positions; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -307,10 +307,10 @@ void event_button_positions_handler(lv_event_t *e) { // esp3d_log("Fan Clicked"); // if (main_screen_delay_timer) return; // next_screen = ESP3DScreenType::fan; -// if (BUTTON_ANIMATION_DELAY) { +// if (ESP3D_BUTTON_ANIMATION_DELAY) { // if (main_screen_delay_timer) return; // main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, -// BUTTON_ANIMATION_DELAY, NULL); +// ESP3D_BUTTON_ANIMATION_DELAY, NULL); // } else { // main_screen_delay_timer_cb(NULL); // } @@ -321,10 +321,10 @@ void event_button_files_handler(lv_event_t *e) { esp3d_log("Files Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::files; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { main_screen_delay_timer_cb(NULL); } @@ -335,10 +335,10 @@ void event_button_menu_handler(lv_event_t *e) { esp3d_log("Menu Clicked"); if (main_screen_delay_timer) return; next_screen = ESP3DScreenType::menu; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (main_screen_delay_timer) return; main_screen_delay_timer = lv_timer_create(main_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else main_screen_delay_timer_cb(NULL); } @@ -420,7 +420,7 @@ void main_screen() { // Create button and label for positions // main_btn_positions = symbolButton::create_symbol_button( - // ui_top_buttons_container, "", BUTTON_WIDTH * 1.5, BUTTON_HEIGHT); + // ui_top_buttons_container, "", ESP3D_BUTTON_WIDTH * 1.5, ESP3D_BUTTON_HEIGHT); // lv_obj_add_event_cb(main_btn_positions, event_button_positions_handler, // LV_EVENT_CLICKED, NULL); @@ -430,8 +430,8 @@ void main_screen() { ESP3DStyle::apply(main_label_progression_area, ESP3DStyleType::status_bar); lv_obj_center(main_label_progression_area); - lv_obj_set_size(main_label_progression_area, CURRENT_STATUS_AREA_WIDTH, - CURRENT_STATUS_AREA_HEIGHT); + lv_obj_set_size(main_label_progression_area, ESP3D_STATUS_BAR_WIDTH, + ESP3D_STATUS_BAR_HEIGHT); // Create button and label for pause main_btn_pause = menuButton::create_menu_button(ui_bottom_buttons_container, diff --git a/main/display/cnc/grbl/screens/menu_screen.cpp b/main/display/cnc/grbl/screens/menu_screen.cpp index 6e689afb..e71d51a6 100644 --- a/main/display/cnc/grbl/screens/menu_screen.cpp +++ b/main/display/cnc/grbl/screens/menu_screen.cpp @@ -91,10 +91,10 @@ void event_button_menu_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::main; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { menu_screen_delay_timer_cb(NULL); } @@ -105,10 +105,10 @@ void event_button_wifi_handler(lv_event_t *e) { esp3d_log("wifi Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::wifi; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { menu_screen_delay_timer_cb(NULL); } @@ -119,10 +119,10 @@ void event_button_settings_handler(lv_event_t *e) { esp3d_log("settings Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::settings; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else menu_screen_delay_timer_cb(NULL); } @@ -131,10 +131,10 @@ void event_button_informations_handler(lv_event_t *e) { esp3d_log("informations Clicked"); if (menu_screen_delay_timer) return; menu_next_screen = ESP3DScreenType::informations; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (menu_screen_delay_timer) return; menu_screen_delay_timer = lv_timer_create(menu_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else menu_screen_delay_timer_cb(NULL); } @@ -154,7 +154,7 @@ void menu_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_menu_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_t *ui_main_container = mainContainer::create_main_container( @@ -178,7 +178,7 @@ void menu_screen() { // Create button and label for filament button // lv_obj_t *btn1 = symbolButton::create_symbol_button( - // ui_top_buttons_container, LV_SYMBOL_FILAMENT, BUTTON_WIDTH, BUTTON_HEIGHT, + // ui_top_buttons_container, LV_SYMBOL_FILAMENT, ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_HEIGHT, // true, false, 90); // lv_obj_add_event_cb(btn1, event_button_filament_handler, LV_EVENT_CLICKED, // NULL); diff --git a/main/display/cnc/grbl/screens/settings_screen.cpp b/main/display/cnc/grbl/screens/settings_screen.cpp index 4224c8ec..107ed384 100644 --- a/main/display/cnc/grbl/screens/settings_screen.cpp +++ b/main/display/cnc/grbl/screens/settings_screen.cpp @@ -511,7 +511,7 @@ void event_button_edit_setting_cb(lv_event_t *e) { } data.value = lv_label_get_text(data.label); if (data.choices.size() > 0) { - choiceEditor::create_choice_editor(lv_scr_act(), data.value.c_str(), + choiceEditor::create(lv_scr_act(), data.value.c_str(), title.c_str(), data.choices, setting_edit_done_cb, (void *)(&data)); } else { @@ -553,10 +553,10 @@ void event_button_edit_setting_cb(lv_event_t *e) { // event_button_settings_back_handler void event_button_settings_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (settings_screen_delay_timer) return; settings_screen_delay_timer = lv_timer_create( - settings_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + settings_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { settings_screen_delay_timer_cb(NULL); } @@ -573,32 +573,32 @@ void settings_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_settings_back_handler, LV_EVENT_CLICKED, NULL); ui_settings_list_ctl = lv_list_create(ui_new_screen); lv_obj_clear_flag(ui_settings_list_ctl, LV_OBJ_FLAG_SCROLL_ELASTIC); - lv_obj_set_style_pad_left(ui_settings_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_left(ui_settings_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); - lv_obj_set_style_pad_right(ui_settings_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_right(ui_settings_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); lv_obj_set_size( - ui_settings_list_ctl, LV_HOR_RES - CURRENT_BUTTON_PRESSED_OUTLINE * 2, + ui_settings_list_ctl, LV_HOR_RES - ESP3D_BUTTON_PRESSED_OUTLINE * 2, LV_VER_RES - - ((3 * CURRENT_BUTTON_PRESSED_OUTLINE) + lv_obj_get_height(btnback))); + ((3 * ESP3D_BUTTON_PRESSED_OUTLINE) + lv_obj_get_height(btnback))); - lv_obj_set_pos(ui_settings_list_ctl, CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_set_pos(ui_settings_list_ctl, ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_t *line_container = NULL; std::string LabelStr = ""; // Language - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::ui_language); if (line_container) { std::string ui_language; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_ui_language); esp3d_log("Looking for index %d", @@ -616,19 +616,19 @@ void settings_screen() { ui_language = "English"; } language_label = - listLine::add_label_to_line(ui_language.c_str(), line_container, true); + listLine::add_label(ui_language.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } // Hostname - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::hostname); if (line_container) { std::string hostname; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_hostname); if (settingPtr) { @@ -637,9 +637,9 @@ void settings_screen() { out_str, settingPtr->size); } hostname_label = - listLine::add_label_to_line(hostname.c_str(), line_container, true); + listLine::add_label(hostname.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -647,23 +647,23 @@ void settings_screen() { // Extensions static ESP3DSettingIndex extensions_setting_index = ESP3DSettingIndex::esp3d_extensions; - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::extensions); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); - extensions_label = listLine::add_label_to_line("", line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); + extensions_label = listLine::add_label("", line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)&(extensions_setting_index)); } #if ESP3D_USB_SERIAL_FEATURE // USB Serial - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::output_client); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_output_client); if (settingPtr) { @@ -676,9 +676,9 @@ void settings_screen() { ? esp3dTranslationService.translate(ESP3DLabel::usb) : "???"; output_client_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -686,10 +686,10 @@ void settings_screen() { #endif // ESP3D_USB_SERIAL_FEATURE // Serial Baud rate - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::serial_baud_rate); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_baud_rate); if (settingPtr) { @@ -697,9 +697,9 @@ void settings_screen() { esp3dTftsettings.readUint32(ESP3DSettingIndex::esp3d_baud_rate); std::string value = std::to_string(val); serial_baud_rate_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -707,10 +707,10 @@ void settings_screen() { #if ESP3D_USB_SERIAL_FEATURE // USB serial Baud rate - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::usb_baud_rate); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr( ESP3DSettingIndex::esp3d_usb_serial_baud_rate); if (settingPtr) { @@ -718,9 +718,9 @@ void settings_screen() { ESP3DSettingIndex::esp3d_usb_serial_baud_rate); std::string value = std::to_string(val); usb_serial_baud_rate_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -728,10 +728,10 @@ void settings_screen() { #endif // ESP3D_USB_SERIAL_FEATURE // Jog type - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::jog_type); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_jog_type); if (settingPtr) { @@ -741,19 +741,19 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::relative) : esp3dTranslationService.translate(ESP3DLabel::absolute); jog_type_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } } // Polling on - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::polling); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_polling_on); if (settingPtr) { @@ -763,9 +763,9 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); polling_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } @@ -774,11 +774,11 @@ void settings_screen() { // JSON // workspace width - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::workspace_width); if (line_container) { std::string workspace_width_str; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_workspace_width); if (settingPtr) { @@ -788,20 +788,20 @@ void settings_screen() { } else { esp3d_log_e("Failed to get workspace width setting"); } - workspace_width_label = listLine::add_label_to_line(workspace_width_str.c_str(), + workspace_width_label = listLine::add_label(workspace_width_str.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } // workspace depth - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::workspace_depth); if (line_container) { std::string workspace_depth_str; - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_workspace_depth); if (settingPtr) { @@ -811,19 +811,19 @@ void settings_screen() { } else { esp3d_log_e("Failed to get workspace depth setting"); } - workspace_depth_label = listLine::add_label_to_line(workspace_depth_str.c_str(), + workspace_depth_label = listLine::add_label(workspace_depth_str.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } // Invert X axis - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::invert_axis, "X"); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_inverved_x); if (settingPtr) { @@ -833,19 +833,19 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); inverted_x_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } } // Invert Y axis - line_container = listLine::create_list_line_container(ui_settings_list_ctl); + line_container = listLine::create(ui_settings_list_ctl); LabelStr = esp3dTranslationService.translate(ESP3DLabel::invert_axis, "Y"); if (line_container) { - listLine::add_label_to_line(LabelStr.c_str(), line_container, true); + listLine::add_label(LabelStr.c_str(), line_container, true); const ESP3DSettingDescription *settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_inverved_y); if (settingPtr) { @@ -855,9 +855,9 @@ void settings_screen() { val == 0 ? esp3dTranslationService.translate(ESP3DLabel::disabled) : esp3dTranslationService.translate(ESP3DLabel::enabled); inverted_y_label = - listLine::add_label_to_line(value.c_str(), line_container, true); + listLine::add_label(value.c_str(), line_container, true); lv_obj_t *btnEdit = - listLine::add_button_to_line(LV_SYMBOL_EDIT, line_container); + listLine::add_button(LV_SYMBOL_EDIT, line_container); lv_obj_add_event_cb(btnEdit, event_button_edit_setting_cb, LV_EVENT_CLICKED, (void *)(&(settingPtr->index))); } diff --git a/main/display/components/back_button_component.cpp b/main/display/components/back_button_component.cpp index e2893bb8..97958948 100644 --- a/main/display/components/back_button_component.cpp +++ b/main/display/components/back_button_component.cpp @@ -25,16 +25,24 @@ /********************** - * STATIC PROTOTYPES + * Namespace **********************/ namespace backButton { -lv_obj_t *create_back_button(lv_obj_t *parent) { +/** + * @brief Creates a back button component. + * + * This function creates and initializes a back button component as a child of the specified parent object. + * + * @param parent The parent object to which the back button component will be added. + * @return The created back button component object. + */ +lv_obj_t *create(lv_obj_t *parent) { lv_obj_t *btn = symbolButton::create_symbol_button( - parent, LV_SYMBOL_NEW_LINE, BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); - lv_obj_align(btn, LV_ALIGN_BOTTOM_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - -CURRENT_BUTTON_PRESSED_OUTLINE); + parent, LV_SYMBOL_NEW_LINE, ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); + lv_obj_align(btn, LV_ALIGN_BOTTOM_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + -ESP3D_BUTTON_PRESSED_OUTLINE); return btn; } diff --git a/main/display/components/back_button_component.h b/main/display/components/back_button_component.h index eb9138fe..d97784a3 100644 --- a/main/display/components/back_button_component.h +++ b/main/display/components/back_button_component.h @@ -23,5 +23,5 @@ #include namespace backButton { -extern lv_obj_t *create_back_button(lv_obj_t *parent); +extern lv_obj_t *create(lv_obj_t *parent); } // namespace backButton diff --git a/main/display/components/choice_editor_component.cpp b/main/display/components/choice_editor_component.cpp index df72b9da..ad8dc1ee 100644 --- a/main/display/components/choice_editor_component.cpp +++ b/main/display/components/choice_editor_component.cpp @@ -27,16 +27,24 @@ #include "symbol_button_component.h" /********************** - * STATIC PROTOTYPES + * Namespace **********************/ namespace choiceEditor { +//Static variables std::string choiceValue; lv_obj_t *main_container = nullptr; lv_timer_t *choice_editor_delay_timer = NULL; uint32_t active_index = 0; void *user_data_ptr = NULL; +/** + * @brief Callback function for the choice editor delay timer. + * + * This function is called when the delay timer for the choice editor component expires. + * + * @param timer Pointer to the timer object that triggered the callback. + */ void choice_editor_delay_timer_cb(lv_timer_t *timer) { void (*callbackFn)(const char *str, void *user_data) = (void (*)(const char *, void *))timer->user_data; @@ -57,13 +65,18 @@ void choice_editor_delay_timer_cb(lv_timer_t *timer) { } } +/** + * Handles the event for the choice editor button. + * + * @param e The event object. + */ void event_button_choice_editor_handler(lv_event_t *e) { void *cbFn = lv_event_get_user_data(e); esp3d_log("Button Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (choice_editor_delay_timer) return; choice_editor_delay_timer = lv_timer_create(choice_editor_delay_timer_cb, - BUTTON_ANIMATION_DELAY, cbFn); + ESP3D_BUTTON_ANIMATION_DELAY, cbFn); } else { lv_timer_t timer; timer.user_data = cbFn; @@ -71,6 +84,14 @@ void event_button_choice_editor_handler(lv_event_t *e) { } } +/** + * Event handler for the choice editor radio button. + * + * This function is called when an event occurs on the choice editor radio button. + * It handles the event and performs the necessary actions based on the event type. + * + * @param e Pointer to the event object. + */ void choice_editor_radio_event_handler(lv_event_t *e) { uint32_t *active_id = (uint32_t *)lv_event_get_user_data(e); lv_obj_t *cont = lv_event_get_current_target(e); @@ -91,7 +112,7 @@ void choice_editor_radio_event_handler(lv_event_t *e) { choiceValue = lv_checkbox_get_text(act_cb); } -lv_obj_t *create_choice_editor(lv_obj_t *container, const char *text, +lv_obj_t *create(lv_obj_t *container, const char *text, const char *title, std::list &choices, void (*callbackFn)(const char *, void *), @@ -104,29 +125,30 @@ lv_obj_t *create_choice_editor(lv_obj_t *container, const char *text, lv_obj_t *editor_title = lv_label_create(main_container); lv_label_set_text(editor_title, title); lv_obj_align(editor_title, LV_ALIGN_TOP_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(editor_title); size_t y_top = lv_obj_get_y(editor_title) + lv_obj_get_height(editor_title); - lv_obj_t *btnback = backButton::create_back_button(main_container); + lv_obj_t *btnback = backButton::create(main_container); lv_obj_add_event_cb(btnback, event_button_choice_editor_handler, LV_EVENT_CLICKED, NULL); lv_obj_update_layout(btnback); size_t y_bottom = lv_obj_get_y(btnback); lv_obj_t *btnOk = symbolButton::create_symbol_button( - main_container, LV_SYMBOL_OK, BACK_BUTTON_WIDTH, BACK_BUTTON_HEIGHT); + main_container, LV_SYMBOL_OK, ESP3D_BACK_BUTTON_WIDTH, ESP3D_BACK_BUTTON_HEIGHT); lv_obj_align_to(btnOk, btnback, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); lv_obj_add_event_cb(btnOk, event_button_choice_editor_handler, LV_EVENT_CLICKED, (void *)callbackFn); lv_obj_t *choice_container = lv_obj_create(main_container); - size_t heigth = y_bottom - y_top - 2 * CURRENT_BUTTON_PRESSED_OUTLINE; + size_t heigth = y_bottom - y_top - 2 * ESP3D_BUTTON_PRESSED_OUTLINE; ESP3DStyle::apply(choice_container, ESP3DStyleType::list_container); lv_obj_align_to(choice_container, editor_title, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_set_scrollbar_mode(choice_container, LV_SCROLLBAR_MODE_AUTO); + uint32_t index = 0; size_t active_pos = 0; bool found = false; @@ -140,17 +162,17 @@ lv_obj_t *create_choice_editor(lv_obj_t *container, const char *text, lv_checkbox_set_text(obj, choice.c_str()); lv_obj_update_layout(obj); if (!found) - active_pos += lv_obj_get_height(obj) + CURRENT_BUTTON_PRESSED_OUTLINE; + active_pos += lv_obj_get_height(obj) + ESP3D_BUTTON_PRESSED_OUTLINE; lv_obj_add_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE); ESP3DStyle::apply(obj, ESP3DStyleType::radio_button); index++; } - lv_obj_set_size(choice_container, CURRENT_CHOICE_LIST_WIDTH, heigth); + lv_obj_set_size(choice_container, ESP3D_CHOICE_LIST_WIDTH, heigth); lv_obj_update_layout(choice_container); size_t width = lv_obj_get_width(choice_container); lv_obj_set_x(choice_container, LV_HOR_RES / 2 - width / 2); - if (heigth < active_pos + CURRENT_BUTTON_PRESSED_OUTLINE) + if (heigth < active_pos + ESP3D_BUTTON_PRESSED_OUTLINE) lv_obj_scroll_to_y(choice_container, active_pos, LV_ANIM_ON); // check first one by default lv_obj_add_state(lv_obj_get_child(choice_container, active_index), diff --git a/main/display/components/choice_editor_component.h b/main/display/components/choice_editor_component.h index de55a26c..9f61eee3 100644 --- a/main/display/components/choice_editor_component.h +++ b/main/display/components/choice_editor_component.h @@ -27,10 +27,10 @@ #include "lvgl.h" + namespace choiceEditor { -lv_obj_t *create_choice_editor(lv_obj_t *container, const char *text, - const char *title, - std::list &choices, - void (*callbackFn)(const char *, void *), - void *user_data = NULL); +lv_obj_t *create(lv_obj_t *container, const char *text, const char *title, + std::list &choices, + void (*callbackFn)(const char *, void *), + void *user_data = NULL); } // namespace choiceEditor diff --git a/main/display/components/list_line_component.cpp b/main/display/components/list_line_component.cpp index 5146e021..35977637 100644 --- a/main/display/components/list_line_component.cpp +++ b/main/display/components/list_line_component.cpp @@ -26,51 +26,68 @@ #include "symbol_button_component.h" // Note: This math works because of the bottom-only border. -// The top still gets a hidden border that acts like extra padding, pushing the content down. -// The 3*border_width calculation therefore accounts for the *padding* on the top and bottom, and then the bottom border itself. -#define LIST_LINE_CONTENT_HEIGHT (LIST_LINE_HEIGHT - (3*LIST_LINE_BORDER_WIDTH)) +// The top still gets a hidden border that acts like extra padding, pushing +// the content down. The 3*border_width calculation therefore accounts for the +// *padding* on the top and bottom, and then the bottom border itself. +#define LIST_LINE_CONTENT_HEIGHT \ + (ESP3D_LIST_LINE_HEIGHT - (3 * ESP3D_LIST_LINE_BORDER_SIZE)) /********************** - * STATIC PROTOTYPES + * Namespace **********************/ namespace listLine { -lv_obj_t *create_list_line_container(lv_obj_t *container) { +/** + * @brief Creates a list line component and adds it to the specified container. + * + * @param container The container object to which the list line component will + * be added. + * @return The created list line component object. + */ +lv_obj_t *create(lv_obj_t *container) { lv_obj_t *line_container = lv_obj_create(container); if (line_container) { lv_obj_update_layout(container); - lv_obj_set_size(line_container, - lv_obj_get_content_width(container), LIST_LINE_HEIGHT); + lv_obj_set_size(line_container, lv_obj_get_content_width(container), + ESP3D_LIST_LINE_HEIGHT); lv_obj_set_style_pad_all(line_container, 0, LV_PART_MAIN); - lv_obj_set_style_pad_left(line_container, - CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_right(line_container, - CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_set_style_pad_left(line_container, ESP3D_BUTTON_PRESSED_OUTLINE, + LV_PART_MAIN); + lv_obj_set_style_pad_right(line_container, ESP3D_BUTTON_PRESSED_OUTLINE, + LV_PART_MAIN); - lv_obj_set_style_border_width(line_container, - LIST_LINE_BORDER_WIDTH, LV_PART_MAIN); - lv_obj_set_style_border_side(line_container, - LV_BORDER_SIDE_BOTTOM, LV_PART_MAIN); + lv_obj_set_style_border_width(line_container, ESP3D_LIST_LINE_BORDER_SIZE, + LV_PART_MAIN); + lv_obj_set_style_border_side(line_container, LV_BORDER_SIDE_BOTTOM, + LV_PART_MAIN); lv_obj_set_flex_flow(line_container, LV_FLEX_FLOW_ROW); - lv_obj_clear_flag(line_container, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_style_pad_column(line_container, - CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); + lv_obj_clear_flag(line_container, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_pad_column(line_container, ESP3D_BUTTON_PRESSED_OUTLINE, + LV_PART_MAIN); } return line_container; } -lv_obj_t *add_label_to_line(const char *lbl, lv_obj_t *line_container, - bool grow) { +/** + * Adds a label to the line container. + * + * @param lbl The text to be displayed in the label. + * @param line_container The container object where the label will be added. + * @param grow A boolean value indicating whether the container should grow to + * fit the label. + * @return The created label object. + */ +lv_obj_t *add_label(const char *lbl, lv_obj_t *line_container, bool grow) { lv_obj_t *label_txt = lv_label_create(line_container); lv_label_set_text(label_txt, lbl); lv_obj_update_layout(label_txt); size_t label_height = lv_obj_get_height(label_txt); - size_t pad_v = (LIST_LINE_CONTENT_HEIGHT - label_height) / 2; + size_t pad_v = (LIST_LINE_CONTENT_HEIGHT - label_height) / 2; lv_obj_set_style_pad_top(label_txt, pad_v, LV_PART_MAIN); lv_obj_set_style_pad_bottom(label_txt, pad_v, LV_PART_MAIN); - + if (grow) { lv_obj_set_flex_grow(label_txt, 1); lv_label_set_long_mode(label_txt, LV_LABEL_LONG_SCROLL_CIRCULAR); @@ -78,9 +95,20 @@ lv_obj_t *add_label_to_line(const char *lbl, lv_obj_t *line_container, return label_txt; } -lv_obj_t *add_button_to_line(const char *lbl, lv_obj_t *line_container) { +/** + * @brief Adds a button to the line container. + * + * This function creates and adds a button to the specified line container. + * + * @param lbl The label text for the button. + * @param line_container The line container to which the button will be added. + * + * @return The created button object. + */ +lv_obj_t *add_button(const char *lbl, lv_obj_t *line_container) { lv_obj_t *button_list = symbolButton::create_symbol_button( - line_container, lbl, LIST_LINE_BUTTON_WIDTH, LIST_LINE_CONTENT_HEIGHT); + line_container, lbl, ESP3D_LIST_LINE_BUTTON_WIDTH, + LIST_LINE_CONTENT_HEIGHT); return button_list; } } // namespace listLine \ No newline at end of file diff --git a/main/display/components/list_line_component.h b/main/display/components/list_line_component.h index 79c51e78..8fe1e208 100644 --- a/main/display/components/list_line_component.h +++ b/main/display/components/list_line_component.h @@ -23,8 +23,8 @@ #include namespace listLine { -extern lv_obj_t *create_list_line_container(lv_obj_t *container); -extern lv_obj_t *add_label_to_line(const char *lbl, lv_obj_t *line_container, +extern lv_obj_t *create(lv_obj_t *container); +extern lv_obj_t *add_label(const char *lbl, lv_obj_t *line_container, bool grow); -extern lv_obj_t *add_button_to_line(const char *lbl, lv_obj_t *line_container); +extern lv_obj_t *add_button(const char *lbl, lv_obj_t *line_container); } // namespace listLine diff --git a/main/display/components/main_container_component.cpp b/main/display/components/main_container_component.cpp index 45585b30..07df5294 100644 --- a/main/display/components/main_container_component.cpp +++ b/main/display/components/main_container_component.cpp @@ -35,8 +35,8 @@ lv_obj_t *create_main_container(lv_obj_t *parent, lv_obj_t *button_back, lv_obj_update_layout(button_back); lv_obj_set_size(ui_container, LV_HOR_RES, LV_VER_RES - lv_obj_get_height(button_back) - - (1 * CURRENT_BUTTON_PRESSED_OUTLINE)); - lv_obj_set_style_pad_top(ui_container, CURRENT_BUTTON_PRESSED_OUTLINE * 1, + (1 * ESP3D_BUTTON_PRESSED_OUTLINE)); + lv_obj_set_style_pad_top(ui_container, ESP3D_BUTTON_PRESSED_OUTLINE * 1, LV_PART_MAIN); return ui_container; } diff --git a/main/display/components/menu_button_component.cpp b/main/display/components/menu_button_component.cpp index e7fc6cb9..c5456833 100644 --- a/main/display/components/menu_button_component.cpp +++ b/main/display/components/menu_button_component.cpp @@ -29,7 +29,7 @@ **********************/ namespace menuButton { lv_obj_t *create_menu_button(lv_obj_t *container, const char *text) { - return symbolButton::create_symbol_button(container, text, BUTTON_WIDTH, - BUTTON_HEIGHT); + return symbolButton::create_symbol_button(container, text, ESP3D_BUTTON_WIDTH, + ESP3D_BUTTON_HEIGHT); } } // namespace menuButton diff --git a/main/display/components/spinner_component.cpp b/main/display/components/spinner_component.cpp index 37f9b325..95f368f6 100644 --- a/main/display/components/spinner_component.cpp +++ b/main/display/components/spinner_component.cpp @@ -63,7 +63,7 @@ void show_spinner(const char* msg, lv_obj_t* backtbn) { lv_obj_set_size(spinnerObj, LV_HOR_RES, LV_VER_RES); lv_obj_set_pos(spinnerObj, 0, 0); lv_obj_t* spinner = lv_spinner_create(spinnerObj, 1000, 60); - lv_obj_set_size(spinner, CURRENT_SPINNER_SIZE, CURRENT_SPINNER_SIZE); + lv_obj_set_size(spinner, ESP3D_SPINNER_SIZE, ESP3D_SPINNER_SIZE); lv_obj_center(spinner); std::string text = esp3dTranslationService.translate(ESP3DLabel::please_wait); @@ -71,14 +71,14 @@ void show_spinner(const char* msg, lv_obj_t* backtbn) { ESP3DStyle::apply(lbl, ESP3DStyleType::spinner_text); lv_label_set_text(lbl, text.c_str()); lv_obj_align_to(lbl, spinner, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lblextra = NULL; if (msg != nullptr) { lblextra = lv_label_create(spinnerObj); ESP3DStyle::apply(lblextra, ESP3DStyleType::spinner_text); lv_label_set_text(lblextra, msg); lv_obj_align_to(lblextra, lbl, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); } if (backtbn != nullptr) { lv_obj_move_foreground(backtbn); diff --git a/main/display/components/symbol_button_component.h b/main/display/components/symbol_button_component.h index da54ebf0..b23b26e2 100644 --- a/main/display/components/symbol_button_component.h +++ b/main/display/components/symbol_button_component.h @@ -26,8 +26,8 @@ namespace symbolButton { extern lv_obj_t *create_symbol_button(lv_obj_t *container, const char *text, - int width = SYMBOL_BUTTON_WIDTH, - int height = SYMBOL_BUTTON_HEIGHT, + int width = ESP3D_SYMBOL_BUTTON_WIDTH, + int height = ESP3D_SYMBOL_BUTTON_HEIGHT, bool center = true, bool slash = false, int rotation = 0); } // namespace symbolButton diff --git a/main/display/components/wifi_status_component.cpp b/main/display/components/wifi_status_component.cpp index 7b34ce5d..c2ba5863 100644 --- a/main/display/components/wifi_status_component.cpp +++ b/main/display/components/wifi_status_component.cpp @@ -83,14 +83,14 @@ lv_obj_t *wifi_status(lv_obj_t *parent, lv_obj_t *btnback) { lv_obj_clear_flag(status_container, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_size(status_container, LV_HOR_RES - (lv_obj_get_width(btnback) + - (2 * CURRENT_BUTTON_PRESSED_OUTLINE)), + (2 * ESP3D_BUTTON_PRESSED_OUTLINE)), LV_SIZE_CONTENT); lv_obj_set_style_pad_all(status_container, 0, LV_PART_MAIN); lv_obj_set_style_layout(status_container, LV_LAYOUT_FLEX, LV_PART_MAIN); lv_obj_set_style_flex_flow(status_container, LV_FLEX_FLOW_ROW_REVERSE, LV_PART_MAIN); lv_obj_set_style_pad_column(status_container, - CURRENT_BUTTON_PRESSED_OUTLINE / 2, LV_PART_MAIN); + ESP3D_BUTTON_PRESSED_OUTLINE / 2, LV_PART_MAIN); lv_obj_set_style_flex_main_place(status_container, LV_FLEX_ALIGN_END, LV_PART_MAIN); @@ -105,7 +105,7 @@ lv_obj_t *wifi_status(lv_obj_t *parent, lv_obj_t *btnback) { lv_label_set_text(wifi_mode_label, "?"); lv_obj_update_layout(status_container); lv_obj_align_to(status_container, btnback, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); slash_overlay = lv_label_create(wifi_mode_label); lv_label_set_text(slash_overlay, LV_SYMBOL_SLASH); lv_obj_center(slash_overlay); diff --git a/main/display/screens/ap_screen.cpp b/main/display/screens/ap_screen.cpp index ee3af655..0999f07e 100644 --- a/main/display/screens/ap_screen.cpp +++ b/main/display/screens/ap_screen.cpp @@ -158,7 +158,7 @@ void ap_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_ap_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); ap_screen_delay_timer = - lv_timer_create(ap_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + lv_timer_create(ap_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } void ap_ta_event_cb(lv_event_t *e) { @@ -257,7 +257,7 @@ void ap_screen() { lv_scr_load(ui_new_screen); ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_ap_back_handler, LV_EVENT_CLICKED, NULL); @@ -272,11 +272,11 @@ void ap_screen() { lv_textarea_set_one_line(ap_ta_ssid, true); lv_textarea_set_max_length(ap_ta_ssid, 32); lv_obj_align(ap_ta_ssid, LV_ALIGN_TOP_LEFT, - width_label + (CURRENT_BUTTON_PRESSED_OUTLINE * 3), - CURRENT_BUTTON_PRESSED_OUTLINE); + width_label + (ESP3D_BUTTON_PRESSED_OUTLINE * 3), + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_set_width(ap_ta_ssid, (LV_HOR_RES / 2)); lv_obj_align_to(label_ssid, ap_ta_ssid, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); std::string tmp_str; char out_str[255] = {0}; const ESP3DSettingDescription *settingPtr = @@ -303,10 +303,10 @@ void ap_screen() { lv_obj_set_width(ap_ta_password, (LV_HOR_RES / 2)); lv_obj_align_to(ap_ta_password, ap_ta_ssid, LV_ALIGN_OUT_BOTTOM_LEFT, 0, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_align_to( label_pwd, ap_ta_password, LV_ALIGN_OUT_LEFT_MID, - -(CURRENT_BUTTON_PRESSED_OUTLINE + lv_obj_get_width(label_pwd) / 2), 0); + -(ESP3D_BUTTON_PRESSED_OUTLINE + lv_obj_get_width(label_pwd) / 2), 0); settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_ap_password); @@ -326,27 +326,27 @@ void ap_screen() { lv_obj_t *kb = lv_keyboard_create(ui_new_screen); lv_keyboard_set_textarea(kb, NULL); lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN); - lv_obj_set_style_radius(kb, CURRENT_BUTTON_RADIUS_VALUE, LV_PART_MAIN); + lv_obj_set_style_radius(kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_event_cb(ap_ta_ssid, ap_ta_event_cb, LV_EVENT_ALL, kb); lv_obj_add_event_cb(ap_ta_password, ap_ta_event_cb, LV_EVENT_ALL, kb); // Create button and label for ok btn_ok = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_OK, SYMBOL_BUTTON_WIDTH, SYMBOL_BUTTON_WIDTH); + ui_new_screen, LV_SYMBOL_OK, ESP3D_SYMBOL_BUTTON_WIDTH, ESP3D_SYMBOL_BUTTON_WIDTH); lv_obj_add_event_cb(btn_ok, ap_event_button_ok_handler, LV_EVENT_CLICKED, NULL); - lv_obj_align(btn_ok, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_align(btn_ok, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); // Create button and label for ok btn_save = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_SAVE, SYMBOL_BUTTON_WIDTH, SYMBOL_BUTTON_WIDTH); + ui_new_screen, LV_SYMBOL_SAVE, ESP3D_SYMBOL_BUTTON_WIDTH, ESP3D_SYMBOL_BUTTON_WIDTH); lv_obj_add_event_cb(btn_save, ap_event_button_save_handler, LV_EVENT_CLICKED, NULL); lv_obj_align_to(btn_save, btn_ok, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); update_button_ok(); update_button_save(); esp3dTftui.set_current_screen(ESP3DScreenType::access_point); diff --git a/main/display/screens/files_screen.cpp b/main/display/screens/files_screen.cpp index ca6b0bb9..a57530c6 100644 --- a/main/display/screens/files_screen.cpp +++ b/main/display/screens/files_screen.cpp @@ -213,10 +213,10 @@ void files_screen_delay_timer_cb(lv_timer_t *timer) { void event_button_files_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (files_screen_delay_timer) return; files_screen_delay_timer = lv_timer_create(files_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { files_screen_delay_timer_cb(NULL); } @@ -273,17 +273,17 @@ void files_screen() { lv_obj_del(ui_current_screen); // button back - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_files_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_update_layout(btnback); // button refresh refresh_button = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_REFRESH, SYMBOL_BUTTON_WIDTH, + ui_new_screen, LV_SYMBOL_REFRESH, ESP3D_SYMBOL_BUTTON_WIDTH, lv_obj_get_height(btnback)); lv_obj_align(refresh_button, LV_ALIGN_BOTTOM_MID, 0, - -CURRENT_BUTTON_PRESSED_OUTLINE); + -ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_add_event_cb(refresh_button, event_button_files_refresh_handler, LV_EVENT_CLICKED, NULL); // label path @@ -291,11 +291,11 @@ void files_screen() { lv_label_set_text(labelpath, files_path.c_str()); lv_label_set_long_mode(labelpath, LV_LABEL_LONG_SCROLL_CIRCULAR); ESP3DStyle::apply(labelpath, ESP3DStyleType::bg_label); - lv_obj_set_pos(labelpath, CURRENT_STATUS_BAR_V_PAD, CURRENT_STATUS_BAR_V_PAD); - lv_obj_set_width(labelpath, LV_HOR_RES - (2 * CURRENT_STATUS_BAR_V_PAD)); - lv_obj_set_style_pad_left(labelpath, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_pos(labelpath, ESP3D_STATUS_BAR_V_PAD, ESP3D_STATUS_BAR_V_PAD); + lv_obj_set_width(labelpath, LV_HOR_RES - (2 * ESP3D_STATUS_BAR_V_PAD)); + lv_obj_set_style_pad_left(labelpath, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); - lv_obj_set_style_pad_right(labelpath, CURRENT_BUTTON_PRESSED_OUTLINE, + lv_obj_set_style_pad_right(labelpath, ESP3D_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_label_set_long_mode(labelpath, LV_LABEL_LONG_SCROLL_CIRCULAR); lv_obj_update_layout(labelpath); @@ -304,21 +304,21 @@ void files_screen() { ui_files_list_ctl = lv_list_create(ui_new_screen); lv_obj_clear_flag(ui_files_list_ctl, LV_OBJ_FLAG_SCROLL_ELASTIC); lv_obj_set_pos(ui_files_list_ctl, 0, - lv_obj_get_height(labelpath) + (2 * CURRENT_STATUS_BAR_V_PAD)); + lv_obj_get_height(labelpath) + (2 * ESP3D_STATUS_BAR_V_PAD)); lv_obj_set_size( ui_files_list_ctl, LV_HOR_RES, LV_VER_RES - - ((1.5 * CURRENT_BUTTON_PRESSED_OUTLINE) + lv_obj_get_height(btnback) + - lv_obj_get_height(labelpath) + (2 * CURRENT_STATUS_BAR_V_PAD))); - lv_obj_set_style_pad_left(ui_files_list_ctl, LIST_CONTAINER_LR_PAD, + ((1.5 * ESP3D_BUTTON_PRESSED_OUTLINE) + lv_obj_get_height(btnback) + + lv_obj_get_height(labelpath) + (2 * ESP3D_STATUS_BAR_V_PAD))); + lv_obj_set_style_pad_left(ui_files_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); - lv_obj_set_style_pad_right(ui_files_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_right(ui_files_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); if (files_path != "/") { std::string tmplabel = ".." LV_SYMBOL_NEW_LINE; - lv_obj_t *line1 = listLine::create_list_line_container(ui_files_list_ctl); - lv_obj_t *btn_prev = listLine::add_button_to_line(tmplabel.c_str(), line1); + lv_obj_t *line1 = listLine::create(ui_files_list_ctl); + lv_obj_t *btn_prev = listLine::add_button(tmplabel.c_str(), line1); lv_obj_add_event_cb(btn_prev, event_button_files_up_handler, LV_EVENT_CLICKED, NULL); } @@ -334,11 +334,11 @@ void files_screen() { for (auto &file : files_list) { if (file.size == "-1") { lv_obj_t *line_container = - listLine::create_list_line_container(ui_files_list_ctl); - listLine::add_label_to_line(LV_SYMBOL_FOLDER, line_container, false); - listLine::add_label_to_line(file.name.c_str(), line_container, true); + listLine::create(ui_files_list_ctl); + listLine::add_label(LV_SYMBOL_FOLDER, line_container, false); + listLine::add_label(file.name.c_str(), line_container, true); lv_obj_t *btn = - listLine::add_button_to_line(LV_SYMBOL_SEARCH, line_container); + listLine::add_button(LV_SYMBOL_SEARCH, line_container); lv_obj_add_event_cb(btn, event_directory_handler, LV_EVENT_CLICKED, &file); } @@ -347,12 +347,12 @@ void files_screen() { for (auto &file : files_list) { if (file.size != "-1") { lv_obj_t *line_container = - listLine::create_list_line_container(ui_files_list_ctl); - listLine::add_label_to_line(LV_SYMBOL_FILE, line_container, false); - listLine::add_label_to_line(file.name.c_str(), line_container, true); - listLine::add_label_to_line(file.size.c_str(), line_container, false); + listLine::create(ui_files_list_ctl); + listLine::add_label(LV_SYMBOL_FILE, line_container, false); + listLine::add_label(file.name.c_str(), line_container, true); + listLine::add_label(file.size.c_str(), line_container, false); lv_obj_t *btn = - listLine::add_button_to_line(LV_SYMBOL_PLAY, line_container); + listLine::add_button(LV_SYMBOL_PLAY, line_container); lv_obj_add_event_cb(btn, event_file_handler, LV_EVENT_CLICKED, &file); } } diff --git a/main/display/screens/splash_screen.cpp b/main/display/screens/splash_screen.cpp index 000ff78e..69183f16 100644 --- a/main/display/screens/splash_screen.cpp +++ b/main/display/screens/splash_screen.cpp @@ -83,6 +83,10 @@ void main_screen_timer_cb(lv_timer_t *timer) { void enter() { ESP3DStyle::apply(lv_scr_act(), ESP3DStyleType::main_bg); boot_timer = lv_timer_create(splash_in_timer_cb, 10, NULL); + if (boot_timer == NULL) { + esp3d_log_e("Failed to create timer"); + return; + } } // Display function to show splash screen @@ -95,6 +99,10 @@ void display() { if (splash_logo != NULL) { // Create logo object lv_obj_t *logo = lv_img_create(ui_Screen); + if (!lv_obj_is_valid(logo)) { + esp3d_log_e("Invalid logo object"); + return; + } // Set logo image lv_img_set_src(logo, splash_logo); // align object in screen @@ -103,11 +111,19 @@ void display() { // Set target Logo lv_obj_t *logo_target = lv_img_create(ui_Screen); + if(!lv_obj_is_valid(logo_target)) { + esp3d_log_e("Invalid target logo object"); + return; + } lv_img_set_src(logo_target, &target_fw_logo); lv_obj_align(logo_target, LV_ALIGN_BOTTOM_LEFT, FW_LOGO_X, FW_LOGO_Y); // Create version text object lv_obj_t *label = lv_label_create(ui_Screen); + if (!lv_obj_is_valid(label)) { + esp3d_log_e("Invalid label object"); + return; + } // Set version text lv_label_set_text(label, "V" ESP3D_TFT_VERSION); ESP3DStyle::apply(label, ESP3DStyleType::bg_label); @@ -115,6 +131,10 @@ void display() { // Set timer to switch to main screen boot_timer = lv_timer_create(main_screen_timer_cb, 2000, NULL); + if (boot_timer == NULL) { + esp3d_log_e("Failed to create timer"); + return; + } esp3dTftui.set_current_screen(ESP3DScreenType::splash); } diff --git a/main/display/screens/sta_screen.cpp b/main/display/screens/sta_screen.cpp index 468d5f44..1c56998c 100644 --- a/main/display/screens/sta_screen.cpp +++ b/main/display/screens/sta_screen.cpp @@ -173,15 +173,15 @@ void event_bg_touched_cb(lv_event_t *e) { void fill_ui_sta_ssid_list() { for (auto &ssid_desc : ssid_scanned_list) { lv_obj_t *line_container = - listLine::create_list_line_container(ui_sta_ssid_list_ctl); - listLine::add_label_to_line(ssid_desc.ssid.c_str(), line_container, true); + listLine::create(ui_sta_ssid_list_ctl); + listLine::add_label(ssid_desc.ssid.c_str(), line_container, true); - listLine::add_label_to_line(ssid_desc.signal_strength.c_str(), + listLine::add_label(ssid_desc.signal_strength.c_str(), line_container, false); - listLine::add_label_to_line(ssid_desc.isprotected.c_str(), line_container, + listLine::add_label(ssid_desc.isprotected.c_str(), line_container, false); lv_obj_t *btnJoin = - listLine::add_button_to_line(LV_SYMBOL_OK, line_container); + listLine::add_button(LV_SYMBOL_OK, line_container); lv_obj_add_event_cb(btnJoin, event_button_join_cb, LV_EVENT_CLICKED, (void *)&ssid_desc); } @@ -341,7 +341,7 @@ void event_button_sta_back_handler(lv_event_t *e) { sta_screen_delay_timer = NULL; } sta_screen_delay_timer = - lv_timer_create(sta_screen_delay_timer_cb, BUTTON_ANIMATION_DELAY, NULL); + lv_timer_create(sta_screen_delay_timer_cb, ESP3D_BUTTON_ANIMATION_DELAY, NULL); } void sta_ta_event_cb(lv_event_t *e) { @@ -461,7 +461,7 @@ void sta_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); + lv_obj_t *btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_sta_back_handler, LV_EVENT_CLICKED, NULL); lv_obj_add_event_cb(ui_new_screen, event_bg_touched_cb, LV_EVENT_CLICKED, @@ -477,11 +477,11 @@ void sta_screen() { lv_textarea_set_one_line(sta_ta_ssid, true); lv_textarea_set_max_length(sta_ta_ssid, 32); lv_obj_align(sta_ta_ssid, LV_ALIGN_TOP_LEFT, - width_label + (CURRENT_BUTTON_PRESSED_OUTLINE * 3), - CURRENT_BUTTON_PRESSED_OUTLINE); + width_label + (ESP3D_BUTTON_PRESSED_OUTLINE * 3), + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_set_width(sta_ta_ssid, (LV_HOR_RES / 2)); lv_obj_align_to(label_ssid, sta_ta_ssid, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); std::string tmp_str; char out_str[255] = {0}; const ESP3DSettingDescription *settingPtr = @@ -508,10 +508,10 @@ void sta_screen() { lv_obj_set_width(sta_ta_password, (LV_HOR_RES / 2)); lv_obj_align_to(sta_ta_password, sta_ta_ssid, LV_ALIGN_OUT_BOTTOM_LEFT, 0, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_align_to( label_pwd, sta_ta_password, LV_ALIGN_OUT_LEFT_MID, - -(CURRENT_BUTTON_PRESSED_OUTLINE + lv_obj_get_width(label_pwd) / 2), 0); + -(ESP3D_BUTTON_PRESSED_OUTLINE + lv_obj_get_width(label_pwd) / 2), 0); settingPtr = esp3dTftsettings.getSettingPtr(ESP3DSettingIndex::esp3d_sta_password); @@ -531,36 +531,36 @@ void sta_screen() { lv_obj_t *kb = lv_keyboard_create(ui_new_screen); lv_keyboard_set_textarea(kb, NULL); lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN); - lv_obj_set_style_radius(kb, CURRENT_BUTTON_RADIUS_VALUE, LV_PART_MAIN); + lv_obj_set_style_radius(kb, ESP3D_BUTTON_RADIUS , LV_PART_MAIN); lv_obj_add_event_cb(sta_ta_ssid, sta_ta_event_cb, LV_EVENT_ALL, kb); lv_obj_add_event_cb(sta_ta_password, sta_ta_event_cb, LV_EVENT_ALL, kb); // Create button and label for ok btn_ok = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_OK, SYMBOL_BUTTON_WIDTH, SYMBOL_BUTTON_WIDTH); + ui_new_screen, LV_SYMBOL_OK, ESP3D_SYMBOL_BUTTON_WIDTH, ESP3D_SYMBOL_BUTTON_WIDTH); lv_obj_add_event_cb(btn_ok, sta_event_button_ok_handler, LV_EVENT_CLICKED, NULL); - lv_obj_align(btn_ok, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, - CURRENT_BUTTON_PRESSED_OUTLINE); + lv_obj_align(btn_ok, LV_ALIGN_TOP_RIGHT, -ESP3D_BUTTON_PRESSED_OUTLINE, + ESP3D_BUTTON_PRESSED_OUTLINE); // Create button and label for ok btn_save = symbolButton::create_symbol_button( - ui_new_screen, LV_SYMBOL_SAVE, SYMBOL_BUTTON_WIDTH, SYMBOL_BUTTON_WIDTH); + ui_new_screen, LV_SYMBOL_SAVE, ESP3D_SYMBOL_BUTTON_WIDTH, ESP3D_SYMBOL_BUTTON_WIDTH); lv_obj_add_event_cb(btn_save, sta_event_button_save_handler, LV_EVENT_CLICKED, NULL); lv_obj_align_to(btn_save, btn_ok, LV_ALIGN_OUT_LEFT_MID, - -CURRENT_BUTTON_PRESSED_OUTLINE, 0); + -ESP3D_BUTTON_PRESSED_OUTLINE, 0); btn_scan = symbolButton::create_symbol_button(ui_new_screen, LV_SYMBOL_SEARCH, - SYMBOL_BUTTON_WIDTH, - SYMBOL_BUTTON_WIDTH); + ESP3D_SYMBOL_BUTTON_WIDTH, + ESP3D_SYMBOL_BUTTON_WIDTH); lv_obj_add_event_cb(btn_scan, sta_event_button_scan_handler, LV_EVENT_CLICKED, NULL); lv_obj_align_to(btn_scan, btn_ok, LV_ALIGN_OUT_BOTTOM_MID, 0, - CURRENT_BUTTON_PRESSED_OUTLINE); + ESP3D_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(btn_scan); // SSID list ui_sta_ssid_list_ctl = lv_list_create(ui_new_screen); @@ -568,12 +568,12 @@ void sta_screen() { // lv_obj_update_layout(sta_ta_ssid); lv_obj_update_layout(label_ssid); lv_obj_align_to(ui_sta_ssid_list_ctl, label_ssid, LV_ALIGN_OUT_BOTTOM_LEFT, - -(CURRENT_BUTTON_PRESSED_OUTLINE), - (CURRENT_BUTTON_PRESSED_OUTLINE)); + -(ESP3D_BUTTON_PRESSED_OUTLINE), + (ESP3D_BUTTON_PRESSED_OUTLINE)); lv_obj_set_width(ui_sta_ssid_list_ctl, LV_HOR_RES - (lv_obj_get_width(btn_scan) + - (3 * CURRENT_BUTTON_PRESSED_OUTLINE))); + (3 * ESP3D_BUTTON_PRESSED_OUTLINE))); lv_obj_update_layout(ui_sta_ssid_list_ctl); lv_obj_set_height( @@ -585,9 +585,9 @@ void sta_screen() { if (ui_sta_ssid_list_ctl) lv_obj_add_flag(ui_sta_ssid_list_ctl, LV_OBJ_FLAG_HIDDEN); if (status_component) lv_obj_clear_flag(status_component, LV_OBJ_FLAG_HIDDEN); - lv_obj_set_style_pad_left(ui_sta_ssid_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_left(ui_sta_ssid_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); - lv_obj_set_style_pad_right(ui_sta_ssid_list_ctl, LIST_CONTAINER_LR_PAD, + lv_obj_set_style_pad_right(ui_sta_ssid_list_ctl, ESP3D_LIST_CONTAINER_LR_PAD, LV_PART_MAIN); update_button_ok(); diff --git a/main/display/screens/status_screen.cpp b/main/display/screens/status_screen.cpp index 015d135d..129e7178 100644 --- a/main/display/screens/status_screen.cpp +++ b/main/display/screens/status_screen.cpp @@ -109,6 +109,10 @@ void status_screen() { } lv_obj_t *btn_back = lv_btn_create(ui_status_screen_container); + if (!lv_obj_is_valid(btn_back)) { + esp3d_log_e("btn_back is not valid"); + return; + } ESP3DStyle::apply(btn_back, ESP3DStyleType::embedded_button); lv_obj_set_width(btn_back, LV_HOR_RES); lv_obj_t *label_btn_back = lv_label_create(btn_back); diff --git a/main/display/screens/wifi_screen.cpp b/main/display/screens/wifi_screen.cpp index c6c003eb..33488a30 100644 --- a/main/display/screens/wifi_screen.cpp +++ b/main/display/screens/wifi_screen.cpp @@ -148,10 +148,10 @@ void event_button_wifi_back_handler(lv_event_t *e) { esp3d_log("back Clicked"); if (wifi_screen_delay_timer) return; wifi_next_screen = ESP3DScreenType::menu; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (wifi_screen_delay_timer) return; wifi_screen_delay_timer = lv_timer_create(wifi_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { wifi_screen_delay_timer_cb(NULL); } @@ -161,10 +161,10 @@ void event_button_ap_handler(lv_event_t *e) { esp3d_log("AP Clicked"); if (wifi_screen_delay_timer) return; wifi_next_screen = ESP3DScreenType::access_point; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (wifi_screen_delay_timer) return; wifi_screen_delay_timer = lv_timer_create(wifi_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { wifi_screen_delay_timer_cb(NULL); } @@ -174,10 +174,10 @@ void event_button_sta_handler(lv_event_t *e) { esp3d_log("STA Clicked"); if (wifi_screen_delay_timer) return; wifi_next_screen = ESP3DScreenType::station; - if (BUTTON_ANIMATION_DELAY) { + if (ESP3D_BUTTON_ANIMATION_DELAY) { if (wifi_screen_delay_timer) return; wifi_screen_delay_timer = lv_timer_create(wifi_screen_delay_timer_cb, - BUTTON_ANIMATION_DELAY, NULL); + ESP3D_BUTTON_ANIMATION_DELAY, NULL); } else { wifi_screen_delay_timer_cb(NULL); } @@ -208,7 +208,7 @@ void wifi_screen() { ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); - btnback = backButton::create_back_button(ui_new_screen); + btnback = backButton::create(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_wifi_back_handler, LV_EVENT_CLICKED, NULL); wifiStatus::wifi_status(ui_new_screen, btnback); @@ -225,18 +225,18 @@ void wifi_screen() { // Create button and label for ap btn = symbolButton::create_symbol_button( - ui_buttons_container, LV_SYMBOL_ACCESS_POINT, BUTTON_WIDTH, BUTTON_WIDTH); + ui_buttons_container, LV_SYMBOL_ACCESS_POINT, ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_WIDTH); lv_obj_add_event_cb(btn, event_button_ap_handler, LV_EVENT_CLICKED, NULL); // Create button and label for sta btn = symbolButton::create_symbol_button( - ui_buttons_container, LV_SYMBOL_STATION_MODE, BUTTON_WIDTH, BUTTON_WIDTH); + ui_buttons_container, LV_SYMBOL_STATION_MODE, ESP3D_BUTTON_WIDTH, ESP3D_BUTTON_WIDTH); lv_obj_add_event_cb(btn, event_button_sta_handler, LV_EVENT_CLICKED, NULL); // Create button and label for no wifi btn_no_wifi = symbolButton::create_symbol_button(ui_buttons_container, - LV_SYMBOL_WIFI, BUTTON_WIDTH, - BUTTON_WIDTH, true, true); + LV_SYMBOL_WIFI, ESP3D_BUTTON_WIDTH, + ESP3D_BUTTON_WIDTH, true, true); lv_obj_add_event_cb(btn_no_wifi, event_button_no_wifi_handler, LV_EVENT_CLICKED, NULL);