Browse Source

More explicit junction/jerk math

vanilla_fb_2.0.x
Scott Lahteine 5 years ago
parent
commit
b8947ac8a5
  1. 6
      Marlin/src/module/planner.cpp
  2. 4
      Marlin/src/module/planner.h

6
Marlin/src/module/planner.cpp

@ -2304,7 +2304,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
const float junction_acceleration = limit_value_by_axis_maximum(block->acceleration, junction_unit_vec), const float junction_acceleration = limit_value_by_axis_maximum(block->acceleration, junction_unit_vec),
sin_theta_d2 = SQRT(0.5f * (1.0f - junction_cos_theta)); // Trig half angle identity. Always positive. sin_theta_d2 = SQRT(0.5f * (1.0f - junction_cos_theta)); // Trig half angle identity. Always positive.
vmax_junction_sqr = JUNC_SQ(junction_acceleration, sin_theta_d2); vmax_junction_sqr = junction_acceleration * junction_deviation_mm * sin_theta_d2 / (1.0f - sin_theta_d2);
if (block->millimeters < 1) { if (block->millimeters < 1) {
const float neg = junction_cos_theta < 0 ? -1 : 1, const float neg = junction_cos_theta < 0 ? -1 : 1,
@ -2340,8 +2340,8 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
* for (float t = 0; t <= 1; t += 0.0003f) { * for (float t = 0; t <= 1; t += 0.0003f) {
* const float e = acos(t) / approx(t); * const float e = acos(t) / approx(t);
* if (isfinite(e)) { * if (isfinite(e)) {
* NOMORE(min, e); * if (e < min) min = e;
* NOLESS(max, e); * if (e > max) max = e;
* } * }
* } * }
* fprintf(stderr, "%.9gf, ", (min + max) / 2); * fprintf(stderr, "%.9gf, ", (min + max) / 2);

4
Marlin/src/module/planner.h

@ -838,11 +838,9 @@ class Planner {
static void autotemp_update(); static void autotemp_update();
#endif #endif
#define JUNC_SQ(N,ST) (junction_deviation_mm * (N) * (ST) / (1.0f - (ST)))
#if HAS_LINEAR_E_JERK #if HAS_LINEAR_E_JERK
FORCE_INLINE static void recalculate_max_e_jerk() { FORCE_INLINE static void recalculate_max_e_jerk() {
#define GET_MAX_E_JERK(N) SQRT(JUNC_SQ(N,SQRT(0.5))) #define GET_MAX_E_JERK(N) SQRT(junction_deviation_mm * (N) * SQRT(0.5) / (1.0f - SQRT(0.5)))
#if ENABLED(DISTINCT_E_FACTORS) #if ENABLED(DISTINCT_E_FACTORS)
LOOP_L_N(i, EXTRUDERS) LOOP_L_N(i, EXTRUDERS)
max_e_jerk[i] = GET_MAX_E_JERK(settings.max_acceleration_mm_per_s2[E_AXIS_N(i)]); max_e_jerk[i] = GET_MAX_E_JERK(settings.max_acceleration_mm_per_s2[E_AXIS_N(i)]);

Loading…
Cancel
Save