Skip to content

Commit

Permalink
🐛 Fix init of delta safe height (for G29, G33, etc.) (MarlinFirmware#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob-the-Kuhn authored and tomek2k1 committed Jan 13, 2023
1 parent 21fa9d9 commit a17609b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
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

0 comments on commit a17609b

Please sign in to comment.