@@ -447,6 +447,18 @@ xyze_int8_t Stepper::count_direction{0};
|
||||
#define K_APPLY_DIR(v,Q) K_DIR_WRITE(v)
|
||||
#define K_APPLY_STEP(v,Q) K_STEP_WRITE(v)
|
||||
#endif
|
||||
#if HAS_U_AXIS
|
||||
#define U_APPLY_DIR(v,Q) U_DIR_WRITE(v)
|
||||
#define U_APPLY_STEP(v,Q) U_STEP_WRITE(v)
|
||||
#endif
|
||||
#if HAS_V_AXIS
|
||||
#define V_APPLY_DIR(v,Q) V_DIR_WRITE(v)
|
||||
#define V_APPLY_STEP(v,Q) V_STEP_WRITE(v)
|
||||
#endif
|
||||
#if HAS_W_AXIS
|
||||
#define W_APPLY_DIR(v,Q) W_DIR_WRITE(v)
|
||||
#define W_APPLY_STEP(v,Q) W_STEP_WRITE(v)
|
||||
#endif
|
||||
|
||||
#if DISABLED(MIXING_EXTRUDER)
|
||||
#define E_APPLY_STEP(v,Q) E_STEP_WRITE(stepper_extruder, v)
|
||||
@@ -486,9 +498,10 @@ xyze_int8_t Stepper::count_direction{0};
|
||||
void Stepper::enable_axis(const AxisEnum axis) {
|
||||
#define _CASE_ENABLE(N) case N##_AXIS: ENABLE_AXIS_##N(); break;
|
||||
switch (axis) {
|
||||
LINEAR_AXIS_CODE(
|
||||
NUM_AXIS_CODE(
|
||||
_CASE_ENABLE(X), _CASE_ENABLE(Y), _CASE_ENABLE(Z),
|
||||
_CASE_ENABLE(I), _CASE_ENABLE(J), _CASE_ENABLE(K)
|
||||
_CASE_ENABLE(I), _CASE_ENABLE(J), _CASE_ENABLE(K),
|
||||
_CASE_ENABLE(U), _CASE_ENABLE(V), _CASE_ENABLE(W)
|
||||
);
|
||||
default: break;
|
||||
}
|
||||
@@ -505,9 +518,10 @@ bool Stepper::disable_axis(const AxisEnum axis) {
|
||||
if (can_disable) {
|
||||
#define _CASE_DISABLE(N) case N##_AXIS: DISABLE_AXIS_##N(); break;
|
||||
switch (axis) {
|
||||
LINEAR_AXIS_CODE(
|
||||
NUM_AXIS_CODE(
|
||||
_CASE_DISABLE(X), _CASE_DISABLE(Y), _CASE_DISABLE(Z),
|
||||
_CASE_DISABLE(I), _CASE_DISABLE(J), _CASE_DISABLE(K)
|
||||
_CASE_DISABLE(I), _CASE_DISABLE(J), _CASE_DISABLE(K),
|
||||
_CASE_DISABLE(U), _CASE_DISABLE(V), _CASE_DISABLE(W)
|
||||
);
|
||||
default: break;
|
||||
}
|
||||
@@ -550,9 +564,10 @@ bool Stepper::disable_axis(const AxisEnum axis) {
|
||||
|
||||
void Stepper::enable_all_steppers() {
|
||||
TERN_(AUTO_POWER_CONTROL, powerManager.power_on());
|
||||
LINEAR_AXIS_CODE(
|
||||
NUM_AXIS_CODE(
|
||||
enable_axis(X_AXIS), enable_axis(Y_AXIS), enable_axis(Z_AXIS),
|
||||
enable_axis(I_AXIS), enable_axis(J_AXIS), enable_axis(K_AXIS)
|
||||
enable_axis(I_AXIS), enable_axis(J_AXIS), enable_axis(K_AXIS),
|
||||
enable_axis(U_AXIS), enable_axis(V_AXIS), enable_axis(W_AXIS)
|
||||
);
|
||||
enable_e_steppers();
|
||||
|
||||
@@ -560,9 +575,10 @@ void Stepper::enable_all_steppers() {
|
||||
}
|
||||
|
||||
void Stepper::disable_all_steppers() {
|
||||
LINEAR_AXIS_CODE(
|
||||
NUM_AXIS_CODE(
|
||||
disable_axis(X_AXIS), disable_axis(Y_AXIS), disable_axis(Z_AXIS),
|
||||
disable_axis(I_AXIS), disable_axis(J_AXIS), disable_axis(K_AXIS)
|
||||
disable_axis(I_AXIS), disable_axis(J_AXIS), disable_axis(K_AXIS),
|
||||
disable_axis(U_AXIS), disable_axis(V_AXIS), disable_axis(W_AXIS)
|
||||
);
|
||||
disable_e_steppers();
|
||||
|
||||
@@ -596,6 +612,9 @@ void Stepper::set_directions() {
|
||||
TERN_(HAS_I_DIR, SET_STEP_DIR(I));
|
||||
TERN_(HAS_J_DIR, SET_STEP_DIR(J));
|
||||
TERN_(HAS_K_DIR, SET_STEP_DIR(K));
|
||||
TERN_(HAS_U_DIR, SET_STEP_DIR(U));
|
||||
TERN_(HAS_V_DIR, SET_STEP_DIR(V));
|
||||
TERN_(HAS_W_DIR, SET_STEP_DIR(W));
|
||||
|
||||
#if DISABLED(LIN_ADVANCE)
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
@@ -1816,6 +1835,15 @@ void Stepper::pulse_phase_isr() {
|
||||
#if HAS_K_STEP
|
||||
PULSE_PREP(K);
|
||||
#endif
|
||||
#if HAS_U_STEP
|
||||
PULSE_PREP(U);
|
||||
#endif
|
||||
#if HAS_V_STEP
|
||||
PULSE_PREP(V);
|
||||
#endif
|
||||
#if HAS_W_STEP
|
||||
PULSE_PREP(W);
|
||||
#endif
|
||||
|
||||
#if EITHER(LIN_ADVANCE, MIXING_EXTRUDER)
|
||||
delta_error.e += advance_dividend.e;
|
||||
@@ -1860,6 +1888,15 @@ void Stepper::pulse_phase_isr() {
|
||||
#if HAS_K_STEP
|
||||
PULSE_START(K);
|
||||
#endif
|
||||
#if HAS_U_STEP
|
||||
PULSE_START(U);
|
||||
#endif
|
||||
#if HAS_V_STEP
|
||||
PULSE_START(V);
|
||||
#endif
|
||||
#if HAS_W_STEP
|
||||
PULSE_START(W);
|
||||
#endif
|
||||
|
||||
#if DISABLED(LIN_ADVANCE)
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
@@ -1898,6 +1935,15 @@ void Stepper::pulse_phase_isr() {
|
||||
#if HAS_K_STEP
|
||||
PULSE_STOP(K);
|
||||
#endif
|
||||
#if HAS_U_STEP
|
||||
PULSE_STOP(U);
|
||||
#endif
|
||||
#if HAS_V_STEP
|
||||
PULSE_STOP(V);
|
||||
#endif
|
||||
#if HAS_W_STEP
|
||||
PULSE_STOP(W);
|
||||
#endif
|
||||
|
||||
#if DISABLED(LIN_ADVANCE)
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
@@ -2243,13 +2289,16 @@ uint32_t Stepper::block_phase_isr() {
|
||||
#endif
|
||||
|
||||
axis_bits_t axis_bits = 0;
|
||||
LINEAR_AXIS_CODE(
|
||||
NUM_AXIS_CODE(
|
||||
if (X_MOVE_TEST) SBI(axis_bits, A_AXIS),
|
||||
if (Y_MOVE_TEST) SBI(axis_bits, B_AXIS),
|
||||
if (Z_MOVE_TEST) SBI(axis_bits, C_AXIS),
|
||||
if (current_block->steps.i) SBI(axis_bits, I_AXIS),
|
||||
if (current_block->steps.j) SBI(axis_bits, J_AXIS),
|
||||
if (current_block->steps.k) SBI(axis_bits, K_AXIS)
|
||||
if (current_block->steps.k) SBI(axis_bits, K_AXIS),
|
||||
if (current_block->steps.u) SBI(axis_bits, U_AXIS),
|
||||
if (current_block->steps.v) SBI(axis_bits, V_AXIS),
|
||||
if (current_block->steps.w) SBI(axis_bits, W_AXIS)
|
||||
);
|
||||
//if (current_block->steps.e) SBI(axis_bits, E_AXIS);
|
||||
//if (current_block->steps.a) SBI(axis_bits, X_HEAD);
|
||||
@@ -2589,6 +2638,15 @@ void Stepper::init() {
|
||||
#if HAS_K_DIR
|
||||
K_DIR_INIT();
|
||||
#endif
|
||||
#if HAS_U_DIR
|
||||
U_DIR_INIT();
|
||||
#endif
|
||||
#if HAS_V_DIR
|
||||
V_DIR_INIT();
|
||||
#endif
|
||||
#if HAS_W_DIR
|
||||
W_DIR_INIT();
|
||||
#endif
|
||||
#if HAS_E0_DIR
|
||||
E0_DIR_INIT();
|
||||
#endif
|
||||
@@ -2659,6 +2717,18 @@ void Stepper::init() {
|
||||
K_ENABLE_INIT();
|
||||
if (!K_ENABLE_ON) K_ENABLE_WRITE(HIGH);
|
||||
#endif
|
||||
#if HAS_U_ENABLE
|
||||
U_ENABLE_INIT();
|
||||
if (!U_ENABLE_ON) U_ENABLE_WRITE(HIGH);
|
||||
#endif
|
||||
#if HAS_V_ENABLE
|
||||
V_ENABLE_INIT();
|
||||
if (!V_ENABLE_ON) V_ENABLE_WRITE(HIGH);
|
||||
#endif
|
||||
#if HAS_W_ENABLE
|
||||
W_ENABLE_INIT();
|
||||
if (!W_ENABLE_ON) W_ENABLE_WRITE(HIGH);
|
||||
#endif
|
||||
#if HAS_E0_ENABLE
|
||||
E0_ENABLE_INIT();
|
||||
if (!E_ENABLE_ON) E0_ENABLE_WRITE(HIGH);
|
||||
@@ -2744,6 +2814,15 @@ void Stepper::init() {
|
||||
#if HAS_K_STEP
|
||||
AXIS_INIT(K, K);
|
||||
#endif
|
||||
#if HAS_U_STEP
|
||||
AXIS_INIT(U, U);
|
||||
#endif
|
||||
#if HAS_V_STEP
|
||||
AXIS_INIT(V, V);
|
||||
#endif
|
||||
#if HAS_W_STEP
|
||||
AXIS_INIT(W, W);
|
||||
#endif
|
||||
|
||||
#if E_STEPPERS && HAS_E0_STEP
|
||||
E_AXIS_INIT(0);
|
||||
@@ -2778,13 +2857,16 @@ void Stepper::init() {
|
||||
|
||||
// Init direction bits for first moves
|
||||
set_directions(0
|
||||
LINEAR_AXIS_GANG(
|
||||
NUM_AXIS_GANG(
|
||||
| TERN0(INVERT_X_DIR, _BV(X_AXIS)),
|
||||
| TERN0(INVERT_Y_DIR, _BV(Y_AXIS)),
|
||||
| TERN0(INVERT_Z_DIR, _BV(Z_AXIS)),
|
||||
| TERN0(INVERT_I_DIR, _BV(I_AXIS)),
|
||||
| TERN0(INVERT_J_DIR, _BV(J_AXIS)),
|
||||
| TERN0(INVERT_K_DIR, _BV(K_AXIS))
|
||||
| TERN0(INVERT_K_DIR, _BV(K_AXIS)),
|
||||
| TERN0(INVERT_U_DIR, _BV(U_AXIS)),
|
||||
| TERN0(INVERT_V_DIR, _BV(V_AXIS)),
|
||||
| TERN0(INVERT_W_DIR, _BV(W_AXIS))
|
||||
)
|
||||
);
|
||||
|
||||
@@ -2820,6 +2902,14 @@ void Stepper::_set_position(const abce_long_t &spos) {
|
||||
#elif ENABLED(MARKFORGED_YX)
|
||||
count_position.set(spos.a, spos.b - spos.a, spos.c);
|
||||
#endif
|
||||
SECONDARY_AXIS_CODE(
|
||||
count_position.i = spos.i,
|
||||
count_position.j = spos.j,
|
||||
count_position.k = spos.k,
|
||||
count_position.u = spos.u,
|
||||
count_position.v = spos.v,
|
||||
count_position.w = spos.w
|
||||
);
|
||||
TERN_(HAS_EXTRUDERS, count_position.e = spos.e);
|
||||
#else
|
||||
// default non-h-bot planning
|
||||
@@ -2934,13 +3024,16 @@ int32_t Stepper::triggered_position(const AxisEnum axis) {
|
||||
|
||||
void Stepper::report_a_position(const xyz_long_t &pos) {
|
||||
SERIAL_ECHOLNPGM_P(
|
||||
LIST_N(DOUBLE(LINEAR_AXES),
|
||||
LIST_N(DOUBLE(NUM_AXES),
|
||||
TERN(SAYS_A, PSTR(STR_COUNT_A), PSTR(STR_COUNT_X)), pos.x,
|
||||
TERN(SAYS_B, PSTR("B:"), SP_Y_LBL), pos.y,
|
||||
TERN(SAYS_C, PSTR("C:"), SP_Z_LBL), pos.z,
|
||||
SP_I_LBL, pos.i,
|
||||
SP_J_LBL, pos.j,
|
||||
SP_K_LBL, pos.k
|
||||
SP_K_LBL, pos.k,
|
||||
SP_U_LBL, pos.u,
|
||||
SP_V_LBL, pos.v,
|
||||
SP_W_LBL, pos.w
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -3096,16 +3189,18 @@ void Stepper::report_positions() {
|
||||
|
||||
const bool z_direction = direction ^ BABYSTEP_INVERT_Z;
|
||||
|
||||
LINEAR_AXIS_CODE(
|
||||
NUM_AXIS_CODE(
|
||||
enable_axis(X_AXIS), enable_axis(Y_AXIS), enable_axis(Z_AXIS),
|
||||
enable_axis(I_AXIS), enable_axis(J_AXIS), enable_axis(K_AXIS)
|
||||
enable_axis(I_AXIS), enable_axis(J_AXIS), enable_axis(K_AXIS),
|
||||
enable_axis(U_AXIS), enable_axis(V_AXIS), enable_axis(W_AXIS)
|
||||
);
|
||||
|
||||
DIR_WAIT_BEFORE();
|
||||
|
||||
const xyz_byte_t old_dir = LINEAR_AXIS_ARRAY(
|
||||
const xyz_byte_t old_dir = NUM_AXIS_ARRAY(
|
||||
X_DIR_READ(), Y_DIR_READ(), Z_DIR_READ(),
|
||||
I_DIR_READ(), J_DIR_READ(), K_DIR_READ()
|
||||
I_DIR_READ(), J_DIR_READ(), K_DIR_READ(),
|
||||
U_DIR_READ(), V_DIR_READ(), W_DIR_READ()
|
||||
);
|
||||
|
||||
X_DIR_WRITE(ENABLED(INVERT_X_DIR) ^ z_direction);
|
||||
@@ -3124,6 +3219,15 @@ void Stepper::report_positions() {
|
||||
#ifdef K_DIR_WRITE
|
||||
K_DIR_WRITE(ENABLED(INVERT_K_DIR) ^ z_direction);
|
||||
#endif
|
||||
#ifdef U_DIR_WRITE
|
||||
U_DIR_WRITE(ENABLED(INVERT_U_DIR) ^ z_direction);
|
||||
#endif
|
||||
#ifdef V_DIR_WRITE
|
||||
V_DIR_WRITE(ENABLED(INVERT_V_DIR) ^ z_direction);
|
||||
#endif
|
||||
#ifdef W_DIR_WRITE
|
||||
W_DIR_WRITE(ENABLED(INVERT_W_DIR) ^ z_direction);
|
||||
#endif
|
||||
|
||||
DIR_WAIT_AFTER();
|
||||
|
||||
@@ -3145,6 +3249,15 @@ void Stepper::report_positions() {
|
||||
#ifdef K_STEP_WRITE
|
||||
K_STEP_WRITE(!INVERT_K_STEP_PIN);
|
||||
#endif
|
||||
#ifdef U_STEP_WRITE
|
||||
U_STEP_WRITE(!INVERT_U_STEP_PIN);
|
||||
#endif
|
||||
#ifdef V_STEP_WRITE
|
||||
V_STEP_WRITE(!INVERT_V_STEP_PIN);
|
||||
#endif
|
||||
#ifdef W_STEP_WRITE
|
||||
W_STEP_WRITE(!INVERT_W_STEP_PIN);
|
||||
#endif
|
||||
|
||||
_PULSE_WAIT();
|
||||
|
||||
@@ -3164,6 +3277,15 @@ void Stepper::report_positions() {
|
||||
#ifdef K_STEP_WRITE
|
||||
K_STEP_WRITE(INVERT_K_STEP_PIN);
|
||||
#endif
|
||||
#ifdef U_STEP_WRITE
|
||||
U_STEP_WRITE(INVERT_U_STEP_PIN);
|
||||
#endif
|
||||
#ifdef V_STEP_WRITE
|
||||
V_STEP_WRITE(INVERT_V_STEP_PIN);
|
||||
#endif
|
||||
#ifdef W_STEP_WRITE
|
||||
W_STEP_WRITE(INVERT_W_STEP_PIN);
|
||||
#endif
|
||||
|
||||
// Restore direction bits
|
||||
EXTRA_DIR_WAIT_BEFORE();
|
||||
@@ -3184,6 +3306,15 @@ void Stepper::report_positions() {
|
||||
#ifdef K_DIR_WRITE
|
||||
K_DIR_WRITE(old_dir.k);
|
||||
#endif
|
||||
#ifdef U_DIR_WRITE
|
||||
U_DIR_WRITE(old_dir.u);
|
||||
#endif
|
||||
#ifdef V_DIR_WRITE
|
||||
V_DIR_WRITE(old_dir.v);
|
||||
#endif
|
||||
#ifdef W_DIR_WRITE
|
||||
W_DIR_WRITE(old_dir.w);
|
||||
#endif
|
||||
|
||||
EXTRA_DIR_WAIT_AFTER();
|
||||
|
||||
@@ -3200,6 +3331,15 @@ void Stepper::report_positions() {
|
||||
#if HAS_K_AXIS
|
||||
case K_AXIS: BABYSTEP_AXIS(K, 0, direction); break;
|
||||
#endif
|
||||
#if HAS_U_AXIS
|
||||
case U_AXIS: BABYSTEP_AXIS(U, 0, direction); break;
|
||||
#endif
|
||||
#if HAS_V_AXIS
|
||||
case V_AXIS: BABYSTEP_AXIS(V, 0, direction); break;
|
||||
#endif
|
||||
#if HAS_W_AXIS
|
||||
case W_AXIS: BABYSTEP_AXIS(W, 0, direction); break;
|
||||
#endif
|
||||
|
||||
default: break;
|
||||
}
|
||||
@@ -3428,6 +3568,24 @@ void Stepper::report_positions() {
|
||||
SET_OUTPUT(K_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_U_MS_PINS
|
||||
SET_OUTPUT(U_MS1_PIN); SET_OUTPUT(U_MS2_PIN);
|
||||
#if PIN_EXISTS(U_MS3)
|
||||
SET_OUTPUT(U_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_V_MS_PINS
|
||||
SET_OUTPUT(V_MS1_PIN); SET_OUTPUT(V_MS2_PIN);
|
||||
#if PIN_EXISTS(V_MS3)
|
||||
SET_OUTPUT(V_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_W_MS_PINS
|
||||
SET_OUTPUT(W_MS1_PIN); SET_OUTPUT(W_MS2_PIN);
|
||||
#if PIN_EXISTS(W_MS3)
|
||||
SET_OUTPUT(W_MS3_PIN);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E0_MS_PINS
|
||||
SET_OUTPUT(E0_MS1_PIN); SET_OUTPUT(E0_MS2_PIN);
|
||||
#if PIN_EXISTS(E0_MS3)
|
||||
@@ -3553,6 +3711,15 @@ void Stepper::report_positions() {
|
||||
#if HAS_K_MS_PINS
|
||||
case 13: WRITE(K_MS1_PIN, ms1); break
|
||||
#endif
|
||||
#if HAS_U_MS_PINS
|
||||
case 14: WRITE(U_MS1_PIN, ms1); break
|
||||
#endif
|
||||
#if HAS_V_MS_PINS
|
||||
case 15: WRITE(V_MS1_PIN, ms1); break
|
||||
#endif
|
||||
#if HAS_W_MS_PINS
|
||||
case 16: WRITE(W_MS1_PIN, ms1); break
|
||||
#endif
|
||||
}
|
||||
if (ms2 >= 0) switch (driver) {
|
||||
#if HAS_X_MS_PINS || HAS_X2_MS_PINS
|
||||
@@ -3624,6 +3791,15 @@ void Stepper::report_positions() {
|
||||
#if HAS_K_MS_PINS
|
||||
case 13: WRITE(K_MS2_PIN, ms2); break
|
||||
#endif
|
||||
#if HAS_U_MS_PINS
|
||||
case 14: WRITE(U_MS2_PIN, ms2); break
|
||||
#endif
|
||||
#if HAS_V_MS_PINS
|
||||
case 15: WRITE(V_MS2_PIN, ms2); break
|
||||
#endif
|
||||
#if HAS_W_MS_PINS
|
||||
case 16: WRITE(W_MS2_PIN, ms2); break
|
||||
#endif
|
||||
}
|
||||
if (ms3 >= 0) switch (driver) {
|
||||
#if HAS_X_MS_PINS || HAS_X2_MS_PINS
|
||||
@@ -3760,6 +3936,24 @@ void Stepper::report_positions() {
|
||||
PIN_CHAR(K_MS3);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_U_MS_PINS
|
||||
MS_LINE(U);
|
||||
#if PIN_EXISTS(U_MS3)
|
||||
PIN_CHAR(U_MS3);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_V_MS_PINS
|
||||
MS_LINE(V);
|
||||
#if PIN_EXISTS(V_MS3)
|
||||
PIN_CHAR(V_MS3);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_W_MS_PINS
|
||||
MS_LINE(W);
|
||||
#if PIN_EXISTS(W_MS3)
|
||||
PIN_CHAR(W_MS3);
|
||||
#endif
|
||||
#endif
|
||||
#if HAS_E0_MS_PINS
|
||||
MS_LINE(E0);
|
||||
#if PIN_EXISTS(E0_MS3)
|
||||
|
||||
Reference in New Issue
Block a user