🐛 Fix init of delta safe height (for G29, G33, etc.) (#23622)

This commit is contained in:
Bob Kuhn 2022-02-06 08:35:18 -06:00 committed by Scott Lahteine
parent 82ae3646cb
commit 58239c65cb
4 changed files with 14 additions and 1 deletions

View file

@ -1339,6 +1339,10 @@ void setup() {
SETUP_RUN(endstops.init()); // Init endstops and pullups SETUP_RUN(endstops.init()); // Init endstops and pullups
#if ENABLED(DELTA) && !HAS_SOFTWARE_ENDSTOPS
SETUP_RUN(refresh_delta_clip_start_height()); // Init safe delta height without soft endstops
#endif
SETUP_RUN(stepper.init()); // Init stepper. This enables interrupts! SETUP_RUN(stepper.init()); // Init stepper. This enables interrupts!
#if HAS_SERVOS #if HAS_SERVOS

View file

@ -63,6 +63,13 @@ abc_float_t delta_diagonal_rod_trim;
float delta_safe_distance_from_top(); float delta_safe_distance_from_top();
void refresh_delta_clip_start_height() {
delta_clip_start_height = TERN(HAS_SOFTWARE_ENDSTOPS,
soft_endstop.max.z,
DIFF_TERN(HAS_BED_PROBE, delta_height, probe.offset.z)
) - delta_safe_distance_from_top();
}
/** /**
* Recalculate factors used for delta kinematics whenever * Recalculate factors used for delta kinematics whenever
* settings have been changed (e.g., by M665). * settings have been changed (e.g., by M665).

View file

@ -82,6 +82,8 @@ void inverse_kinematics(const xyz_pos_t &raw);
*/ */
float delta_safe_distance_from_top(); float delta_safe_distance_from_top();
void refresh_delta_clip_start_height();
/** /**
* Delta Forward Kinematics * Delta Forward Kinematics
* *

View file

@ -743,7 +743,7 @@ void restore_feedrate_and_scaling() {
delta_max_radius_2 = sq(delta_max_radius); delta_max_radius_2 = sq(delta_max_radius);
break; break;
case Z_AXIS: case Z_AXIS:
delta_clip_start_height = soft_endstop.max[axis] - delta_safe_distance_from_top(); refresh_delta_clip_start_height();
default: break; default: break;
} }