Prusa MINI Firmware overview
|
#include <stepper.h>
|
static void | init () |
|
static void | isr () |
|
static void | stepper_pulse_phase_isr () |
|
static uint32_t | stepper_block_phase_isr () |
|
static bool | is_block_busy (const block_t *const block) |
|
static int32_t | position (const AxisEnum axis) |
|
static void | report_positions () |
|
static void | wake_up () |
|
static FORCE_INLINE void | quick_stop () |
|
static FORCE_INLINE bool | motor_direction (const AxisEnum axis) |
|
static FORCE_INLINE bool | axis_is_moving (const AxisEnum axis) |
|
static FORCE_INLINE uint8_t | movement_extruder () |
|
static void | endstop_triggered (const AxisEnum axis) |
|
static int32_t | triggered_position (const AxisEnum axis) |
|
static void | digitalPotWrite (const int16_t address, const int16_t value) |
|
static void | digipot_current (const uint8_t driver, const int16_t current) |
|
static void | microstep_ms (const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3) |
|
static void | microstep_mode (const uint8_t driver, const uint8_t stepping) |
|
static void | microstep_readings () |
|
static FORCE_INLINE void | set_separate_multi_axis (const bool state) |
|
static FORCE_INLINE void | set_z_lock (const bool state) |
|
static FORCE_INLINE void | set_z2_lock (const bool state) |
|
static void | set_position (const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e) |
|
static void | set_position (const xyze_long_t &abce) |
|
static void | set_axis_position (const AxisEnum a, const int32_t &v) |
|
static void | set_directions () |
|
◆ Stepper()
◆ init()
1995 const float motor_current[] = MOTOR_CURRENT;
1996 unsigned int digipot_motor = 0;
1998 digipot_motor = 255 * (motor_current[
i] / 2.5);
2001 #endif//MB(ALLIGATOR)
2017 #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_DIR
2023 #if Z_MULTI_STEPPER_DRIVERS && HAS_Z2_DIR
2026 #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) && HAS_Z3_DIR
2053 #if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS) && HAS_X2_ENABLE
2061 #if ENABLED(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE
2069 #if Z_MULTI_STEPPER_DRIVERS && HAS_Z2_ENABLE
2073 #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS) && HAS_Z3_ENABLE
2103 #define _STEP_INIT(AXIS) AXIS ##_STEP_INIT
2104 #define _WRITE_STEP(AXIS, HIGHLOW) AXIS ##_STEP_WRITE(HIGHLOW)
2105 #define _DISABLE(AXIS) disable_## AXIS()
2107 #define AXIS_INIT(AXIS, PIN) \
2109 _WRITE_STEP(AXIS, _INVERT_STEP_PIN(PIN)); \
2112 #define E_AXIS_INIT(NUM) AXIS_INIT(E## NUM, E)
2116 #if EITHER(X_DUAL_STEPPER_DRIVERS, DUAL_X_CARRIAGE)
2124 #if ENABLED(Y_DUAL_STEPPER_DRIVERS)
2132 #if Z_MULTI_STEPPER_DRIVERS
2136 #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
2143 #if E_STEPPERS > 0 && HAS_E0_STEP
2146 #if E_STEPPERS > 1 && HAS_E1_STEP
2149 #if E_STEPPERS > 2 && HAS_E2_STEP
2152 #if E_STEPPERS > 3 && HAS_E3_STEP
2155 #if E_STEPPERS > 4 && HAS_E4_STEP
2158 #if E_STEPPERS > 5 && HAS_E5_STEP
2162 #if DISABLED(I2S_STEPPER_STREAM)
2169 last_direction_bits = 0
2176 #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM
2177 #if HAS_MOTOR_CURRENT_PWM
◆ isr()
This needs to avoid a race-condition caused by interleaving of interrupts required by both the LA and Stepper algorithms.
Assume the following tick times for stepper pulses: Stepper ISR (S): 1 1000 2000 3000 4000 Linear Adv. (E): 10 1010 2010 3010 4010
The current algorithm tries to interleave them, giving: 1:S 10:E 1000:S 1010:E 2000:S 2010:E 3000:S 3010:E 4000:S 4010:E
Ideal timing would yield these delta periods: 1:S 9:E 990:S 10:E 990:S 10:E 990:S 10:E 990:S 10:E
But, since each event must fire an ISR with a minimum duration, the minimum delta might be 900, so deltas under 900 get rounded up: 900:S d900:E d990:S d900:E d990:S d900:E d990:S d900:E d990:S d900:E
It works, but divides the speed of all motors by half, leading to a sudden reduction to 1/2 speed! Such jumps in speed lead to lost steps (not even accounting for double/quad stepping, which makes it even worse).
The following section must be done with global interrupts disabled. We want nothing to interrupt it, as that could mess the calculations we do for the next value to program in the period register of the stepper timer and lead to skipped ISRs (if the value we happen to program is less than the current count due to something preempting between the read and the write of the new period value).
Get the current tick value + margin Assuming at least 6µs between calls to this ISR... On AVR the ISR epilogue+prologue is estimated at 100 instructions - Give 8µs as margin On ARM the ISR epilogue+prologue is estimated at 20 instructions - Give 1µs as margin
NB: If for some reason the stepper monopolizes the MPU, eventually the timer will wrap around (and so will 'next_isr_ticks'). So, limit the loop to 10 iterations. Beyond that, there's no way to ensure correct pulse timing, since the MCU isn't fast enough.
1289 #if ENABLED(LIN_ADVANCE)
1291 if (!nextAdvanceISR) nextAdvanceISR = Stepper::advance_isr();
1300 #if ENABLED(LIN_ADVANCE)
1301 _MIN(nextAdvanceISR, nextMainISR)
1311 nextMainISR -= interval;
1313 #if ENABLED(LIN_ADVANCE)
1315 if (nextAdvanceISR != LA_ADV_NEVER) nextAdvanceISR -= interval;
1342 next_isr_ticks += interval;
1375 if (!--max_loops) next_isr_ticks = min_ticks;
1378 }
while (next_isr_ticks < min_ticks);
◆ stepper_pulse_phase_isr()
void Stepper::stepper_pulse_phase_isr |
( |
| ) |
|
|
static |
This phase of the ISR should ONLY create the pulses for the steppers. This prevents jitter caused by the interval between the start of the interrupt and the start of the pulses. DON'T add any logic ahead of the call to this method that might cause variation in the timing. The aim is to keep pulse timing as regular as possible.
1400 if (abort_current_block) {
1401 abort_current_block =
false;
1402 if (current_block) {
1404 current_block =
nullptr;
1410 if (!current_block)
return;
1413 const uint32_t pending_events = step_event_count - step_events_completed;
1414 uint8_t events_to_do =
_MIN(pending_events, steps_per_isr);
1417 step_events_completed += events_to_do;
1427 #define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP
1428 #define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN
1431 #define PULSE_START(AXIS) do{ \
1432 delta_error[_AXIS(AXIS)] += advance_dividend[_AXIS(AXIS)]; \
1433 if (delta_error[_AXIS(AXIS)] >= 0) { \
1434 _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), 0); \
1435 count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
1440 #define PULSE_STOP(AXIS) do { \
1441 if (delta_error[_AXIS(AXIS)] >= 0) { \
1442 delta_error[_AXIS(AXIS)] -= advance_divisor; \
1443 _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), 0); \
1460 #if EITHER(LIN_ADVANCE, MIXING_EXTRUDER)
1461 delta_error.
e += advance_dividend.
e;
1462 if (delta_error.
e >= 0) {
1468 #if ENABLED(LIN_ADVANCE)
1469 delta_error.
e -= advance_divisor;
1472 #else // !LIN_ADVANCE && MIXING_EXTRUDER
1478 #else // !LIN_ADVANCE && !MIXING_EXTRUDER
1484 #if ENABLED(I2S_STEPPER_STREAM)
1489 #if MINIMUM_STEPPER_PULSE && DISABLED(I2S_STEPPER_STREAM)
1495 if (
signed(added_step_ticks) > 0) pulse_end +=
hal_timer_t(added_step_ticks);
1508 #if DISABLED(LIN_ADVANCE)
1509 #if ENABLED(MIXING_EXTRUDER)
1510 if (delta_error.
e >= 0) {
1511 delta_error.
e -= advance_divisor;
1514 #else // !MIXING_EXTRUDER
1519 #endif // !LIN_ADVANCE
1528 #if MINIMUM_STEPPER_PULSE
1534 }
while (events_to_do);
◆ stepper_block_phase_isr()
uint32_t Stepper::stepper_block_phase_isr |
( |
| ) |
|
|
static |
Head direction in -X axis for CoreXY and CoreXZ bots.
If steps differ, both axes are moving. If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z, handled below) If DeltaA == DeltaB, the movement is only in the 1st axis (X)
Head direction in -Y axis for CoreXY / CoreYZ bots.
If steps differ, both axes are moving If DeltaA == DeltaB, the movement is only in the 1st axis (X or Y) If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z)
Head direction in -Z axis for CoreXZ or CoreYZ bots.
If steps differ, both axes are moving If DeltaA == DeltaB, the movement is only in the 1st axis (X or Y, already handled above) If DeltaA == -DeltaB, the movement is only in the 2nd axis (Z)
1547 if (current_block) {
1550 if (step_events_completed >= step_event_count) {
1551 #ifdef FILAMENT_RUNOUT_DISTANCE_MM
1555 current_block =
nullptr;
1562 if (step_events_completed <= accelerate_until) {
1564 #if ENABLED(S_CURVE_ACCELERATION)
1566 uint32_t acc_step_rate =
1567 acceleration_time < current_block->acceleration_time
1568 ? _eval_bezier_curve(acceleration_time)
1569 : current_block->cruise_rate;
1578 interval = calc_timer_interval(acc_step_rate, oversampling_factor, &steps_per_isr);
1579 acceleration_time += interval;
1581 #if ENABLED(LIN_ADVANCE)
1582 if (LA_use_advance_lead) {
1584 if (LA_steps && LA_isr_rate != current_block->advance_speed) nextAdvanceISR = 0;
1586 else if (LA_steps) nextAdvanceISR = 0;
1587 #endif // LIN_ADVANCE
1590 else if (step_events_completed > decelerate_after) {
1593 #if ENABLED(S_CURVE_ACCELERATION)
1595 if (!bezier_2nd_half) {
1597 _calc_bezier_curve_coeffs(current_block->cruise_rate, current_block->
final_rate, current_block->deceleration_time_inverse);
1598 bezier_2nd_half =
true;
1600 step_rate = current_block->cruise_rate;
1604 step_rate = deceleration_time < current_block->deceleration_time
1605 ? _eval_bezier_curve(deceleration_time)
1606 : current_block->final_rate;
1612 if (step_rate < acc_step_rate) {
1613 step_rate = acc_step_rate - step_rate;
1623 interval = calc_timer_interval(step_rate, oversampling_factor, &steps_per_isr);
1624 deceleration_time += interval;
1626 #if ENABLED(LIN_ADVANCE)
1627 if (LA_use_advance_lead) {
1629 if (step_events_completed <= decelerate_after + steps_per_isr || (LA_steps && LA_isr_rate != current_block->advance_speed)) {
1631 LA_isr_rate = current_block->advance_speed;
1634 else if (LA_steps) nextAdvanceISR = 0;
1635 #endif // LIN_ADVANCE
1640 #if ENABLED(LIN_ADVANCE)
1642 if (LA_steps && LA_isr_rate != current_block->advance_speed) nextAdvanceISR = 0;
1646 if (ticks_nominal < 0) {
1648 ticks_nominal = calc_timer_interval(current_block->
nominal_rate, oversampling_factor, &steps_per_isr);
1652 interval = ticks_nominal;
1659 if (!current_block) {
1666 _set_position(current_block->
position);
1678 #if ENABLED(POWER_LOSS_RECOVERY)
1686 #define S_(N) current_block->steps[CORE_AXIS_##N]
1687 #define D_(N) TEST(current_block->direction_bits, CORE_AXIS_##N)
1690 #if CORE_IS_XY || CORE_IS_XZ
1698 #if EITHER(COREXY, COREXZ)
1703 #define X_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) X_CMP D_(2)) )
1705 #define X_MOVE_TEST !!current_block->steps.a
1708 #if CORE_IS_XY || CORE_IS_YZ
1716 #if EITHER(COREYX, COREYZ)
1721 #define Y_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) Y_CMP D_(2)) )
1723 #define Y_MOVE_TEST !!current_block->steps.b
1726 #if CORE_IS_XZ || CORE_IS_YZ
1734 #if EITHER(COREZX, COREZY)
1739 #define Z_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) Z_CMP D_(2)) )
1741 #define Z_MOVE_TEST !!current_block->steps.c
1752 axis_did_move = axis_bits;
1755 acceleration_time = deceleration_time = 0;
1759 #if ENABLED(ADAPTIVE_STEP_SMOOTHING)
1767 oversampling_factor = oversampling;
1774 delta_error = -int32_t(step_event_count);
1777 advance_dividend = current_block->
steps << 1;
1778 advance_divisor = step_event_count << 1;
1781 step_events_completed = 0;
1787 #if ENABLED(MIXING_EXTRUDER)
1792 stepper_extruder = current_block->
extruder;
1796 #if ENABLED(LIN_ADVANCE)
1797 #if DISABLED(MIXING_EXTRUDER) && E_STEPPERS > 1
1799 if (stepper_extruder != last_moved_extruder) LA_current_adv_steps = 0;
1802 if ((LA_use_advance_lead = current_block->use_advance_lead)) {
1803 LA_final_adv_steps = current_block->final_adv_steps;
1804 LA_max_adv_steps = current_block->max_adv_steps;
1807 LA_isr_rate = current_block->advance_speed;
1809 else LA_isr_rate = LA_ADV_NEVER;
1818 || stepper_extruder != last_moved_extruder
1824 last_moved_extruder = stepper_extruder;
1838 #if ENABLED(Z_LATE_ENABLE)
1848 #if DISABLED(S_CURVE_ACCELERATION)
1853 #if ENABLED(S_CURVE_ACCELERATION)
1855 _calc_bezier_curve_coeffs(current_block->
initial_rate, current_block->cruise_rate, current_block->acceleration_time_inverse);
1857 bezier_2nd_half =
false;
1861 interval = calc_timer_interval(current_block->
initial_rate, oversampling_factor, &steps_per_isr);
◆ is_block_busy()
1970 #define sw_barrier() asm volatile("": : :"memory");
1977 block_t* vold, *vnew = current_block;
1981 vnew = current_block;
1983 }
while (vold != vnew);
1985 block_t *vnew = current_block;
1989 return block == vnew;
◆ position()
Get a stepper's position in steps.
2222 const int32_t v = count_position[axis];
◆ report_positions()
void Stepper::report_positions |
( |
| ) |
|
|
static |
2290 #if CORE_IS_XY || CORE_IS_XZ || ENABLED(DELTA) || IS_SCARA
2295 #if CORE_IS_XZ || CORE_IS_YZ || ENABLED(DELTA)
◆ wake_up()
void Stepper::wake_up |
( |
| ) |
|
|
static |
◆ quick_stop()
375 { abort_current_block =
true; }
◆ motor_direction()
378 {
return TEST(last_direction_bits, axis); }
◆ axis_is_moving()
381 {
return TEST(axis_did_move, axis); }
◆ movement_extruder()
387 + last_moved_extruder
◆ endstop_triggered()
2241 endstops_trigsteps[axis] = (
2243 (axis == CORE_AXIS_2
2244 ? CORESIGN(count_position[CORE_AXIS_1] - count_position[CORE_AXIS_2])
2245 : count_position[CORE_AXIS_1] + count_position[CORE_AXIS_2]
2248 count_position[axis]
◆ triggered_position()
2266 const int32_t v = endstops_trigsteps[axis];
◆ digitalPotWrite()
static void Stepper::digitalPotWrite |
( |
const int16_t |
address, |
|
|
const int16_t |
value |
|
) |
| |
|
static |
◆ digipot_current()
Software-controlled Stepper Motor Current
2502 #elif HAS_MOTOR_CURRENT_PWM
2504 if (!initialized)
return;
2506 if (
WITHIN(driver, 0,
COUNT(motor_current_setting) - 1))
2507 motor_current_setting[driver] = current;
2509 #define _WRITE_CURRENT_PWM(P) analogWrite(pin_t(MOTOR_CURRENT_PWM_## P ##_PIN), 255L * current / (MOTOR_CURRENT_PWM_RANGE))
2512 #if PIN_EXISTS(MOTOR_CURRENT_PWM_X)
2513 _WRITE_CURRENT_PWM(
X);
2515 #if PIN_EXISTS(MOTOR_CURRENT_PWM_Y)
2516 _WRITE_CURRENT_PWM(
Y);
2518 #if PIN_EXISTS(MOTOR_CURRENT_PWM_XY)
2519 _WRITE_CURRENT_PWM(
XY);
2523 #if PIN_EXISTS(MOTOR_CURRENT_PWM_Z)
2524 _WRITE_CURRENT_PWM(
Z);
2528 #if PIN_EXISTS(MOTOR_CURRENT_PWM_E)
2529 _WRITE_CURRENT_PWM(E);
2531 #if PIN_EXISTS(MOTOR_CURRENT_PWM_E0)
2532 _WRITE_CURRENT_PWM(
E0);
2534 #if PIN_EXISTS(MOTOR_CURRENT_PWM_E1)
2535 _WRITE_CURRENT_PWM(
E1);
◆ microstep_ms()
2702 if (ms1 >= 0)
switch (driver) {
2703 #if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
2705 #if HAS_X_MICROSTEPS
2708 #if HAS_X2_MICROSTEPS
2713 #if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
2715 #if HAS_Y_MICROSTEPS
2718 #if HAS_Y2_MICROSTEPS
2719 WRITE(Y2_MS1_PIN, ms1);
2723 #if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS
2725 #if HAS_Z_MICROSTEPS
2728 #if HAS_Z2_MICROSTEPS
2729 WRITE(Z2_MS1_PIN, ms1);
2731 #if HAS_Z3_MICROSTEPS
2732 WRITE(Z3_MS1_PIN, ms1);
2736 #if HAS_E0_MICROSTEPS
2739 #if HAS_E1_MICROSTEPS
2742 #if HAS_E2_MICROSTEPS
2745 #if HAS_E3_MICROSTEPS
2748 #if HAS_E4_MICROSTEPS
2751 #if HAS_E5_MICROSTEPS
2755 if (ms2 >= 0)
switch (driver) {
2756 #if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
2758 #if HAS_X_MICROSTEPS
2761 #if HAS_X2_MICROSTEPS
2766 #if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
2768 #if HAS_Y_MICROSTEPS
2771 #if HAS_Y2_MICROSTEPS
2772 WRITE(Y2_MS2_PIN, ms2);
2776 #if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS
2778 #if HAS_Z_MICROSTEPS
2781 #if HAS_Z2_MICROSTEPS
2782 WRITE(Z2_MS2_PIN, ms2);
2784 #if HAS_Z3_MICROSTEPS
2785 WRITE(Z3_MS2_PIN, ms2);
2789 #if HAS_E0_MICROSTEPS
2792 #if HAS_E1_MICROSTEPS
2795 #if HAS_E2_MICROSTEPS
2798 #if HAS_E3_MICROSTEPS
2801 #if HAS_E4_MICROSTEPS
2804 #if HAS_E5_MICROSTEPS
2808 if (ms3 >= 0)
switch (driver) {
2809 #if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS
2811 #if HAS_X_MICROSTEPS && PIN_EXISTS(X_MS3)
2814 #if HAS_X2_MICROSTEPS && PIN_EXISTS(X2_MS3)
2819 #if HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS
2821 #if HAS_Y_MICROSTEPS && PIN_EXISTS(Y_MS3)
2824 #if HAS_Y2_MICROSTEPS && PIN_EXISTS(Y2_MS3)
2825 WRITE(Y2_MS3_PIN, ms3);
2829 #if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS
2831 #if HAS_Z_MICROSTEPS && PIN_EXISTS(Z_MS3)
2834 #if HAS_Z2_MICROSTEPS && PIN_EXISTS(Z2_MS3)
2835 WRITE(Z2_MS3_PIN, ms3);
2837 #if HAS_Z3_MICROSTEPS && PIN_EXISTS(Z3_MS3)
2838 WRITE(Z3_MS3_PIN, ms3);
2842 #if HAS_E0_MICROSTEPS && PIN_EXISTS(E0_MS3)
2845 #if HAS_E1_MICROSTEPS && PIN_EXISTS(E1_MS3)
2848 #if HAS_E2_MICROSTEPS && PIN_EXISTS(E2_MS3)
2851 #if HAS_E3_MICROSTEPS && PIN_EXISTS(E3_MS3)
2854 #if HAS_E4_MICROSTEPS && PIN_EXISTS(E4_MS3)
2857 #if HAS_E5_MICROSTEPS && PIN_EXISTS(E5_MS3)
◆ microstep_mode()
2864 switch (stepping_mode) {
2886 #if HAS_MICROSTEP128
◆ microstep_readings()
void Stepper::microstep_readings |
( |
| ) |
|
|
static |
2896 #if HAS_X_MICROSTEPS
2899 #if PIN_EXISTS(X_MS3)
2903 #if HAS_Y_MICROSTEPS
2907 #if PIN_EXISTS(Y_MS3)
2911 #if HAS_Z_MICROSTEPS
2915 #if PIN_EXISTS(Z_MS3)
2919 #if HAS_E0_MICROSTEPS
2923 #if PIN_EXISTS(E0_MS3)
2927 #if HAS_E1_MICROSTEPS
2931 #if PIN_EXISTS(E1_MS3)
2935 #if HAS_E2_MICROSTEPS
2939 #if PIN_EXISTS(E2_MS3)
2943 #if HAS_E3_MICROSTEPS
2947 #if PIN_EXISTS(E3_MS3)
2951 #if HAS_E4_MICROSTEPS
2955 #if PIN_EXISTS(E4_MS3)
2959 #if HAS_E5_MICROSTEPS
2963 #if PIN_EXISTS(E5_MS3)
◆ set_separate_multi_axis()
◆ set_z_lock()
421 { locked_Z_motor =
state; }
◆ set_z2_lock()
422 { locked_Z2_motor =
state; }
◆ set_position() [1/2]
441 _set_position(
a,
b, c, e);
◆ set_position() [2/2]
◆ set_axis_position()
456 count_position[
a] = v;
◆ set_directions()
void Stepper::set_directions |
( |
| ) |
|
|
static |
Set the stepper direction of each axis
COREXY: X_AXIS=A_AXIS and Y_AXIS=B_AXIS COREXZ: X_AXIS=A_AXIS and Z_AXIS=C_AXIS COREYZ: Y_AXIS=B_AXIS and Z_AXIS=C_AXIS
356 #if HAS_DRIVER(L6470)
360 #if MINIMUM_STEPPER_PRE_DIR_DELAY > 0
364 #define SET_STEP_DIR(A) \
365 if (motor_direction(_AXIS(A))) { \
366 A##_APPLY_DIR(INVERT_## A##_DIR, false); \
367 count_direction[_AXIS(A)] = -1; \
370 A##_APPLY_DIR(!INVERT_## A##_DIR, false); \
371 count_direction[_AXIS(A)] = 1; \
386 #if DISABLED(LIN_ADVANCE)
387 #if ENABLED(MIXING_EXTRUDER)
392 count_direction.
e = -1;
396 count_direction.
e = 1;
401 count_direction.
e = -1;
405 count_direction.
e = 1;
408 #endif // !LIN_ADVANCE
410 #if HAS_DRIVER(L6470)
414 for (
uint8_t j = 1; j <= L6470::chain[0]; j++)
415 L6470_buf[j] = dSPIN_NOP;
416 L6470.transfer(L6470_buf, L6470::chain[0]);
417 L6470.transfer(L6470_buf, L6470::chain[0]);
418 L6470.transfer(L6470_buf, L6470::chain[0]);
424 for (
uint8_t j = 1; j <= L6470::chain[0]; j++)
427 L6470.transfer(L6470_buf, L6470::chain[0]);
432 #if MINIMUM_STEPPER_POST_DIR_DELAY > 0
◆ separate_multi_axis
bool Stepper::separate_multi_axis = false |
|
static |
#define X2_DIR_INIT
Definition: indirection.h:109
#define WITHIN(N, L, H)
Definition: macros.h:195
T z
Definition: types.h:286
#define E3_DIR_INIT
Definition: indirection.h:241
#define Y_ENABLE_ON
Definition: Configuration_A3ides_2209_MINI.h:927
#define SERIAL_CHAR(x)
Definition: serial.h:69
static bool separate_multi_axis
Definition: stepper.h:231
#define STEP_MULTIPLY(A, B)
Definition: stepper.cpp:1259
#define NOLESS(v, n)
Definition: macros.h:127
static FORCE_INLINE void discard_current_block()
Definition: planner.h:820
#define X_MS3_PIN
Definition: pins.h:559
#define E5_DIR_INIT
Definition: indirection.h:275
T z
Definition: types.h:383
static void synchronize()
Definition: planner.cpp:1556
#define INVERT_Y_STEP_PIN
Definition: Configuration_A3ides_2209_MINI_adv.h:501
#define MIN_STEP_ISR_FREQUENCY
Definition: stepper.h:221
#define Z_ENABLE_INIT
Definition: indirection.h:86
volatile uint8_t flag
Definition: planner.h:97
#define MSG_COUNT_X
Definition: language.h:172
T x
Definition: types.h:286
#define X2_MS1_PIN
Definition: pins.h:989
#define PULSE_TIMER_NUM
Definition: HAL.h:129
#define E3_MS2_PIN
Definition: pins.h:610
static job_recovery_info_t info
Definition: power_loss_recovery.h:111
#define X2_ENABLE_WRITE(STATE)
Definition: indirection.h:105
#define Z_ENABLE_WRITE(STATE)
Definition: indirection.h:87
#define E5_ENABLE_INIT
Definition: indirection.h:270
#define E5_MS1_PIN
Definition: pins.h:625
#define ADDED_STEP_TICKS
Definition: stepper.h:180
static volatile bool spi_abort
Definition: L6470_Marlin.h:44
#define E1_ENABLE_WRITE(STATE)
Definition: indirection.h:203
#define X2_STEP_INIT
Definition: indirection.h:113
Definition: L6470_Marlin.h:30
#define INVERT_E_STEP_PIN
Definition: Configuration_A3ides_2209_MINI_adv.h:503
#define X_MS2_PIN
Definition: pins.h:556
#define PULSE_START(AXIS)
#define Y_DIR_INIT
Definition: indirection.h:74
#define MSG_COUNT_A
Definition: language.h:173
#define INVERT_X_DIR
Definition: Configuration_A3ides_2209_MINI.h:948
#define E4_DIR_INIT
Definition: indirection.h:258
#define E_ENABLE_ON
Definition: Configuration_A3ides_2209_MINI.h:929
#define SERIAL_ECHOPAIR(V...)
Definition: serial.h:114
#define E0_MS1_PIN
Definition: pins.h:580
Definition: L6470_Marlin.h:30
static FORCE_INLINE bool motor_direction(const AxisEnum axis)
Definition: stepper.h:378
T e
Definition: types.h:383
#define Z_MS2_PIN
Definition: pins.h:574
#define Z2_STEP_INIT
Definition: indirection.h:153
#define Z2_STEP_WRITE(STATE)
Definition: indirection.h:155
#define Z3_ENABLE_WRITE(STATE)
Definition: indirection.h:166
uint8_t i
Definition: screen_test_graph.c:72
#define _MIN(V...)
Definition: macros.h:333
Definition: L6470_Marlin.h:30
#define X_ENABLE_INIT
Definition: indirection.h:52
static volatile fsensor_t state
Definition: filament_sensor.c:23
#define Z2_ENABLE_INIT
Definition: indirection.h:144
#define enable_Z()
Definition: Marlin.h:142
#define X_MS1_PIN
Definition: pins.h:553
#define X_ENABLE_ON
Definition: Configuration_A3ides_2209_MINI.h:926
#define Z3_DIR_INIT
Definition: indirection.h:170
PrintJobRecovery recovery
static void setValue(const uint8_t channel, const uint8_t value)
#define SERIAL_ECHOLN(x)
Definition: serial.h:72
abce_ulong_t steps
Definition: planner.h:107
#define X_ENABLE_WRITE(STATE)
Definition: indirection.h:53
#define STEPPER_ISR_ENABLED()
Definition: HAL.h:143
#define Y_ENABLE_INIT
Definition: indirection.h:69
#define INVERT_Z_STEP_PIN
Definition: Configuration_A3ides_2209_MINI_adv.h:502
#define STEP_TIMER_NUM
Definition: HAL.h:127
FORCE_INLINE void HAL_timer_start(const uint8_t timer_num, const uint32_t)
Definition: HAL.h:149
static uint8_t dir_commands[MAX_L6470]
Definition: L6470_Marlin.h:41
#define E2_DIR_INIT
Definition: indirection.h:224
#define E0_ENABLE_INIT
Definition: indirection.h:185
SpindleLaser cutter
Definition: spindle_laser.cpp:33
#define E1_ENABLE_INIT
Definition: indirection.h:202
Definition: L6470_Marlin.h:30
Definition: L6470_Marlin.h:30
#define NOMORE(v, n)
Definition: macros.h:133
#define X2_ENABLE_INIT
Definition: indirection.h:104
#define Y_MS1_PIN
Definition: pins.h:562
#define Z2_DIR_INIT
Definition: indirection.h:149
cutter_power_t cutter_power
Definition: planner.h:153
#define NORM_E_DIR(E)
Definition: indirection.h:396
#define DISABLE_ISRS()
Definition: HAL.h:53
#define E2_MS3_PIN
Definition: pins.h:604
#define E3_MS1_PIN
Definition: pins.h:607
static void block_completed(const block_t *const b)
Definition: runout.h:94
#define Z3_STEP_WRITE(STATE)
Definition: indirection.h:176
#define E5_MS2_PIN
Definition: pins.h:628
#define E1_MS1_PIN
Definition: pins.h:589
T a
Definition: types.h:384
abce_long_t position
Definition: planner.h:108
volatile uint32_t sdpos
Definition: power_loss_recovery.h:97
T c
Definition: types.h:384
#define Z_MS1_PIN
Definition: pins.h:571
#define E5_ENABLE_WRITE(STATE)
Definition: indirection.h:271
#define Z3_ENABLE_INIT
Definition: indirection.h:165
#define Y_MS3_PIN
Definition: pins.h:568
#define COUNT(a)
Definition: macros.h:200
T b
Definition: types.h:384
#define E4_MS2_PIN
Definition: pins.h:619
#define E4_ENABLE_WRITE(STATE)
Definition: indirection.h:254
#define E2_MS2_PIN
Definition: pins.h:601
#define INVERT_X_STEP_PIN
Definition: Configuration_A3ides_2209_MINI_adv.h:500
uint32_t acceleration_rate
Definition: planner.h:133
#define ENABLE_STEPPER_DRIVER_INTERRUPT()
Definition: HAL.h:141
static void set_directions()
Definition: stepper.cpp:354
#define X2_MS3_PIN
Definition: pins.h:995
#define DISABLED(V...)
Definition: macros.h:178
uint32_t final_rate
Definition: planner.h:147
#define E2_MS1_PIN
Definition: pins.h:598
#define Z3_STEP_INIT
Definition: indirection.h:174
#define HAL_TIMER_TYPE_MAX
Definition: HAL.h:63
#define HAL_timer_get_count(timer)
Definition: HAL.h:188
#define XY
Definition: macros.h:28
#define Y2_ENABLE_WRITE(STATE)
Definition: indirection.h:124
#define WRITE(IO, V)
Definition: fastio.h:96
static void microstep_ms(const uint8_t driver, const int8_t ms1, const int8_t ms2, const int8_t ms3)
Definition: stepper.cpp:2701
#define SERIAL_ECHOPGM(S)
Definition: serial.h:173
#define E2_ENABLE_INIT
Definition: indirection.h:219
#define E0_DIR_INIT
Definition: indirection.h:190
#define MINIMUM_STEPPER_PRE_DIR_DELAY
Definition: Conditionals_post.h:571
static void digitalPotWrite(const int16_t address, const int16_t value)
#define SERIAL_ECHOLNPAIR(V...)
Definition: serial.h:144
#define E0_MS2_PIN
Definition: pins.h:583
list a
Definition: createSpeedLookupTable.py:29
static FORCE_INLINE void quick_stop()
Definition: stepper.h:375
#define X_DIR_INIT
Definition: indirection.h:57
static void apply_power(const cutter_power_t inpow)
Definition: spindle_laser.cpp:64
#define Y2_STEP_INIT
Definition: indirection.h:132
#define Z_MS3_PIN
Definition: pins.h:577
#define MIXER_STEPPER_LOOP(VAR)
Definition: mixing.h:68
#define MINIMUM_STEPPER_POST_DIR_DELAY
Definition: Conditionals_post.h:566
#define Y2_DIR_INIT
Definition: indirection.h:128
const uint8_t[]
Definition: 404_html.c:3
static void stepper_pulse_phase_isr()
Definition: stepper.cpp:1397
uint8_t direction_bits
Definition: planner.h:136
#define DISABLE_STEPPER_DRIVER_INTERRUPT()
Definition: HAL.h:142
#define _BV(bit)
Definition: wiring_constants.h:99
#define INVERT_Y_DIR
Definition: Configuration_A3ides_2209_MINI.h:949
#define X2_MS2_PIN
Definition: pins.h:992
static bool spi_active
Definition: L6470_Marlin.h:45
T y
Definition: types.h:286
uint32_t initial_rate
Definition: planner.h:147
#define Z_DIR_INIT
Definition: indirection.h:91
#define MAX_STEP_ISR_FREQUENCY_1X
Definition: stepper.h:218
#define E5_MS3_PIN
Definition: pins.h:631
#define X2_STEP_WRITE(STATE)
Definition: indirection.h:115
#define SERIAL_ERROR_MSG(S)
Definition: serial.h:184
#define E3_ENABLE_INIT
Definition: indirection.h:236
#define Y_MS2_PIN
Definition: pins.h:565
uint32_t step_event_count
Definition: planner.h:110
#define E3_ENABLE_WRITE(STATE)
Definition: indirection.h:237
#define REV_E_DIR(E)
Definition: indirection.h:397
#define E4_MS3_PIN
Definition: pins.h:622
#define STEPPER_TIMER_TICKS_PER_US
Definition: HAL.h:135
#define Y2_STEP_WRITE(STATE)
Definition: indirection.h:134
#define E2_ENABLE_WRITE(STATE)
Definition: indirection.h:220
#define EXTRUDERS
Definition: Configuration_A3ides_2209_MINI.h:148
#define E4_ENABLE_INIT
Definition: indirection.h:253
static FORCE_INLINE uint8_t get_next_stepper()
Definition: mixing.h:248
#define E_STEP_WRITE(E, V)
Definition: indirection.h:395
#define HIGH
Definition: wiring_constants.h:71
#define E3_MS3_PIN
Definition: pins.h:613
uint32_t decelerate_after
Definition: planner.h:123
#define E4_MS1_PIN
Definition: pins.h:616
static FORCE_INLINE uint8_t get_stepper()
Definition: mixing.h:247
#define HAL_timer_set_compare(timer, compare)
Definition: HAL.h:186
#define E0_MS3_PIN
Definition: pins.h:586
#define INVERT_Z_DIR
Definition: Configuration_A3ides_2209_MINI.h:950
uint32_t nominal_rate
Definition: planner.h:147
#define MIXER_STEPPER_SETUP()
Definition: mixing.h:73
#define TEST(n, b)
Definition: macros.h:81
#define HAS_DRIVER(T)
Definition: drivers.h:74
#define DELAY_NS(x)
Definition: Delay.h:172
static void update()
Definition: endstops.cpp:496
#define Y2_ENABLE_INIT
Definition: indirection.h:123
#define hal_timer_t
Definition: timers.h:33
#define Y_ENABLE_WRITE(STATE)
Definition: indirection.h:70
static block_t * get_current_block()
Definition: planner.h:769
#define Z_ENABLE_ON
Definition: Configuration_A3ides_2209_MINI.h:928
#define E0_ENABLE_WRITE(STATE)
Definition: indirection.h:186
#define Z2_ENABLE_WRITE(STATE)
Definition: indirection.h:145
#define SBI(A, B)
Definition: macros.h:85
#define ENABLE_ISRS()
Definition: HAL.h:52
Definition: L6470_Marlin.h:30
list b
Definition: createSpeedLookupTable.py:30
#define E1_MS2_PIN
Definition: pins.h:592
#define DIGIPOT_CHANNELS
Definition: pins_RAMBO.h:111
#define READ(IO)
Definition: fastio.h:95
uint16_t hal_timer_t
Definition: HAL.h:62
uint32_t accelerate_until
Definition: planner.h:123
Endstops endstops
Definition: endstops.cpp:51
#define AXIS_INIT(AXIS, PIN)
static constexpr uint8_t extruder
Definition: planner.h:115
#define E1_DIR_INIT
Definition: indirection.h:207
static void set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e)
Definition: stepper.h:437
#define E1_MS3_PIN
Definition: pins.h:595
static uint32_t stepper_block_phase_isr()
Definition: stepper.cpp:1541
Planner planner
Definition: planner.cpp:111
#define STEPPER_TIMER_RATE
Definition: HAL.h:133
#define MIN_PULSE_TICKS
Definition: stepper.h:176