Skip to content

Commit

Permalink
Just do it!
Browse files Browse the repository at this point in the history
  • Loading branch information
tombrazier committed Jun 19, 2022
1 parent 6b46561 commit d23d9f4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 29 deletions.
3 changes: 0 additions & 3 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2193,9 +2193,6 @@
#define N_ARC_CORRECTION 25 // Number of interpolated segments between corrections
//#define ARC_P_CIRCLES // Enable the 'P' parameter to specify complete circles
//#define SF_ARC_FIX // Enable only if using SkeinForge with "Arc Point" fillet procedure
#if HAS_JUNCTION_DEVIATION
#define ARC_ASSISTED_JD // Pass the arc radius to the junction deviation code to save processor cycles
#endif
#endif

// G5 Bézier Curve Support with XYZE destination and IJPQ offsets
Expand Down
4 changes: 1 addition & 3 deletions Marlin/src/gcode/motion/G2_G3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,7 @@ void plan_arc(
#endif

if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, 0
OPTARG(SCARA_FEEDRATE_SCALING, inv_duration)
OPTARG(ARC_ASSISTED_JD, i > 1 ? radius : 0.0)
))
OPTARG(SCARA_FEEDRATE_SCALING, inv_duration), i > 1 ? radius : 0.0))
break;
}
}
Expand Down
31 changes: 13 additions & 18 deletions Marlin/src/module/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1783,7 +1783,7 @@ bool Planner::_buffer_steps(const xyze_long_t &target
OPTARG(HAS_POSITION_FLOAT, const xyze_pos_t &target_float)
OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm)
, feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters
OPTARG(ARC_ASSISTED_JD, const_float_t arc_radius/*=0.0*/)
, const_float_t arc_radius/*=0.0*/
) {

// Wait for the next available block
Expand All @@ -1799,8 +1799,7 @@ bool Planner::_buffer_steps(const xyze_long_t &target
if (!_populate_block(block, false, target
OPTARG(HAS_POSITION_FLOAT, target_float)
OPTARG(HAS_DIST_MM_ARG, cart_dist_mm)
, fr_mm_s, extruder, millimeters
OPTARG(ARC_ASSISTED_JD, arc_radius)
, fr_mm_s, extruder, millimeters, arc_radius
)) {
// Movement was not queued, probably because it was too short.
// Simply accept that as movement queued and done
Expand Down Expand Up @@ -1843,7 +1842,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
OPTARG(HAS_POSITION_FLOAT, const xyze_pos_t &target_float)
OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm)
, feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters/*=0.0*/
OPTARG(ARC_ASSISTED_JD, const_float_t arc_radius/*=0.0*/)
, const_float_t arc_radius/*=0.0*/
) {
int32_t LOGICAL_AXIS_LIST(
de = target.e - position.e,
Expand Down Expand Up @@ -2655,11 +2654,9 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
normalize_junction_vector(junction_unit_vec);
const float junction_acceleration = limit_value_by_axis_maximum(block->acceleration, junction_unit_vec);

#if ENABLED(ARC_ASSISTED_JD)
if (arc_radius > 0.0)
vmax_junction_sqr = junction_acceleration * arc_radius;
else
#endif
if (arc_radius > 0.0)
vmax_junction_sqr = junction_acceleration * arc_radius;
else
{
NOLESS(junction_cos_theta, -0.999999f); // Check for numerical round-off to avoid divide by zero.

Expand Down Expand Up @@ -2973,8 +2970,8 @@ void Planner::buffer_sync_block(TERN_(LASER_SYNCHRONOUS_M106_M107, uint8_t sync_
*/
bool Planner::buffer_segment(const abce_pos_t &abce
OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm)
, const_feedRate_t fr_mm_s, const uint8_t extruder/*=active_extruder*/, const_float_t millimeters/*=0.0*/
OPTARG(ARC_ASSISTED_JD, const_float_t arc_radius/*=0.0*/)
, const_feedRate_t fr_mm_s, const uint8_t extruder/*=active_extruder*/
, const_float_t millimeters/*=0.0*/, const_float_t arc_radius/*=0.0*/
) {

// If we are cleaning, do not accept queuing of movements
Expand Down Expand Up @@ -3080,9 +3077,8 @@ bool Planner::buffer_segment(const abce_pos_t &abce
if (!_buffer_steps(target
OPTARG(HAS_POSITION_FLOAT, target_float)
OPTARG(HAS_DIST_MM_ARG, cart_dist_mm)
, fr_mm_s, extruder, millimeters
OPTARG(ARC_ASSISTED_JD, arc_radius)
)) return false;
, fr_mm_s, extruder, millimeters, arc_radius)
) return false;

stepper.wake_up();
return true;
Expand All @@ -3100,8 +3096,7 @@ bool Planner::buffer_segment(const abce_pos_t &abce
* inv_duration - the reciprocal if the duration of the movement, if known (kinematic only if feeedrate scaling is enabled)
*/
bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s, const uint8_t extruder/*=active_extruder*/, const float millimeters/*=0.0*/
OPTARG(SCARA_FEEDRATE_SCALING, const_float_t inv_duration/*=0.0*/)
OPTARG(ARC_ASSISTED_JD, const_float_t arc_radius/*=0.0*/)
OPTARG(SCARA_FEEDRATE_SCALING, const_float_t inv_duration/*=0.0*/), const_float_t arc_radius/*=0.0*/
) {
xyze_pos_t machine = cart;
TERN_(HAS_POSITION_MODIFIERS, apply_modifiers(machine));
Expand Down Expand Up @@ -3138,13 +3133,13 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s, cons
const feedRate_t feedrate = fr_mm_s;
#endif
TERN_(HAS_EXTRUDERS, delta.e = machine.e);
if (buffer_segment(delta OPTARG(HAS_DIST_MM_ARG, cart_dist_mm), feedrate, extruder, mm OPTARG(ARC_ASSISTED_JD, arc_radius))) {
if (buffer_segment(delta OPTARG(HAS_DIST_MM_ARG, cart_dist_mm), feedrate, extruder, mm, arc_radius)) {
position_cart = cart;
return true;
}
return false;
#else
return buffer_segment(machine, fr_mm_s, extruder, millimeters OPTARG(ARC_ASSISTED_JD, arc_radius));
return buffer_segment(machine, fr_mm_s, extruder, millimeters, arc_radius);
#endif
} // buffer_line()

Expand Down
9 changes: 4 additions & 5 deletions Marlin/src/module/planner.h
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ class Planner {
OPTARG(HAS_POSITION_FLOAT, const xyze_pos_t &target_float)
OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm)
, feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters=0.0
OPTARG(ARC_ASSISTED_JD, const_float_t arc_radius=0.0)
, const_float_t arc_radius=0.0
);

/**
Expand All @@ -752,7 +752,7 @@ class Planner {
OPTARG(HAS_POSITION_FLOAT, const xyze_pos_t &target_float)
OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm)
, feedRate_t fr_mm_s, const uint8_t extruder, const_float_t millimeters=0.0
OPTARG(ARC_ASSISTED_JD, const_float_t arc_radius=0.0)
, const_float_t arc_radius=0.0
);

/**
Expand Down Expand Up @@ -786,7 +786,7 @@ class Planner {
static bool buffer_segment(const abce_pos_t &abce
OPTARG(HAS_DIST_MM_ARG, const xyze_float_t &cart_dist_mm)
, const_feedRate_t fr_mm_s, const uint8_t extruder=active_extruder, const_float_t millimeters=0.0
OPTARG(ARC_ASSISTED_JD, const_float_t arc_radius=0.0)
, const_float_t arc_radius=0.0
);

public:
Expand All @@ -803,8 +803,7 @@ class Planner {
* inv_duration - the reciprocal if the duration of the movement, if known (kinematic only if feeedrate scaling is enabled)
*/
static bool buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s, const uint8_t extruder=active_extruder, const float millimeters=0.0
OPTARG(SCARA_FEEDRATE_SCALING, const_float_t inv_duration=0.0)
OPTARG(ARC_ASSISTED_JD, const_float_t arc_radius=0.0)
OPTARG(SCARA_FEEDRATE_SCALING, const_float_t inv_duration=0.0), const_float_t arc_radius=0.0
);

#if ENABLED(DIRECT_STEPPING)
Expand Down

0 comments on commit d23d9f4

Please sign in to comment.