🎨 Various multi-axis patches (#22823)

This commit is contained in:
Scott Lahteine 2021-09-23 10:01:37 -05:00 committed by Scott Lahteine
parent 3deb54d0fd
commit 2c30b75268
20 changed files with 174 additions and 127 deletions

View File

@ -794,18 +794,18 @@
#define ENDSTOPPULLUPS
#if DISABLED(ENDSTOPPULLUPS)
// Disable ENDSTOPPULLUPS to set pullups individually
//#define ENDSTOPPULLUP_XMAX
//#define ENDSTOPPULLUP_YMAX
//#define ENDSTOPPULLUP_ZMAX
//#define ENDSTOPPULLUP_IMAX
//#define ENDSTOPPULLUP_JMAX
//#define ENDSTOPPULLUP_KMAX
//#define ENDSTOPPULLUP_XMIN
//#define ENDSTOPPULLUP_YMIN
//#define ENDSTOPPULLUP_ZMIN
//#define ENDSTOPPULLUP_IMIN
//#define ENDSTOPPULLUP_JMIN
//#define ENDSTOPPULLUP_KMIN
//#define ENDSTOPPULLUP_XMAX
//#define ENDSTOPPULLUP_YMAX
//#define ENDSTOPPULLUP_ZMAX
//#define ENDSTOPPULLUP_IMAX
//#define ENDSTOPPULLUP_JMAX
//#define ENDSTOPPULLUP_KMAX
//#define ENDSTOPPULLUP_ZMIN_PROBE
#endif
@ -813,18 +813,18 @@
//#define ENDSTOPPULLDOWNS
#if DISABLED(ENDSTOPPULLDOWNS)
// Disable ENDSTOPPULLDOWNS to set pulldowns individually
//#define ENDSTOPPULLDOWN_XMAX
//#define ENDSTOPPULLDOWN_YMAX
//#define ENDSTOPPULLDOWN_ZMAX
//#define ENDSTOPPULLDOWN_IMAX
//#define ENDSTOPPULLDOWN_JMAX
//#define ENDSTOPPULLDOWN_KMAX
//#define ENDSTOPPULLDOWN_XMIN
//#define ENDSTOPPULLDOWN_YMIN
//#define ENDSTOPPULLDOWN_ZMIN
//#define ENDSTOPPULLDOWN_IMIN
//#define ENDSTOPPULLDOWN_JMIN
//#define ENDSTOPPULLDOWN_KMIN
//#define ENDSTOPPULLDOWN_XMAX
//#define ENDSTOPPULLDOWN_YMAX
//#define ENDSTOPPULLDOWN_ZMAX
//#define ENDSTOPPULLDOWN_IMAX
//#define ENDSTOPPULLDOWN_JMAX
//#define ENDSTOPPULLDOWN_KMAX
//#define ENDSTOPPULLDOWN_ZMIN_PROBE
#endif

View File

@ -162,12 +162,14 @@ void setup_endstop_interrupts() {
#error "Z_MIN_PROBE_PIN has no EXTINT line available."
#endif
_ATTACH(Z_MIN_PROBE_PIN);
#elif HAS_I_MAX
#endif
#if HAS_I_MAX
#if !AVAILABLE_EILINE(I_MAX_PIN)
#error "I_MAX_PIN has no EXTINT line available."
#endif
attachInterrupt(I_MAX_PIN, endstop_ISR, CHANGE);
#elif HAS_I_MIN
#endif
#if HAS_I_MIN
#if !AVAILABLE_EILINE(I_MIN_PIN)
#error "I_MIN_PIN has no EXTINT line available."
#endif
@ -178,7 +180,8 @@ void setup_endstop_interrupts() {
#error "J_MAX_PIN has no EXTINT line available."
#endif
attachInterrupt(J_MAX_PIN, endstop_ISR, CHANGE);
#elif HAS_J_MIN
#endif
#if HAS_J_MIN
#if !AVAILABLE_EILINE(J_MIN_PIN)
#error "J_MIN_PIN has no EXTINT line available."
#endif
@ -189,7 +192,8 @@ void setup_endstop_interrupts() {
#error "K_MAX_PIN has no EXTINT line available."
#endif
attachInterrupt(K_MAX_PIN, endstop_ISR, CHANGE);
#elif HAS_K_MIN
#endif
#if HAS_K_MIN
#if !AVAILABLE_EILINE(K_MIN_PIN)
#error "K_MIN_PIN has no EXTINT line available."
#endif

View File

@ -33,32 +33,32 @@
#define _AXIS(A) (A##_AXIS)
#define _XMIN_ 100
#define _YMIN_ 200
#define _ZMIN_ 300
#define _IMIN_ 500
#define _JMIN_ 600
#define _KMIN_ 700
#define _XMAX_ 101
#define _YMAX_ 201
#define _ZMAX_ 301
#define _IMAX_ 501
#define _JMAX_ 601
#define _KMAX_ 701
#define _XDIAG_ 102
#define _YDIAG_ 202
#define _ZDIAG_ 302
#define _IDIAG_ 502
#define _JDIAG_ 602
#define _KDIAG_ 702
#define _E0DIAG_ 400
#define _E1DIAG_ 401
#define _E2DIAG_ 402
#define _E3DIAG_ 403
#define _E4DIAG_ 404
#define _E5DIAG_ 405
#define _E6DIAG_ 406
#define _E7DIAG_ 407
#define _XMIN_ 0x11
#define _YMIN_ 0x12
#define _ZMIN_ 0x13
#define _IMIN_ 0x14
#define _JMIN_ 0x15
#define _KMIN_ 0x16
#define _XMAX_ 0x21
#define _YMAX_ 0x22
#define _ZMAX_ 0x23
#define _IMAX_ 0x24
#define _JMAX_ 0x25
#define _KMAX_ 0x26
#define _XDIAG_ 0x31
#define _YDIAG_ 0x32
#define _ZDIAG_ 0x33
#define _IDIAG_ 0x34
#define _JDIAG_ 0x35
#define _KDIAG_ 0x36
#define _E0DIAG_ 0xE0
#define _E1DIAG_ 0xE1
#define _E2DIAG_ 0xE2
#define _E3DIAG_ 0xE3
#define _E4DIAG_ 0xE4
#define _E5DIAG_ 0xE5
#define _E6DIAG_ 0xE6
#define _E7DIAG_ 0xE7
#define _FORCE_INLINE_ __attribute__((__always_inline__)) __inline__
#define FORCE_INLINE __attribute__((always_inline)) inline
@ -251,6 +251,8 @@
memcpy(&a[0],&b[0],_MIN(sizeof(a),sizeof(b))); \
}while(0)
#define CODE_11( A,B,C,D,E,F,G,H,I,J,K,...) A; B; C; D; E; F; G; H; I; J; K
#define CODE_10( A,B,C,D,E,F,G,H,I,J,...) A; B; C; D; E; F; G; H; I; J
#define CODE_9( A,B,C,D,E,F,G,H,I,...) A; B; C; D; E; F; G; H; I
#define CODE_8( A,B,C,D,E,F,G,H,...) A; B; C; D; E; F; G; H
#define CODE_7( A,B,C,D,E,F,G,...) A; B; C; D; E; F; G
@ -286,6 +288,10 @@
#define GANG_N_1(N,K) _GANG_N(N,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K)
// Macros for initializing arrays
#define LIST_20(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T
#define LIST_19(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S
#define LIST_18(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R
#define LIST_17(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q
#define LIST_16(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P
#define LIST_15(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N,O
#define LIST_14(A,B,C,D,E,F,G,H,I,J,K,L,M,N,...) A,B,C,D,E,F,G,H,I,J,K,L,M,N
@ -502,6 +508,11 @@
#define INC_13 14
#define INC_14 15
#define INC_15 16
#define INC_16 17
#define INC_17 18
#define INC_18 19
#define INC_19 20
#define INC_20 21
#define INCREMENT_(n) INC_##n
#define INCREMENT(n) INCREMENT_(n)

View File

@ -60,9 +60,9 @@ Backlash backlash;
* spread over multiple segments, smoothing out artifacts even more.
*/
void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const int32_t &dc, const uint8_t dm, block_t * const block) {
static uint8_t last_direction_bits;
uint8_t changed_dir = last_direction_bits ^ dm;
void Backlash::add_correction_steps(const int32_t &da, const int32_t &db, const int32_t &dc, const axis_bits_t dm, block_t * const block) {
static axis_bits_t last_direction_bits;
axis_bits_t changed_dir = last_direction_bits ^ dm;
// Ignore direction change unless steps are taken in that direction
#if DISABLED(CORE_BACKLASH) || ENABLED(MARKFORGED_XY)
if (!da) CBI(changed_dir, X_AXIS);

View File

@ -71,7 +71,7 @@ public:
return has_measurement(X_AXIS) || has_measurement(Y_AXIS) || has_measurement(Z_AXIS);
}
void add_correction_steps(const int32_t &da, const int32_t &db, const int32_t &dc, const uint8_t dm, block_t * const block);
void add_correction_steps(const int32_t &da, const int32_t &db, const int32_t &dc, const axis_bits_t dm, block_t * const block);
};
extern Backlash backlash;

View File

@ -141,9 +141,9 @@ void GcodeSuite::M217_report(const bool forReplay/*=true*/) {
SP_E_STR, LINEAR_UNIT(toolchange_settings.extra_prime),
SP_P_STR, LINEAR_UNIT(toolchange_settings.prime_speed));
SERIAL_ECHOPGM(" R", LINEAR_UNIT(toolchange_settings.retract_speed),
" U", LINEAR_UNIT(toolchange_settings.unretract_speed),
" F", toolchange_settings.fan_speed,
" G", toolchange_settings.fan_time);
" U", LINEAR_UNIT(toolchange_settings.unretract_speed),
" F", toolchange_settings.fan_speed,
" G", toolchange_settings.fan_time);
#if ENABLED(TOOLCHANGE_MIGRATION_FEATURE)
SERIAL_ECHOPGM(" A", migration.automode);

View File

@ -206,7 +206,8 @@ void GcodeSuite::M906_report(const bool forReplay/*=true*/) {
SERIAL_ECHOPGM(" M906");
};
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z) \
|| AXIS_IS_TMC(I) || AXIS_IS_TMC(J) || AXIS_IS_TMC(K)
say_M906(forReplay);
#if AXIS_IS_TMC(X)
SERIAL_ECHOPGM_P(SP_X_STR, stepperX.getMilliamps());
@ -217,6 +218,15 @@ void GcodeSuite::M906_report(const bool forReplay/*=true*/) {
#if AXIS_IS_TMC(Z)
SERIAL_ECHOPGM_P(SP_Z_STR, stepperZ.getMilliamps());
#endif
#if AXIS_IS_TMC(I)
SERIAL_ECHOPGM_P(SP_I_STR, stepperI.getMilliamps());
#endif
#if AXIS_IS_TMC(J)
SERIAL_ECHOPGM_P(SP_J_STR, stepperJ.getMilliamps());
#endif
#if AXIS_IS_TMC(K)
SERIAL_ECHOPGM_P(SP_K_STR, stepperK.getMilliamps());
#endif
SERIAL_EOL();
#endif
@ -239,25 +249,11 @@ void GcodeSuite::M906_report(const bool forReplay/*=true*/) {
say_M906(forReplay);
SERIAL_ECHOLNPGM(" I2 Z", stepperZ3.getMilliamps());
#endif
#if AXIS_IS_TMC(Z4)
say_M906(forReplay);
SERIAL_ECHOLNPGM(" I3 Z", stepperZ4.getMilliamps());
#endif
#if AXIS_IS_TMC(I)
say_M906(forReplay);
SERIAL_ECHOLNPGM_P(SP_I_STR, stepperI.getMilliamps());
#endif
#if AXIS_IS_TMC(J)
say_M906(forReplay);
SERIAL_ECHOLNPGM_P(SP_J_STR, stepperJ.getMilliamps());
#endif
#if AXIS_IS_TMC(K)
say_M906(forReplay);
SERIAL_ECHOLNPGM_P(SP_K_STR, stepperK.getMilliamps());
#endif
#if AXIS_IS_TMC(E0)
say_M906(forReplay);
SERIAL_ECHOLNPGM(" T0 E", stepperE0.getMilliamps());

View File

@ -74,7 +74,7 @@ millis_t GcodeSuite::previous_move_ms = 0,
// Relative motion mode for each logical axis
static constexpr xyze_bool_t ar_init = AXIS_RELATIVE_MODES;
uint8_t GcodeSuite::axis_relative = 0 LOGICAL_AXIS_GANG(
axis_bits_t GcodeSuite::axis_relative = 0 LOGICAL_AXIS_GANG(
| (ar_init.e << REL_E),
| (ar_init.x << REL_X),
| (ar_init.y << REL_Y),

View File

@ -327,7 +327,7 @@ extern const char G28_STR[];
class GcodeSuite {
public:
static uint8_t axis_relative;
static axis_bits_t axis_relative;
static inline bool axis_is_relative(const AxisEnum a) {
#if HAS_EXTRUDERS

View File

@ -260,8 +260,7 @@ void GCodeQueue::RingBuffer::ok_to_send() {
while (NUMERIC_SIGNED(*p))
SERIAL_CHAR(*p++);
}
SERIAL_ECHOPGM_P(SP_P_STR, planner.moves_free(),
SP_B_STR, BUFSIZE - length);
SERIAL_ECHOPGM_P(SP_P_STR, planner.moves_free(), SP_B_STR, BUFSIZE - length);
#endif
SERIAL_EOL();
}

View File

@ -1922,20 +1922,14 @@
#ifndef Z4_INTERPOLATE
#define Z4_INTERPOLATE INTERPOLATE
#endif
#if LINEAR_AXES >= 4
#ifndef I_INTERPOLATE
#define I_INTERPOLATE INTERPOLATE
#endif
#if LINEAR_AXES >= 4 && !defined(I_INTERPOLATE)
#define I_INTERPOLATE INTERPOLATE
#endif
#if LINEAR_AXES >= 5
#ifndef J_INTERPOLATE
#define J_INTERPOLATE INTERPOLATE
#endif
#if LINEAR_AXES >= 5 && !defined(J_INTERPOLATE)
#define J_INTERPOLATE INTERPOLATE
#endif
#if LINEAR_AXES >= 6
#ifndef K_INTERPOLATE
#define K_INTERPOLATE INTERPOLATE
#endif
#if LINEAR_AXES >= 6 && !defined(K_INTERPOLATE)
#define K_INTERPOLATE INTERPOLATE
#endif
#ifndef E0_INTERPOLATE
#define E0_INTERPOLATE INTERPOLATE
@ -1962,13 +1956,13 @@
#define E7_INTERPOLATE INTERPOLATE
#endif
#ifndef X_SLAVE_ADDRESS
#define X_SLAVE_ADDRESS 0
#define X_SLAVE_ADDRESS 0
#endif
#ifndef Y_SLAVE_ADDRESS
#define Y_SLAVE_ADDRESS 0
#define Y_SLAVE_ADDRESS 0
#endif
#ifndef Z_SLAVE_ADDRESS
#define Z_SLAVE_ADDRESS 0
#define Z_SLAVE_ADDRESS 0
#endif
#ifndef I_SLAVE_ADDRESS
#define I_SLAVE_ADDRESS 0
@ -2660,7 +2654,7 @@
#if HAS_EXTRUDERS && PIN_EXISTS(MOTOR_CURRENT_PWM_E)
#define HAS_MOTOR_CURRENT_PWM_E 1
#endif
#if HAS_MOTOR_CURRENT_PWM_E || ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_Z)
#if HAS_MOTOR_CURRENT_PWM_E || ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_Z, MOTOR_CURRENT_PWM_I, MOTOR_CURRENT_PWM_J, MOTOR_CURRENT_PWM_K)
#define HAS_MOTOR_CURRENT_PWM 1
#endif

View File

@ -1404,8 +1404,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#endif
#endif
#if LINEAR_AXES >= 5
#if AXIS5_NAME == AXIS4_NAME || AXIS5_NAME == AXIS6_NAME
#error "AXIS5_NAME must be different from AXIS4_NAME and AXIS6_NAME"
#if AXIS5_NAME == AXIS4_NAME
#error "AXIS5_NAME must be unique."
#elif AXIS5_NAME != 'A' && AXIS5_NAME != 'B' && AXIS5_NAME != 'C' && AXIS5_NAME != 'U' && AXIS5_NAME != 'V' && AXIS5_NAME != 'W'
#error "AXIS5_NAME can only be one of 'A', 'B', 'C', 'U', 'V', or 'W'."
#elif !defined(J_MIN_POS) || !defined(J_MAX_POS)
@ -1418,7 +1418,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#endif
#if LINEAR_AXES >= 6
#if AXIS6_NAME == AXIS5_NAME || AXIS6_NAME == AXIS4_NAME
#error "AXIS6_NAME must be different from AXIS5_NAME and AXIS4_NAME."
#error "AXIS6_NAME must be unique."
#elif AXIS6_NAME != 'A' && AXIS6_NAME != 'B' && AXIS6_NAME != 'C' && AXIS6_NAME != 'U' && AXIS6_NAME != 'V' && AXIS6_NAME != 'W'
#error "AXIS6_NAME can only be one of 'A', 'B', 'C', 'U', 'V', or 'W'."
#elif !defined(K_MIN_POS) || !defined(K_MAX_POS)
@ -3040,10 +3040,16 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMIN (or ENDSTOPPULLUPS) when homing to Z_MIN."
#elif Z_SENSORLESS && Z_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_ZMAX)
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_ZMAX (or ENDSTOPPULLUPS) when homing to Z_MAX."
#elif LINEAR_AXES >= 4 && I_SENSORLESS && I_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_IMIN)
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_IMIN (or ENDSTOPPULLUPS) when homing to I_MIN."
#elif LINEAR_AXES >= 4 && I_SENSORLESS && I_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_IMAX)
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_IMAX (or ENDSTOPPULLUPS) when homing to I_MAX."
#elif LINEAR_AXES >= 5 && J_SENSORLESS && J_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_JMIN)
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_JMIN (or ENDSTOPPULLUPS) when homing to J_MIN."
#elif LINEAR_AXES >= 5 && J_SENSORLESS && J_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_JMAX)
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_JMAX (or ENDSTOPPULLUPS) when homing to J_MAX."
#elif LINEAR_AXES >= 6 && K_SENSORLESS && K_HOME_TO_MIN && DISABLED(ENDSTOPPULLUP_KMIN)
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_KMIN (or ENDSTOPPULLUPS) when homing to K_MIN."
#elif LINEAR_AXES >= 6 && K_SENSORLESS && K_HOME_TO_MAX && DISABLED(ENDSTOPPULLUP_KMAX)
#error "SENSORLESS_HOMING requires ENDSTOPPULLUP_KMAX (or ENDSTOPPULLUPS) when homing to K_MAX."
#endif

View File

@ -423,6 +423,12 @@ namespace ExtUI {
#if AXIS_IS_TMC(Z2)
case Z2: return stepperZ2.getMilliamps();
#endif
#if AXIS_IS_TMC(Z3)
case Z3: return stepperZ3.getMilliamps();
#endif
#if AXIS_IS_TMC(Z4)
case Z4: return stepperZ4.getMilliamps();
#endif
default: return NAN;
};
}
@ -486,6 +492,12 @@ namespace ExtUI {
#if AXIS_IS_TMC(Z2)
case Z2: stepperZ2.rms_current(constrain(mA, 400, 1500)); break;
#endif
#if AXIS_IS_TMC(Z3)
case Z3: stepperZ3.rms_current(constrain(mA, 400, 1500)); break;
#endif
#if AXIS_IS_TMC(Z4)
case Z4: stepperZ4.rms_current(constrain(mA, 400, 1500)); break;
#endif
default: break;
};
}

View File

@ -1310,7 +1310,7 @@ void Planner::recalculate() {
*/
void Planner::check_axes_activity() {
#if ANY(DISABLE_X, DISABLE_Y, DISABLE_Z , DISABLE_I , DISABLE_J , DISABLE_K, DISABLE_E)
#if ANY(DISABLE_X, DISABLE_Y, DISABLE_Z, DISABLE_I, DISABLE_J, DISABLE_K, DISABLE_E)
xyze_bool_t axis_active = { false };
#endif
@ -1913,7 +1913,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
#endif // PREVENT_COLD_EXTRUSION || PREVENT_LENGTHY_EXTRUDE
// Compute direction bit-mask for this block
uint8_t dm = 0;
axis_bits_t dm = 0;
#if CORE_IS_XY
if (da < 0) SBI(dm, X_HEAD); // Save the toolhead's true direction in X
if (db < 0) SBI(dm, Y_HEAD); // ...and Y
@ -2345,11 +2345,11 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
#ifdef XY_FREQUENCY_LIMIT
static uint8_t old_direction_bits; // = 0
static axis_bits_t old_direction_bits; // = 0
if (xy_freq_limit_hz) {
// Check and limit the xy direction change frequency
const uint8_t direction_change = block->direction_bits ^ old_direction_bits;
const axis_bits_t direction_change = block->direction_bits ^ old_direction_bits;
old_direction_bits = block->direction_bits;
segment_time_us = LROUND(float(segment_time_us) / speed_factor);

View File

@ -202,7 +202,7 @@ typedef struct block_t {
uint32_t acceleration_rate; // The acceleration rate used for acceleration calculation
#endif
uint8_t direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
axis_bits_t direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
// Advance extrusion
#if ENABLED(LIN_ADVANCE)

View File

@ -149,8 +149,8 @@ Stepper stepper; // Singleton
block_t* Stepper::current_block; // (= nullptr) A pointer to the block currently being traced
uint8_t Stepper::last_direction_bits, // = 0
Stepper::axis_did_move; // = 0
axis_bits_t Stepper::last_direction_bits, // = 0
Stepper::axis_did_move; // = 0
bool Stepper::abort_current_block;
@ -503,17 +503,14 @@ void Stepper::set_directions() {
#if HAS_Z_DIR
SET_STEP_DIR(Z); // C
#endif
#if HAS_I_DIR
SET_STEP_DIR(I); // I
SET_STEP_DIR(I);
#endif
#if HAS_J_DIR
SET_STEP_DIR(J); // J
SET_STEP_DIR(J);
#endif
#if HAS_K_DIR
SET_STEP_DIR(K); // K
SET_STEP_DIR(K);
#endif
#if DISABLED(LIN_ADVANCE)
@ -1635,7 +1632,7 @@ void Stepper::pulse_phase_isr() {
case 0: {
const uint8_t low = page_step_state.page[page_step_state.segment_idx],
high = page_step_state.page[page_step_state.segment_idx + 1];
uint8_t dm = last_direction_bits;
axis_bits_t dm = last_direction_bits;
PAGE_SEGMENT_UPDATE(X, low >> 4);
PAGE_SEGMENT_UPDATE(Y, low & 0xF);
@ -2156,7 +2153,7 @@ uint32_t Stepper::block_phase_isr() {
#define Z_MOVE_TEST !!current_block->steps.c
#endif
uint8_t axis_bits = 0;
axis_bits_t axis_bits = 0;
LINEAR_AXIS_CODE(
if (X_MOVE_TEST) SBI(axis_bits, A_AXIS),
if (Y_MOVE_TEST) SBI(axis_bits, B_AXIS),
@ -3003,16 +3000,15 @@ void Stepper::report_positions() {
const bool z_direction = direction ^ BABYSTEP_INVERT_Z;
ENABLE_AXIS_X();
ENABLE_AXIS_Y();
ENABLE_AXIS_Z();
ENABLE_AXIS_I();
ENABLE_AXIS_J();
ENABLE_AXIS_K();
ENABLE_AXIS_X(); ENABLE_AXIS_Y(); ENABLE_AXIS_Z();
ENABLE_AXIS_I(); ENABLE_AXIS_J(); ENABLE_AXIS_K();
DIR_WAIT_BEFORE();
const xyz_byte_t old_dir = LINEAR_AXIS_ARRAY(X_DIR_READ(), Y_DIR_READ(), Z_DIR_READ(), I_DIR_READ(), J_DIR_READ(), K_DIR_READ());
const xyz_byte_t old_dir = LINEAR_AXIS_ARRAY(
X_DIR_READ(), Y_DIR_READ(), Z_DIR_READ(),
I_DIR_READ(), J_DIR_READ(), K_DIR_READ()
);
X_DIR_WRITE(INVERT_X_DIR ^ z_direction);
#ifdef Y_DIR_WRITE

View File

@ -276,8 +276,8 @@ class Stepper {
static block_t* current_block; // A pointer to the block currently being traced
static uint8_t last_direction_bits, // The next stepping-bits to be output
axis_did_move; // Last Movement in the given direction is not null, as computed when the last movement was fetched from planner
static axis_bits_t last_direction_bits, // The next stepping-bits to be output
axis_did_move; // Last Movement in the given direction is not null, as computed when the last movement was fetched from planner
static bool abort_current_block; // Signals to the stepper that current block should be aborted
@ -523,7 +523,7 @@ class Stepper {
static void set_directions();
// Set direction bits and update all stepper DIR states
static void set_directions(const uint8_t bits) {
static void set_directions(const axis_bits_t bits) {
last_direction_bits = bits;
set_directions();
}

View File

@ -896,21 +896,21 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#endif
#if LINEAR_AXES >= 4
#define ENABLE_AXIS_I() if (SHOULD_ENABLE(i)) { ENABLE_STEPPER_I(); AFTER_CHANGE(i, true); }
#define ENABLE_AXIS_I() if (SHOULD_ENABLE(i)) { ENABLE_STEPPER_I(); AFTER_CHANGE(i, true); }
#define DISABLE_AXIS_I() if (SHOULD_DISABLE(i)) { DISABLE_STEPPER_I(); AFTER_CHANGE(i, false); set_axis_untrusted(I_AXIS); }
#else
#define ENABLE_AXIS_I() NOOP
#define DISABLE_AXIS_I() NOOP
#endif
#if LINEAR_AXES >= 5
#define ENABLE_AXIS_J() if (SHOULD_ENABLE(j)) { ENABLE_STEPPER_J(); AFTER_CHANGE(j, true); }
#define ENABLE_AXIS_J() if (SHOULD_ENABLE(j)) { ENABLE_STEPPER_J(); AFTER_CHANGE(j, true); }
#define DISABLE_AXIS_J() if (SHOULD_DISABLE(j)) { DISABLE_STEPPER_J(); AFTER_CHANGE(j, false); set_axis_untrusted(J_AXIS); }
#else
#define ENABLE_AXIS_J() NOOP
#define DISABLE_AXIS_J() NOOP
#endif
#if LINEAR_AXES >= 6
#define ENABLE_AXIS_K() if (SHOULD_ENABLE(k)) { ENABLE_STEPPER_K(); AFTER_CHANGE(k, true); }
#define ENABLE_AXIS_K() if (SHOULD_ENABLE(k)) { ENABLE_STEPPER_K(); AFTER_CHANGE(k, true); }
#define DISABLE_AXIS_K() if (SHOULD_DISABLE(k)) { DISABLE_STEPPER_K(); AFTER_CHANGE(k, false); set_axis_untrusted(K_AXIS); }
#else
#define ENABLE_AXIS_K() NOOP

View File

@ -164,6 +164,15 @@ enum StealthIndex : uint8_t {
#ifndef TMC_Z4_BAUD_RATE
#define TMC_Z4_BAUD_RATE TMC_BAUD_RATE
#endif
#ifndef TMC_I_BAUD_RATE
#define TMC_I_BAUD_RATE TMC_BAUD_RATE
#endif
#ifndef TMC_J_BAUD_RATE
#define TMC_J_BAUD_RATE TMC_BAUD_RATE
#endif
#ifndef TMC_K_BAUD_RATE
#define TMC_K_BAUD_RATE TMC_BAUD_RATE
#endif
#ifndef TMC_E0_BAUD_RATE
#define TMC_E0_BAUD_RATE TMC_BAUD_RATE
#endif
@ -834,12 +843,8 @@ void restore_trinamic_drivers() {
void reset_trinamic_drivers() {
static constexpr bool stealthchop_by_axis[] = LOGICAL_AXIS_ARRAY(
ENABLED(STEALTHCHOP_E),
ENABLED(STEALTHCHOP_XY),
ENABLED(STEALTHCHOP_XY),
ENABLED(STEALTHCHOP_Z),
ENABLED(STEALTHCHOP_I),
ENABLED(STEALTHCHOP_J),
ENABLED(STEALTHCHOP_K)
ENABLED(STEALTHCHOP_XY), ENABLED(STEALTHCHOP_XY), ENABLED(STEALTHCHOP_Z),
ENABLED(STEALTHCHOP_I), ENABLED(STEALTHCHOP_J), ENABLED(STEALTHCHOP_K)
);
#if AXIS_IS_TMC(X)

View File

@ -464,11 +464,19 @@
#ifdef I_STOP_PIN
#if I_HOME_TO_MIN
#define I_MIN_PIN I_STOP_PIN
#define I_MAX_PIN -1
#ifndef I_MAX_PIN
#define I_MAX_PIN -1
#endif
#else
#define I_MIN_PIN -1
#define I_MAX_PIN I_STOP_PIN
#ifndef I_MIN_PIN
#define I_MIN_PIN -1
#endif
#endif
#elif I_HOME_TO_MIN
#define I_STOP_PIN I_MIN_PIN
#else
#define I_STOP_PIN I_MAX_PIN
#endif
#else
#undef I_MIN_PIN
@ -479,11 +487,19 @@
#ifdef J_STOP_PIN
#if J_HOME_TO_MIN
#define J_MIN_PIN J_STOP_PIN
#define J_MAX_PIN -1
#ifndef J_MAX_PIN
#define J_MAX_PIN -1
#endif
#else
#define J_MIN_PIN -1
#define J_MAX_PIN J_STOP_PIN
#ifndef J_MIN_PIN
#define J_MIN_PIN -1
#endif
#endif
#elif J_HOME_TO_MIN
#define J_STOP_PIN J_MIN_PIN
#else
#define J_STOP_PIN J_MAX_PIN
#endif
#else
#undef J_MIN_PIN
@ -494,11 +510,19 @@
#ifdef K_STOP_PIN
#if K_HOME_TO_MIN
#define K_MIN_PIN K_STOP_PIN
#define K_MAX_PIN -1
#ifndef K_MAX_PIN
#define K_MAX_PIN -1
#endif
#else
#define K_MIN_PIN -1
#define K_MAX_PIN K_STOP_PIN
#ifndef K_MIN_PIN
#define K_MIN_PIN -1
#endif
#endif
#elif K_HOME_TO_MIN
#define K_STOP_PIN K_MIN_PIN
#else
#define K_STOP_PIN K_MAX_PIN
#endif
#else
#undef K_MIN_PIN