🎨 Various multi-axis patches (#22823)
This commit is contained in:
committed by
Scott Lahteine
parent
3deb54d0fd
commit
2c30b75268
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user