🎨 Rename MarlinUI::zoffset_overlay

This commit is contained in:
Scott Lahteine 2021-10-02 02:33:14 -05:00
parent 99d51af90f
commit b8c32e24d8
8 changed files with 32 additions and 32 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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));
}
}