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

This commit is contained in:
InsanityAutomation 2020-01-02 21:40:40 -05:00 committed by Scott Lahteine
parent 1ea529b9c1
commit d129ac1b37
5 changed files with 14 additions and 6 deletions

View File

@ -429,10 +429,10 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
if (ui.should_draw()) { if (ui.should_draw()) {
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
if (!do_probe) 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 else
#endif #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 ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY)
if (do_probe) _lcd_zoffset_overlay_gfx(probe_offset.z); if (do_probe) _lcd_zoffset_overlay_gfx(probe_offset.z);

View File

@ -47,6 +47,14 @@ typedef void (*selectFunc_t)();
void _lcd_zoffset_overlay_gfx(const float zvalue); void _lcd_zoffset_overlay_gfx(const float zvalue);
#endif #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 ////////////// ///////////// Base Menu Items //////////////
//////////////////////////////////////////// ////////////////////////////////////////////

View File

@ -281,7 +281,7 @@ void menu_bed_leveling() {
#if ENABLED(BABYSTEP_ZPROBE_OFFSET) #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset); SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
#elif HAS_BED_PROBE #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 #endif
#if ENABLED(LEVEL_BED_CORNERS) #if ENABLED(LEVEL_BED_CORNERS)

View File

@ -317,7 +317,7 @@ void menu_configuration() {
#if ENABLED(BABYSTEP_ZPROBE_OFFSET) #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset); SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
#elif HAS_BED_PROBE #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 #endif
const bool busy = printer_busy(); const bool busy = printer_busy();

View File

@ -65,7 +65,7 @@
} }
if (ui.should_draw()) { if (ui.should_draw()) {
const float spm = planner.steps_to_mm[axis]; 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) #if ENABLED(BABYSTEP_DISPLAY_TOTAL)
const bool in_view = (true const bool in_view = (true
#if HAS_GRAPHICAL_LCD #if HAS_GRAPHICAL_LCD
@ -81,7 +81,7 @@
#endif #endif
lcd_put_u8str_P(GET_TEXT(MSG_BABYSTEP_TOTAL)); lcd_put_u8str_P(GET_TEXT(MSG_BABYSTEP_TOTAL));
lcd_put_wchar(':'); 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 #endif
} }