Improve E_AXIS_N macro
This commit is contained in:
parent
191df5e17d
commit
7db0113b53
4 changed files with 16 additions and 16 deletions
|
@ -163,8 +163,8 @@
|
|||
void GcodeSuite::M913() {
|
||||
#define TMC_SAY_PWMTHRS(A,Q) tmc_get_pwmthrs(stepper##Q, planner.axis_steps_per_mm[_AXIS(A)])
|
||||
#define TMC_SET_PWMTHRS(A,Q) tmc_set_pwmthrs(stepper##Q, value, planner.axis_steps_per_mm[_AXIS(A)])
|
||||
#define TMC_SAY_PWMTHRS_E(E) do{ constexpr uint8_t extruder = E; tmc_get_pwmthrs(stepperE##E, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }while(0)
|
||||
#define TMC_SET_PWMTHRS_E(E) do{ constexpr uint8_t extruder = E; tmc_set_pwmthrs(stepperE##E, value, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }while(0)
|
||||
#define TMC_SAY_PWMTHRS_E(E) tmc_get_pwmthrs(stepperE##E, planner.axis_steps_per_mm[E_AXIS_N(E)])
|
||||
#define TMC_SET_PWMTHRS_E(E) tmc_set_pwmthrs(stepperE##E, value, planner.axis_steps_per_mm[E_AXIS_N(E)])
|
||||
|
||||
bool report = true;
|
||||
const uint8_t index = parser.byteval('I');
|
||||
|
|
|
@ -472,11 +472,11 @@
|
|||
*/
|
||||
#if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1
|
||||
#define XYZE_N (XYZ + E_STEPPERS)
|
||||
#define E_AXIS_N (E_AXIS + extruder)
|
||||
#define E_AXIS_N(E) (E_AXIS + E)
|
||||
#else
|
||||
#undef DISTINCT_E_FACTORS
|
||||
#define XYZE_N XYZE
|
||||
#define E_AXIS_N E_AXIS
|
||||
#define E_AXIS_N(E) E_AXIS
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -1687,7 +1687,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
}
|
||||
#endif // PREVENT_COLD_EXTRUSION
|
||||
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
||||
if (ABS(de * e_factor[extruder]) > (int32_t)axis_steps_per_mm[E_AXIS_N] * (EXTRUDE_MAXLENGTH)) { // It's not important to get max. extrusion length in a precision < 1mm, so save some cycles and cast to int
|
||||
if (ABS(de * e_factor[extruder]) > (int32_t)axis_steps_per_mm[E_AXIS_N(extruder)] * (EXTRUDE_MAXLENGTH)) { // It's not important to get max. extrusion length in a precision < 1mm, so save some cycles and cast to int
|
||||
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
|
||||
#if HAS_POSITION_FLOAT
|
||||
position_float[E_AXIS] = target_float[E_AXIS];
|
||||
|
@ -1985,7 +1985,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
delta_mm[B_AXIS] = db * steps_to_mm[B_AXIS];
|
||||
delta_mm[C_AXIS] = dc * steps_to_mm[C_AXIS];
|
||||
#endif
|
||||
delta_mm[E_AXIS] = esteps_float * steps_to_mm[E_AXIS_N];
|
||||
delta_mm[E_AXIS] = esteps_float * steps_to_mm[E_AXIS_N(extruder)];
|
||||
|
||||
if (block->steps[A_AXIS] < MIN_STEPS_PER_SEGMENT && block->steps[B_AXIS] < MIN_STEPS_PER_SEGMENT && block->steps[C_AXIS] < MIN_STEPS_PER_SEGMENT) {
|
||||
block->millimeters = ABS(delta_mm[E_AXIS]);
|
||||
|
@ -2254,7 +2254,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
#endif
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
if (block->use_advance_lead) {
|
||||
block->advance_speed = (STEPPER_TIMER_RATE) / (extruder_advance_K[active_extruder] * block->e_D_ratio * block->acceleration * axis_steps_per_mm[E_AXIS_N]);
|
||||
block->advance_speed = (STEPPER_TIMER_RATE) / (extruder_advance_K[active_extruder] * block->e_D_ratio * block->acceleration * axis_steps_per_mm[E_AXIS_N(extruder)]);
|
||||
#if ENABLED(LA_DEBUG)
|
||||
if (extruder_advance_K[active_extruder] * block->e_D_ratio * block->acceleration * 2 < SQRT(block->nominal_speed_sqr) * block->e_D_ratio)
|
||||
SERIAL_ECHOLNPGM("More than 2 steps per eISR loop executed.");
|
||||
|
@ -2566,8 +2566,8 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
|
|||
|
||||
// When changing extruders recalculate steps corresponding to the E position
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
if (last_extruder != extruder && axis_steps_per_mm[E_AXIS_N] != axis_steps_per_mm[E_AXIS + last_extruder]) {
|
||||
position[E_AXIS] = LROUND(position[E_AXIS] * axis_steps_per_mm[E_AXIS_N] * steps_to_mm[E_AXIS + last_extruder]);
|
||||
if (last_extruder != extruder && axis_steps_per_mm[E_AXIS_N(extruder)] != axis_steps_per_mm[E_AXIS + last_extruder]) {
|
||||
position[E_AXIS] = LROUND(position[E_AXIS] * axis_steps_per_mm[E_AXIS_N(extruder)] * steps_to_mm[E_AXIS + last_extruder]);
|
||||
last_extruder = extruder;
|
||||
}
|
||||
#endif
|
||||
|
@ -2578,7 +2578,7 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
|
|||
LROUND(a * axis_steps_per_mm[A_AXIS]),
|
||||
LROUND(b * axis_steps_per_mm[B_AXIS]),
|
||||
LROUND(c * axis_steps_per_mm[C_AXIS]),
|
||||
LROUND(e * axis_steps_per_mm[E_AXIS_N])
|
||||
LROUND(e * axis_steps_per_mm[E_AXIS_N(extruder)])
|
||||
};
|
||||
|
||||
#if HAS_POSITION_FLOAT
|
||||
|
|
|
@ -627,22 +627,22 @@ void reset_stepper_drivers() {
|
|||
_TMC_INIT(Z3, planner.axis_steps_per_mm[Z_AXIS]);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E0)
|
||||
_TMC_INIT(E0, planner.axis_steps_per_mm[E_AXIS]);
|
||||
_TMC_INIT(E0, planner.axis_steps_per_mm[E_AXIS_N(0)]);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E1)
|
||||
{ constexpr uint8_t extruder = 1; _TMC_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
|
||||
_TMC_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N(1)]);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E2)
|
||||
{ constexpr uint8_t extruder = 2; _TMC_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
|
||||
_TMC_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N(2)]);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E3)
|
||||
{ constexpr uint8_t extruder = 3; _TMC_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
|
||||
_TMC_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N(3)]);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E4)
|
||||
{ constexpr uint8_t extruder = 4; _TMC_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
|
||||
_TMC_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N(4)]);
|
||||
#endif
|
||||
#if AXIS_IS_TMC(E5)
|
||||
{ constexpr uint8_t extruder = 5; _TMC_INIT(E5, planner.axis_steps_per_mm[E_AXIS_N]); UNUSED(extruder); }
|
||||
_TMC_INIT(E5, planner.axis_steps_per_mm[E_AXIS_N(5)]);
|
||||
#endif
|
||||
|
||||
#if USE_SENSORLESS
|
||||
|
|
Reference in a new issue