Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Z-offset editing precision based on value limits #16425

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Marlin/src/lcd/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,10 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
if (ui.should_draw()) {
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
if (!do_probe)
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_HOTEND_OFFSET_Z), ftostr43sign(hotend_offset[active_extruder].z));
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_HOTEND_OFFSET_Z), LCD_Z_OFFSET_FUNC(hotend_offset[active_extruder].z));
else
#endif
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_ZPROBE_ZOFFSET), ftostr43sign(probe_offset.z));
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_ZPROBE_ZOFFSET), LCD_Z_OFFSET_FUNC(probe_offset.z));

#if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY)
if (do_probe) _lcd_zoffset_overlay_gfx(probe_offset.z);
Expand Down
8 changes: 8 additions & 0 deletions Marlin/src/lcd/menu/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ typedef void (*selectFunc_t)();
void _lcd_zoffset_overlay_gfx(const float zvalue);
#endif

#if Z_PROBE_OFFSET_RANGE_MIN >= -9 && Z_PROBE_OFFSET_RANGE_MAX <= 9
#define LCD_Z_OFFSET_FUNC(N) ftostr54sign(N)
#define LCD_Z_OFFSET_TYPE float43
#else
#define LCD_Z_OFFSET_FUNC(N) ftostr52sign(N)
#define LCD_Z_OFFSET_TYPE float52
#endif

////////////////////////////////////////////
///////////// Base Menu Items //////////////
////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_bed_leveling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ void menu_bed_leveling() {
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
#elif HAS_BED_PROBE
EDIT_ITEM(float52, MSG_ZPROBE_ZOFFSET, &probe_offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_ZPROBE_ZOFFSET, &probe_offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
#endif

#if ENABLED(LEVEL_BED_CORNERS)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void menu_configuration() {
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
#elif HAS_BED_PROBE
EDIT_ITEM(float52, MSG_ZPROBE_ZOFFSET, &probe_offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_ZPROBE_ZOFFSET, &probe_offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
#endif

const bool busy = printer_busy();
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/menu/menu_tune.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
}
if (ui.should_draw()) {
const float spm = planner.steps_to_mm[axis];
MenuEditItemBase::draw_edit_screen(msg, ftostr54sign(spm * babystep.accum));
MenuEditItemBase::draw_edit_screen(msg, LCD_Z_OFFSET_FUNC(spm * babystep.accum));
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
const bool in_view = (true
#if HAS_GRAPHICAL_LCD
Expand All @@ -81,7 +81,7 @@
#endif
lcd_put_u8str_P(GET_TEXT(MSG_BABYSTEP_TOTAL));
lcd_put_wchar(':');
lcd_put_u8str(ftostr54sign(spm * babystep.axis_total[BS_TOTAL_AXIS(axis)]));
lcd_put_u8str(LCD_Z_OFFSET_FUNC(spm * babystep.axis_total[BS_TOTAL_AXIS(axis)]));
}
#endif
}
Expand Down