Skip to content

Commit

Permalink
Use MANUAL_PROBE_START_Z for UBL manual probing (MarlinFirmware#20160)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjasonsmith authored and thinkyhead committed Apr 26, 2021
1 parent 0dd3fb0 commit b9d2c24
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/feature/bedlevel/ubl/ubl.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class unified_bed_leveling {
#if IS_NEWPANEL
static void move_z_with_encoder(const float &multiplier);
static float measure_point_with_encoder();
static float measure_business_card_thickness(float in_height);
static float measure_business_card_thickness();
static void manually_probe_remaining_mesh(const xy_pos_t&, const float&, const float&, const bool) _O0;
static void fine_tune_mesh(const xy_pos_t &pos, const bool do_ubl_mesh_map) _O0;
#endif
Expand Down
10 changes: 4 additions & 6 deletions Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@
}

if (parser.seen('B')) {
g29_card_thickness = parser.has_value() ? parser.value_float() : measure_business_card_thickness(float(Z_CLEARANCE_BETWEEN_PROBES));
g29_card_thickness = parser.has_value() ? parser.value_float() : measure_business_card_thickness();
if (ABS(g29_card_thickness) > 1.5f) {
SERIAL_ECHOLNPGM("?Error in Business Card measurement.");
return;
Expand Down Expand Up @@ -837,11 +837,11 @@

static void echo_and_take_a_measurement() { SERIAL_ECHOLNPGM(" and take a measurement."); }

float unified_bed_leveling::measure_business_card_thickness(float in_height) {
float unified_bed_leveling::measure_business_card_thickness() {
ui.capture();
save_ubl_active_state_and_disable(); // Disable bed level correction for probing

do_blocking_move_to(0.5f * (MESH_MAX_X - (MESH_MIN_X)), 0.5f * (MESH_MAX_Y - (MESH_MIN_Y)), in_height);
do_blocking_move_to(0.5f * (MESH_MAX_X - (MESH_MIN_X)), 0.5f * (MESH_MAX_Y - (MESH_MIN_Y)), MANUAL_PROBE_START_Z);
//, _MIN(planner.settings.max_feedrate_mm_s[X_AXIS], planner.settings.max_feedrate_mm_s[Y_AXIS]) * 0.5f);
planner.synchronize();

Expand Down Expand Up @@ -949,7 +949,7 @@
g29_repetition_cnt = 1; // do exactly one mesh location. Otherwise use what the parser decided.

#if ENABLED(UBL_MESH_EDIT_MOVES_Z)
const float h_offset = parser.seenval('H') ? parser.value_linear_units() : 0;
const float h_offset = parser.seenval('H') ? parser.value_linear_units() : MANUAL_PROBE_START_Z;
if (!WITHIN(h_offset, 0, 10)) {
SERIAL_ECHOLNPGM("Offset out of bounds. (0 to 10mm)\n");
return;
Expand All @@ -970,8 +970,6 @@

do_blocking_move_to_xy_z(pos, Z_CLEARANCE_BETWEEN_PROBES); // Move to the given XY with probe clearance

TERN_(UBL_MESH_EDIT_MOVES_Z, do_blocking_move_to_z(h_offset)); // Move Z to the given 'H' offset

MeshFlags done_flags{0};
const xy_int8_t &lpos = location.pos;
do {
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -2611,6 +2611,10 @@
#endif
#endif

#if !defined(MANUAL_PROBE_START_Z) && defined(Z_CLEARANCE_BETWEEN_PROBES)
#define MANUAL_PROBE_START_Z Z_CLEARANCE_BETWEEN_PROBES
#endif

#ifndef __SAM3X8E__ //todo: hal: broken hal encapsulation
#undef UI_VOLTAGE_LEVEL
#undef RADDS_DISPLAY
Expand Down

0 comments on commit b9d2c24

Please sign in to comment.