Skip to content

Commit

Permalink
clearance cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed May 1, 2024
1 parent 7d1e854 commit f3bff12
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ static void _gotoTrammingPoint(unsigned char point) {
case 5: x = X_MIN_BED + lfrb[0]; y = Y_MAX_BED - lfrb[3]; break;
}

ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(ExtUI::Z) + (BED_TRAMMING_Z_HOP), ExtUI::Z);
if (BED_TRAMMING_Z_HOP)
ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(ExtUI::Z) + (BED_TRAMMING_Z_HOP), ExtUI::Z);
ExtUI::setAxisPosition_mm(x, ExtUI::X);
ExtUI::setAxisPosition_mm(y, ExtUI::Y);
ExtUI::setAxisPosition_mm((Z_MIN_POS) + (BED_TRAMMING_HEIGHT), ExtUI::Z);
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/lcd/extui/dgus_reloaded/DGUSRxHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,8 @@ void DGUSRxHandler::moveToPoint(DGUS_VP &vp, void *data_ptr) {
break;
}

ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(ExtUI::Z) + (BED_TRAMMING_Z_HOP), ExtUI::Z);
if (BED_TRAMMING_Z_HOP)
ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(ExtUI::Z) + (BED_TRAMMING_Z_HOP), ExtUI::Z);
ExtUI::setAxisPosition_mm(x, ExtUI::X);
ExtUI::setAxisPosition_mm(y, ExtUI::Y);
ExtUI::setAxisPosition_mm((Z_MIN_POS) + (BED_TRAMMING_HEIGHT), ExtUI::Z);
Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/lcd/extui/ia_creality/ia_creality_rts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1162,35 +1162,35 @@ void RTS::handleData() {

#if ENABLED(LCD_BED_TRAMMING)
case 6: // Bed Tramming, Centre 1
setAxisPosition_mm(current_position.z + (BED_TRAMMING_Z_HOP), axis_t(Z));
if (BED_TRAMMING_Z_HOP) setAxisPosition_mm(current_position.z + (BED_TRAMMING_Z_HOP), axis_t(Z));
setAxisPosition_mm(X_CENTER, axis_t(X));
setAxisPosition_mm(Y_CENTER, axis_t(Y));
waitway = 6;
break;

case 7: // Bed Tramming, Front Left 2
setAxisPosition_mm(current_position.z + (BED_TRAMMING_Z_HOP), axis_t(Z));
if (BED_TRAMMING_Z_HOP) setAxisPosition_mm(current_position.z + (BED_TRAMMING_Z_HOP), axis_t(Z));
setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X));
setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y));
waitway = 6;
break;

case 8: // Bed Tramming, Front Right 3
setAxisPosition_mm(current_position.z + (BED_TRAMMING_Z_HOP), axis_t(Z));
if (BED_TRAMMING_Z_HOP) setAxisPosition_mm(current_position.z + (BED_TRAMMING_Z_HOP), axis_t(Z));
setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X));
setAxisPosition_mm(Y_MIN_BED + lfrb[1], axis_t(Y));
waitway = 6;
break;

case 9: // Bed Tramming, Back Right 4
setAxisPosition_mm(current_position.z + (BED_TRAMMING_Z_HOP), axis_t(Z));
if (BED_TRAMMING_Z_HOP) setAxisPosition_mm(current_position.z + (BED_TRAMMING_Z_HOP), axis_t(Z));
setAxisPosition_mm(X_MAX_BED - lfrb[2], axis_t(X));
setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y));
waitway = 6;
break;

case 10: // Bed Tramming, Back Left 5
setAxisPosition_mm(current_position.z + (BED_TRAMMING_Z_HOP), axis_t(Z));
if (BED_TRAMMING_Z_HOP) setAxisPosition_mm(current_position.z + (BED_TRAMMING_Z_HOP), axis_t(Z));
setAxisPosition_mm(X_MIN_BED + lfrb[0], axis_t(X));
setAxisPosition_mm(Y_MAX_BED - lfrb[3], axis_t(Y));
waitway = 6;
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/menu/menu_bed_tramming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static void _lcd_goto_next_corner() {
}

bool _lcd_bed_tramming_probe(const bool verify=false) {
if (verify) line_to_z(current_position.z + BED_TRAMMING_Z_HOP); // do clearance if needed (add clearance (BED_TRAMMING_Z_HOP) to current z height (current_position.z) to prevent probe trigger loop)
if (verify) line_to_z(current_position.z + BED_TRAMMING_Z_HOP); // do clearance if needed
TERN_(BLTOUCH, if (!bltouch.high_speed_mode) bltouch.deploy()); // Deploy in LOW SPEED MODE on every probe action
do_blocking_move_to_z(last_z - BED_TRAMMING_PROBE_TOLERANCE, MMM_TO_MMS(Z_PROBE_FEEDRATE_SLOW)); // Move down to lower tolerance
if (TEST(endstops.trigger_state(), Z_MIN_PROBE)) { // check if probe triggered
Expand All @@ -246,7 +246,7 @@ static void _lcd_goto_next_corner() {

// Raise the probe after the last point to give clearance for stow
if (TERN0(NEEDS_PROBE_DEPLOY, good_points == nr_edge_points - 1))
line_to_z(BED_TRAMMING_Z_HOP);
do_z_clearance(BED_TRAMMING_Z_HOP);

return true; // probe triggered
}
Expand Down
14 changes: 13 additions & 1 deletion Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,14 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*
fr_mm_s
);
}
/**
* Move Z to a particular height so the nozzle or deployed probe clears the bed
* - Use do_z_clearance_by for clearance over the current position
* - For a probe, add clearance for the probe distance
* - Constrain to the Z max physical position
* - If lowering is not allowed then skip a downward move
* - Execute the move at the probing (or homing) feedrate
*/
void do_z_clearance(const_float_t zclear, const bool with_probe/*=true*/, const bool lower_allowed/*=false*/) {
UNUSED(with_probe);
float zdest = zclear;
Expand All @@ -727,9 +735,13 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance_by(", zclear, ")");
do_z_clearance(current_position.z + zclear, false);
}
/**
* Move Z to Z_POST_CLEARANCE,
* The axis is allowed to move down.
*/
void do_move_after_z_homing() {
DEBUG_SECTION(mzah, "do_move_after_z_homing", DEBUGGING(LEVELING));
#if defined(Z_AFTER_HOMING) || ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING)
#ifdef Z_POST_CLEARANCE
do_z_clearance(Z_POST_CLEARANCE, true, true);
#elif ENABLED(USE_PROBE_FOR_Z_HOMING)
probe.move_z_after_probing();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
default: break;
case PROBE_PT_RAISE:
if (raise_after_is_relative)
do_z_clearance(current_position.z + z_clearance, false);
do_z_clearance_by(z_clearance);
else
do_z_clearance(z_clearance);
break;
Expand Down

0 comments on commit f3bff12

Please sign in to comment.