Skip to content

Commit

Permalink
toolhead: Changed the threshold calculation for straight segments
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Butyugin <[email protected]>
  • Loading branch information
dmbutyugin committed Nov 24, 2024
1 parent e7a2b2a commit b97d6e2
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions klippy/toolhead.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,27 @@ def calc_junction(self, prev_move):
+ axes_r[2] * prev_axes_r[2])
if junction_cos_theta > 0.999999:
return
sin_theta_d2 = math.sqrt(0.5*(1.0-junction_cos_theta))
cos_theta_d2 = math.sqrt(0.5*(1.0+junction_cos_theta))
# Apply limits
self.max_start_v2 = min(
extruder_v2, self.max_cruise_v2, prev_move.max_cruise_v2,
prev_move.max_start_v2 + prev_move.delta_v2)
if junction_cos_theta >= -0.999999:
sin_theta_d2 = math.sqrt(0.5*(1.0-junction_cos_theta))
R_jd = sin_theta_d2 / (1. - sin_theta_d2)
self.max_start_v2 = min(
self.max_start_v2,
R_jd * self.junction_deviation * self.accel,
R_jd * prev_move.junction_deviation * prev_move.accel)
# Check that the radius of curvature for this junction is finite
if max(self.move_d, prev_move.move_d) < 99999999.9 * cos_theta_d2:
# Approximated circle must contact moves no further than mid-move
tan_theta_d2 = sin_theta_d2 / math.sqrt(.5*(1.0+junction_cos_theta))
tan_theta_d2 = sin_theta_d2 / cos_theta_d2
move_centripetal_v2 = .5 * self.move_d * tan_theta_d2 * self.accel
prev_move_centripetal_v2 = (.5 * prev_move.move_d * tan_theta_d2
* prev_move.accel)
self.max_start_v2 = min(
self.max_start_v2,
R_jd * self.junction_deviation * self.accel,
R_jd * prev_move.junction_deviation * prev_move.accel,
move_centripetal_v2, prev_move_centripetal_v2)
self.max_start_v2 = min(self.max_start_v2, move_centripetal_v2,
prev_move_centripetal_v2)
self.max_smoothed_v2 = min(
self.max_start_v2
, prev_move.max_smoothed_v2 + prev_move.smooth_delta_v2)
Expand Down

0 comments on commit b97d6e2

Please sign in to comment.