From b8c32e24d86fff280621ab3f274511dd30669b93 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 2 Oct 2021 02:33:14 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Rename=20MarlinUI::zoffset=5Fove?= =?UTF-8?q?rlay?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 10 +++++++--- Marlin/src/lcd/dogm/marlinui_DOGM.cpp | 10 +--------- Marlin/src/lcd/e3v2/marlinui/ui_common.cpp | 14 +++----------- Marlin/src/lcd/marlinui.cpp | 14 ++++++++++++++ Marlin/src/lcd/marlinui.h | 5 +++++ Marlin/src/lcd/menu/menu.cpp | 5 +---- Marlin/src/lcd/menu/menu.h | 4 ---- Marlin/src/lcd/menu/menu_ubl.cpp | 2 +- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index f5324c7d39..ed5a345744 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -900,7 +900,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "MESH_BED_LEVELING and BABYSTEP_ZPROBE_OFFSET is not a valid combination" #elif ENABLED(BABYSTEP_ZPROBE_OFFSET) && !HAS_BED_PROBE #error "BABYSTEP_ZPROBE_OFFSET requires a probe." - #elif ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) && !HAS_MARLINUI_U8GLIB + #elif ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) && NONE(HAS_MARLINUI_U8GLIB, IS_DWIN_MARLINUI) #error "BABYSTEP_ZPROBE_GFX_OVERLAY requires a Graphical LCD." #elif ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) && DISABLED(BABYSTEP_ZPROBE_OFFSET) #error "BABYSTEP_ZPROBE_GFX_OVERLAY requires a BABYSTEP_ZPROBE_OFFSET." @@ -1762,8 +1762,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #endif #endif -#if ENABLED(MESH_EDIT_GFX_OVERLAY) && !(ENABLED(AUTO_BED_LEVELING_UBL) && EITHER(HAS_MARLINUI_U8GLIB, IS_DWIN_MARLINUI)) - #error "MESH_EDIT_GFX_OVERLAY requires AUTO_BED_LEVELING_UBL and a Graphical LCD." +#if ENABLED(MESH_EDIT_GFX_OVERLAY) + #if DISABLED(AUTO_BED_LEVELING_UBL) + #error "MESH_EDIT_GFX_OVERLAY requires AUTO_BED_LEVELING_UBL." + #elif NONE(HAS_MARLINUI_U8GLIB, IS_DWIN_MARLINUI) + #error "MESH_EDIT_GFX_OVERLAY requires a Graphical LCD." + #endif #endif #if ENABLED(G29_RETRY_AND_RECOVER) && NONE(AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR) diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp index f1c5eebbb5..4a7e26ae83 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.cpp +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.cpp @@ -715,15 +715,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop B00001100,B00000000 }; - void _lcd_zoffset_overlay_gfx(const_float_t zvalue) { - // Determine whether the user is raising or lowering the nozzle. - static int8_t dir; - static float old_zvalue; - if (zvalue != old_zvalue) { - dir = zvalue ? zvalue < old_zvalue ? -1 : 1 : 0; - old_zvalue = zvalue; - } - + void MarlinUI::zoffset_overlay(const int8_t dir) { const unsigned char *rot_up = TERN(OVERLAY_GFX_REVERSE, ccw_bmp, cw_bmp), *rot_down = TERN(OVERLAY_GFX_REVERSE, cw_bmp, ccw_bmp); diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index 09458401be..9ad258b3ac 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -562,19 +562,11 @@ void MarlinUI::draw_status_message(const bool blink) { #endif // AUTO_BED_LEVELING_UBL - #if ANY(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY, BABYSTEP_GFX_OVERLAY) - - void _lcd_zoffset_overlay_gfx(const float zvalue) { - // Determine whether the user is raising or lowering the nozzle. - static int8_t dir; - static float old_zvalue; - if (zvalue != old_zvalue) { - dir = zvalue ? zvalue < old_zvalue ? -1 : 1 : 0; - old_zvalue = zvalue; - } + #if ANY(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) + void MarlinUI::zoffset_overlay(const int8_t dir) { const int rot_up = TERN(OVERLAY_GFX_REVERSE, ICON_RotateCCW, ICON_RotateCW), - rot_down = TERN(OVERLAY_GFX_REVERSE, ICON_RotateCW, ICON_RotateCCW); + rot_down = TERN(OVERLAY_GFX_REVERSE, ICON_RotateCW, ICON_RotateCCW); const int nozzle = (LCD_PIXEL_WIDTH / 2) - 20; diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index c194d43438..5c8298cf52 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1714,6 +1714,20 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; if (touch_calibration.need_calibration()) ui.goto_screen(touch_screen_calibration); #endif } + + #if EITHER(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) + void MarlinUI::zoffset_overlay(const_float_t zvalue) { + // Determine whether the user is raising or lowering the nozzle. + static int8_t dir; + static float old_zvalue; + if (zvalue != old_zvalue) { + dir = zvalue ? zvalue < old_zvalue ? -1 : 1 : 0; + old_zvalue = zvalue; + } + zoffset_overlay(dir); + } + #endif + #endif #if BOTH(EXTENSIBLE_UI, ADVANCED_PAUSE_FEATURE) diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 270ee3afce..02d5bf06bd 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -474,6 +474,11 @@ public: static bool did_first_redraw; #endif + #if EITHER(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) + static void zoffset_overlay(const int8_t dir); + static void zoffset_overlay(const_float_t zvalue); + #endif + static void draw_kill_screen(); #else // No LCD diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 76cdd51cd5..61a1a16c6a 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -257,9 +257,6 @@ void MarlinUI::synchronize(PGM_P const msg/*=nullptr*/) { * * encoderLine is the position based on the encoder * encoderTopLine is the top menu line to display - * _lcdLineNr is the index of the LCD line (e.g., 0-3) - * _menuLineNr is the menu item to draw and process - * _thisItemNr is the index of each MENU_ITEM or STATIC_ITEM * screen_items is the total number of items in the menu (after one call) */ void scroll_screen(const uint8_t limit, const bool is_menu) { @@ -336,7 +333,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) { if (ui.should_draw()) { if (do_probe) { MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_ZPROBE_ZOFFSET), BABYSTEP_TO_STR(probe.offset.z)); - TERN_(BABYSTEP_ZPROBE_GFX_OVERLAY, _lcd_zoffset_overlay_gfx(probe.offset.z)); + TERN_(BABYSTEP_ZPROBE_GFX_OVERLAY, ui.zoffset_overlay(probe.offset.z)); } else { #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index ad2cf72000..50842dcaf8 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -39,10 +39,6 @@ typedef void (*selectFunc_t)(); #define SS_INVERT 0x02 #define SS_DEFAULT SS_CENTER -#if EITHER(HAS_MARLINUI_U8GLIB, IS_DWIN_MARLINUI) && EITHER(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) - void _lcd_zoffset_overlay_gfx(const_float_t zvalue); -#endif - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) && Z_PROBE_OFFSET_RANGE_MIN >= -9 && Z_PROBE_OFFSET_RANGE_MAX <= 9 #define BABYSTEP_TO_STR(N) ftostr43sign(N) #elif ENABLED(BABYSTEPPING) diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index 03aec39c83..8dea7d943d 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -83,7 +83,7 @@ void _lcd_mesh_fine_tune(PGM_P const msg) { if (ui.should_draw()) { const float rounded_f = rounded_mesh_value(); MenuEditItemBase::draw_edit_screen(msg, ftostr43sign(rounded_f)); - TERN_(MESH_EDIT_GFX_OVERLAY, _lcd_zoffset_overlay_gfx(rounded_f)); + TERN_(MESH_EDIT_GFX_OVERLAY, ui.zoffset_overlay(rounded_f)); TERN_(HAS_GRAPHICAL_TFT, ui.refresh(LCDVIEW_NONE)); } }