Browse Source

Z-offset edit precision based on value limits (#16425)

pull/1/head
InsanityAutomation 5 years ago
committed by Scott Lahteine
parent
commit
d129ac1b37
  1. 4
      Marlin/src/lcd/menu/menu.cpp
  2. 8
      Marlin/src/lcd/menu/menu.h
  3. 2
      Marlin/src/lcd/menu/menu_bed_leveling.cpp
  4. 2
      Marlin/src/lcd/menu/menu_configuration.cpp
  5. 4
      Marlin/src/lcd/menu/menu_tune.cpp

4
Marlin/src/lcd/menu/menu.cpp

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

8
Marlin/src/lcd/menu/menu.h

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

2
Marlin/src/lcd/menu/menu_bed_leveling.cpp

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

2
Marlin/src/lcd/menu/menu_configuration.cpp

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

4
Marlin/src/lcd/menu/menu_tune.cpp

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

Loading…
Cancel
Save