Followup for BABYSTEP_HOTEND_Z_OFFSET (#11916)

This commit is contained in:
Scott Lahteine
2018-09-24 21:46:56 -04:00
committed by GitHub
parent 884ad75cb8
commit cee34f7290
65 changed files with 291 additions and 118 deletions

View File

@ -1310,42 +1310,46 @@ void lcd_quick_feedback(const bool clear_buttons) {
void lcd_babystep_zoffset() {
if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
defer_return_to_status = true;
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
const bool do_probe = (active_extruder == 0);
#else
constexpr bool do_probe = true;
#endif
ENCODER_DIRECTION_NORMAL();
if (encoderPosition) {
const int16_t babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR);
encoderPosition = 0;
const float new_zoffset = zprobe_zoffset + planner.steps_to_mm[Z_AXIS] * babystep_increment;
if (WITHIN(new_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
const float diff = planner.steps_to_mm[Z_AXIS] * babystep_increment,
new_probe_offset = zprobe_zoffset + diff,
new_offs =
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
do_probe ? new_probe_offset : hotend_offset[Z_AXIS][active_extruder] - diff
#else
new_probe_offset
#endif
;
if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
thermalManager.babystep_axis(Z_AXIS, babystep_increment);
if (do_probe) zprobe_zoffset = new_offs;
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
if (active_extruder == 0)
{
thermalManager.babystep_axis(Z_AXIS, babystep_increment);
zprobe_zoffset = new_zoffset;
} else {
thermalManager.babystep_axis(Z_AXIS, babystep_increment);
hotend_offset[Z_AXIS][active_extruder] -= (planner.steps_to_mm[Z_AXIS] * babystep_increment);
}
#else
zprobe_zoffset = new_zoffset;
else hotend_offset[Z_AXIS][active_extruder] = new_offs;
#endif
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
}
}
if (lcdDrawUpdate) {
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)
if (active_extruder == 0) {
if (do_probe)
lcd_implementation_drawedit(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_zoffset));
} else {
else
lcd_implementation_drawedit(PSTR(MSG_IDEX_Z_OFFSET), ftostr43sign(hotend_offset[Z_AXIS][active_extruder]));
}
#endif
#if ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY)
if (active_extruder == 0) {
_lcd_zoffset_overlay_gfx(zprobe_zoffset);
}
if (do_probe) _lcd_zoffset_overlay_gfx(zprobe_zoffset);
#endif
}
}