Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from
Feb 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,10 @@ void setup() {

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!

#if HAS_SERVOS
Expand Down
7 changes: 7 additions & 0 deletions Marlin/src/module/delta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ abc_float_t delta_diagonal_rod_trim;

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
* settings have been changed (e.g., by M665).
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/module/delta.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ void inverse_kinematics(const xyz_pos_t &raw);
*/
float delta_safe_distance_from_top();

void refresh_delta_clip_start_height();

/**
* Delta Forward Kinematics
*
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ void restore_feedrate_and_scaling() {
delta_max_radius_2 = sq(delta_max_radius);
break;
case Z_AXIS:
delta_clip_start_height = soft_endstop.max[axis] - delta_safe_distance_from_top();
refresh_delta_clip_start_height();
default: break;
}

Expand Down