update code base to Marlin 2.0.9.2
This commit is contained in:
336
Marlin/src/module/stepper/indirection.h
Executable file → Normal file
336
Marlin/src/module/stepper/indirection.h
Executable file → Normal file
@@ -16,7 +16,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "L64xx.h"
|
||||
#endif
|
||||
|
||||
#if HAS_DRIVER(TMC26X)
|
||||
#if HAS_TMC26X
|
||||
#include "TMC26X.h"
|
||||
#endif
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "trinamic.h"
|
||||
#endif
|
||||
|
||||
void restore_stepper_drivers(); // Called by PSU_ON
|
||||
void restore_stepper_drivers(); // Called by powerManager.power_on()
|
||||
void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
||||
|
||||
// X Stepper
|
||||
@@ -65,38 +65,42 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
||||
#define X_STEP_READ() bool(READ(X_STEP_PIN))
|
||||
|
||||
// Y Stepper
|
||||
#ifndef Y_ENABLE_INIT
|
||||
#define Y_ENABLE_INIT() SET_OUTPUT(Y_ENABLE_PIN)
|
||||
#define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
|
||||
#define Y_ENABLE_READ() bool(READ(Y_ENABLE_PIN))
|
||||
#if HAS_Y_AXIS
|
||||
#ifndef Y_ENABLE_INIT
|
||||
#define Y_ENABLE_INIT() SET_OUTPUT(Y_ENABLE_PIN)
|
||||
#define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
|
||||
#define Y_ENABLE_READ() bool(READ(Y_ENABLE_PIN))
|
||||
#endif
|
||||
#ifndef Y_DIR_INIT
|
||||
#define Y_DIR_INIT() SET_OUTPUT(Y_DIR_PIN)
|
||||
#define Y_DIR_WRITE(STATE) WRITE(Y_DIR_PIN,STATE)
|
||||
#define Y_DIR_READ() bool(READ(Y_DIR_PIN))
|
||||
#endif
|
||||
#define Y_STEP_INIT() SET_OUTPUT(Y_STEP_PIN)
|
||||
#ifndef Y_STEP_WRITE
|
||||
#define Y_STEP_WRITE(STATE) WRITE(Y_STEP_PIN,STATE)
|
||||
#endif
|
||||
#define Y_STEP_READ() bool(READ(Y_STEP_PIN))
|
||||
#endif
|
||||
#ifndef Y_DIR_INIT
|
||||
#define Y_DIR_INIT() SET_OUTPUT(Y_DIR_PIN)
|
||||
#define Y_DIR_WRITE(STATE) WRITE(Y_DIR_PIN,STATE)
|
||||
#define Y_DIR_READ() bool(READ(Y_DIR_PIN))
|
||||
#endif
|
||||
#define Y_STEP_INIT() SET_OUTPUT(Y_STEP_PIN)
|
||||
#ifndef Y_STEP_WRITE
|
||||
#define Y_STEP_WRITE(STATE) WRITE(Y_STEP_PIN,STATE)
|
||||
#endif
|
||||
#define Y_STEP_READ() bool(READ(Y_STEP_PIN))
|
||||
|
||||
// Z Stepper
|
||||
#ifndef Z_ENABLE_INIT
|
||||
#define Z_ENABLE_INIT() SET_OUTPUT(Z_ENABLE_PIN)
|
||||
#define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
|
||||
#define Z_ENABLE_READ() bool(READ(Z_ENABLE_PIN))
|
||||
#if HAS_Z_AXIS
|
||||
#ifndef Z_ENABLE_INIT
|
||||
#define Z_ENABLE_INIT() SET_OUTPUT(Z_ENABLE_PIN)
|
||||
#define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
|
||||
#define Z_ENABLE_READ() bool(READ(Z_ENABLE_PIN))
|
||||
#endif
|
||||
#ifndef Z_DIR_INIT
|
||||
#define Z_DIR_INIT() SET_OUTPUT(Z_DIR_PIN)
|
||||
#define Z_DIR_WRITE(STATE) WRITE(Z_DIR_PIN,STATE)
|
||||
#define Z_DIR_READ() bool(READ(Z_DIR_PIN))
|
||||
#endif
|
||||
#define Z_STEP_INIT() SET_OUTPUT(Z_STEP_PIN)
|
||||
#ifndef Z_STEP_WRITE
|
||||
#define Z_STEP_WRITE(STATE) WRITE(Z_STEP_PIN,STATE)
|
||||
#endif
|
||||
#define Z_STEP_READ() bool(READ(Z_STEP_PIN))
|
||||
#endif
|
||||
#ifndef Z_DIR_INIT
|
||||
#define Z_DIR_INIT() SET_OUTPUT(Z_DIR_PIN)
|
||||
#define Z_DIR_WRITE(STATE) WRITE(Z_DIR_PIN,STATE)
|
||||
#define Z_DIR_READ() bool(READ(Z_DIR_PIN))
|
||||
#endif
|
||||
#define Z_STEP_INIT() SET_OUTPUT(Z_STEP_PIN)
|
||||
#ifndef Z_STEP_WRITE
|
||||
#define Z_STEP_WRITE(STATE) WRITE(Z_STEP_PIN,STATE)
|
||||
#endif
|
||||
#define Z_STEP_READ() bool(READ(Z_STEP_PIN))
|
||||
|
||||
// X2 Stepper
|
||||
#if HAS_X2_ENABLE
|
||||
@@ -201,6 +205,63 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
||||
#define Z4_DIR_WRITE(STATE) NOOP
|
||||
#endif
|
||||
|
||||
// I Stepper
|
||||
#if LINEAR_AXES >= 4
|
||||
#ifndef I_ENABLE_INIT
|
||||
#define I_ENABLE_INIT() SET_OUTPUT(I_ENABLE_PIN)
|
||||
#define I_ENABLE_WRITE(STATE) WRITE(I_ENABLE_PIN,STATE)
|
||||
#define I_ENABLE_READ() bool(READ(I_ENABLE_PIN))
|
||||
#endif
|
||||
#ifndef I_DIR_INIT
|
||||
#define I_DIR_INIT() SET_OUTPUT(I_DIR_PIN)
|
||||
#define I_DIR_WRITE(STATE) WRITE(I_DIR_PIN,STATE)
|
||||
#define I_DIR_READ() bool(READ(I_DIR_PIN))
|
||||
#endif
|
||||
#define I_STEP_INIT() SET_OUTPUT(I_STEP_PIN)
|
||||
#ifndef I_STEP_WRITE
|
||||
#define I_STEP_WRITE(STATE) WRITE(I_STEP_PIN,STATE)
|
||||
#endif
|
||||
#define I_STEP_READ() bool(READ(I_STEP_PIN))
|
||||
#endif
|
||||
|
||||
// J Stepper
|
||||
#if LINEAR_AXES >= 5
|
||||
#ifndef J_ENABLE_INIT
|
||||
#define J_ENABLE_INIT() SET_OUTPUT(J_ENABLE_PIN)
|
||||
#define J_ENABLE_WRITE(STATE) WRITE(J_ENABLE_PIN,STATE)
|
||||
#define J_ENABLE_READ() bool(READ(J_ENABLE_PIN))
|
||||
#endif
|
||||
#ifndef J_DIR_INIT
|
||||
#define J_DIR_INIT() SET_OUTPUT(J_DIR_PIN)
|
||||
#define J_DIR_WRITE(STATE) WRITE(J_DIR_PIN,STATE)
|
||||
#define J_DIR_READ() bool(READ(J_DIR_PIN))
|
||||
#endif
|
||||
#define J_STEP_INIT() SET_OUTPUT(J_STEP_PIN)
|
||||
#ifndef J_STEP_WRITE
|
||||
#define J_STEP_WRITE(STATE) WRITE(J_STEP_PIN,STATE)
|
||||
#endif
|
||||
#define J_STEP_READ() bool(READ(J_STEP_PIN))
|
||||
#endif
|
||||
|
||||
// K Stepper
|
||||
#if LINEAR_AXES >= 6
|
||||
#ifndef K_ENABLE_INIT
|
||||
#define K_ENABLE_INIT() SET_OUTPUT(K_ENABLE_PIN)
|
||||
#define K_ENABLE_WRITE(STATE) WRITE(K_ENABLE_PIN,STATE)
|
||||
#define K_ENABLE_READ() bool(READ(K_ENABLE_PIN))
|
||||
#endif
|
||||
#ifndef K_DIR_INIT
|
||||
#define K_DIR_INIT() SET_OUTPUT(K_DIR_PIN)
|
||||
#define K_DIR_WRITE(STATE) WRITE(K_DIR_PIN,STATE)
|
||||
#define K_DIR_READ() bool(READ(K_DIR_PIN))
|
||||
#endif
|
||||
#define K_STEP_INIT() SET_OUTPUT(K_STEP_PIN)
|
||||
#ifndef K_STEP_WRITE
|
||||
#define K_STEP_WRITE(STATE) WRITE(K_STEP_PIN,STATE)
|
||||
#endif
|
||||
#define K_STEP_READ() bool(READ(K_STEP_PIN))
|
||||
#endif
|
||||
|
||||
// E0 Stepper
|
||||
#ifndef E0_ENABLE_INIT
|
||||
#define E0_ENABLE_INIT() SET_OUTPUT(E0_ENABLE_PIN)
|
||||
@@ -417,12 +478,15 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
||||
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(E ? INVERT_E0_DIR : !INVERT_E0_DIR); }while(0)
|
||||
#define REV_E_DIR(E) do{ E0_DIR_WRITE(E ? !INVERT_E0_DIR : INVERT_E0_DIR); }while(0)
|
||||
#endif
|
||||
#elif ENABLED(PRUSA_MMU2)
|
||||
|
||||
#elif HAS_PRUSA_MMU2 // One multiplexed stepper driver
|
||||
|
||||
#define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
|
||||
#define NORM_E_DIR(E) E0_DIR_WRITE(!INVERT_E0_DIR)
|
||||
#define REV_E_DIR(E) E0_DIR_WRITE( INVERT_E0_DIR)
|
||||
|
||||
#elif ENABLED(MK2_MULTIPLEXER) // One multiplexed stepper driver, reversed on odd index
|
||||
#elif HAS_PRUSA_MMU1 // One multiplexed stepper driver, reversed on odd index
|
||||
|
||||
#define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
|
||||
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? !INVERT_E0_DIR: INVERT_E0_DIR); }while(0)
|
||||
#define REV_E_DIR(E) do{ E0_DIR_WRITE(TEST(E, 0) ? INVERT_E0_DIR: !INVERT_E0_DIR); }while(0)
|
||||
@@ -581,6 +645,11 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
||||
|
||||
#endif
|
||||
|
||||
#elif ENABLED(E_DUAL_STEPPER_DRIVERS)
|
||||
#define E_STEP_WRITE(E,V) do{ E0_STEP_WRITE(V); E1_STEP_WRITE(V); }while(0)
|
||||
#define NORM_E_DIR(E) do{ E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E0_DIR ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0)
|
||||
#define REV_E_DIR(E) do{ E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E0_DIR ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0)
|
||||
|
||||
#elif E_STEPPERS
|
||||
#define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
|
||||
#define NORM_E_DIR(E) E0_DIR_WRITE(!INVERT_E0_DIR)
|
||||
@@ -598,138 +667,87 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
||||
//
|
||||
|
||||
#ifndef ENABLE_STEPPER_X
|
||||
#if HAS_X_ENABLE
|
||||
#define ENABLE_STEPPER_X() X_ENABLE_WRITE( X_ENABLE_ON)
|
||||
#else
|
||||
#define ENABLE_STEPPER_X() NOOP
|
||||
#endif
|
||||
#define ENABLE_STEPPER_X() TERN(HAS_X_ENABLE, X_ENABLE_WRITE( X_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
#ifndef DISABLE_STEPPER_X
|
||||
#if HAS_X_ENABLE
|
||||
#define DISABLE_STEPPER_X() X_ENABLE_WRITE(!X_ENABLE_ON)
|
||||
#else
|
||||
#define DISABLE_STEPPER_X() NOOP
|
||||
#endif
|
||||
#define DISABLE_STEPPER_X() TERN(HAS_X_ENABLE, X_ENABLE_WRITE(!X_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_STEPPER_X2
|
||||
#if HAS_X2_ENABLE
|
||||
#define ENABLE_STEPPER_X2() X2_ENABLE_WRITE( X_ENABLE_ON)
|
||||
#else
|
||||
#define ENABLE_STEPPER_X2() NOOP
|
||||
#endif
|
||||
#define ENABLE_STEPPER_X2() TERN(HAS_X2_ENABLE, X2_ENABLE_WRITE( X_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
#ifndef DISABLE_STEPPER_X2
|
||||
#if HAS_X2_ENABLE
|
||||
#define DISABLE_STEPPER_X2() X2_ENABLE_WRITE(!X_ENABLE_ON)
|
||||
#else
|
||||
#define DISABLE_STEPPER_X2() NOOP
|
||||
#endif
|
||||
#define DISABLE_STEPPER_X2() TERN(HAS_X2_ENABLE, X2_ENABLE_WRITE(!X_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_STEPPER_Y
|
||||
#if HAS_Y_ENABLE
|
||||
#define ENABLE_STEPPER_Y() Y_ENABLE_WRITE( Y_ENABLE_ON)
|
||||
#else
|
||||
#define ENABLE_STEPPER_Y() NOOP
|
||||
#endif
|
||||
#define ENABLE_STEPPER_Y() TERN(HAS_Y_ENABLE, Y_ENABLE_WRITE( Y_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
#ifndef DISABLE_STEPPER_Y
|
||||
#if HAS_Y_ENABLE
|
||||
#define DISABLE_STEPPER_Y() Y_ENABLE_WRITE(!Y_ENABLE_ON)
|
||||
#else
|
||||
#define DISABLE_STEPPER_Y() NOOP
|
||||
#endif
|
||||
#define DISABLE_STEPPER_Y() TERN(HAS_Y_ENABLE, Y_ENABLE_WRITE(!Y_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_STEPPER_Y2
|
||||
#if HAS_Y2_ENABLE
|
||||
#define ENABLE_STEPPER_Y2() Y2_ENABLE_WRITE( Y_ENABLE_ON)
|
||||
#else
|
||||
#define ENABLE_STEPPER_Y2() NOOP
|
||||
#endif
|
||||
#define ENABLE_STEPPER_Y2() TERN(HAS_Y2_ENABLE, Y2_ENABLE_WRITE( Y_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
#ifndef DISABLE_STEPPER_Y2
|
||||
#if HAS_Y2_ENABLE
|
||||
#define DISABLE_STEPPER_Y2() Y2_ENABLE_WRITE(!Y_ENABLE_ON)
|
||||
#else
|
||||
#define DISABLE_STEPPER_Y2() NOOP
|
||||
#endif
|
||||
#define DISABLE_STEPPER_Y2() TERN(HAS_Y2_ENABLE, Y2_ENABLE_WRITE(!Y_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_STEPPER_Z
|
||||
#if HAS_Z_ENABLE
|
||||
#define ENABLE_STEPPER_Z() Z_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#else
|
||||
#define ENABLE_STEPPER_Z() NOOP
|
||||
#endif
|
||||
#define ENABLE_STEPPER_Z() TERN(HAS_Z_ENABLE, Z_ENABLE_WRITE( Z_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
#ifndef DISABLE_STEPPER_Z
|
||||
#if HAS_Z_ENABLE
|
||||
#define DISABLE_STEPPER_Z() Z_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define DISABLE_STEPPER_Z() NOOP
|
||||
#endif
|
||||
#define DISABLE_STEPPER_Z() TERN(HAS_Z_ENABLE, Z_ENABLE_WRITE(!Z_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_STEPPER_Z2
|
||||
#if HAS_Z2_ENABLE
|
||||
#define ENABLE_STEPPER_Z2() Z2_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#else
|
||||
#define ENABLE_STEPPER_Z2() NOOP
|
||||
#endif
|
||||
#define ENABLE_STEPPER_Z2() TERN(HAS_Z2_ENABLE, Z2_ENABLE_WRITE( Z_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
#ifndef DISABLE_STEPPER_Z2
|
||||
#if HAS_Z2_ENABLE
|
||||
#define DISABLE_STEPPER_Z2() Z2_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define DISABLE_STEPPER_Z2() NOOP
|
||||
#endif
|
||||
#define DISABLE_STEPPER_Z2() TERN(HAS_Z2_ENABLE, Z2_ENABLE_WRITE(!Z_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_STEPPER_Z3
|
||||
#if HAS_Z3_ENABLE
|
||||
#define ENABLE_STEPPER_Z3() Z3_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#else
|
||||
#define ENABLE_STEPPER_Z3() NOOP
|
||||
#endif
|
||||
#define ENABLE_STEPPER_Z3() TERN(HAS_Z3_ENABLE, Z3_ENABLE_WRITE( Z_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
#ifndef DISABLE_STEPPER_Z3
|
||||
#if HAS_Z3_ENABLE
|
||||
#define DISABLE_STEPPER_Z3() Z3_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define DISABLE_STEPPER_Z3() NOOP
|
||||
#endif
|
||||
#define DISABLE_STEPPER_Z3() TERN(HAS_Z3_ENABLE, Z3_ENABLE_WRITE(!Z_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_STEPPER_Z4
|
||||
#if HAS_Z4_ENABLE
|
||||
#define ENABLE_STEPPER_Z4() Z4_ENABLE_WRITE( Z_ENABLE_ON)
|
||||
#else
|
||||
#define ENABLE_STEPPER_Z4() NOOP
|
||||
#endif
|
||||
#define ENABLE_STEPPER_Z4() TERN(HAS_Z4_ENABLE, Z4_ENABLE_WRITE( Z_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
#ifndef DISABLE_STEPPER_Z4
|
||||
#if HAS_Z4_ENABLE
|
||||
#define DISABLE_STEPPER_Z4() Z4_ENABLE_WRITE(!Z_ENABLE_ON)
|
||||
#else
|
||||
#define DISABLE_STEPPER_Z4() NOOP
|
||||
#endif
|
||||
#define DISABLE_STEPPER_Z4() TERN(HAS_Z4_ENABLE, Z4_ENABLE_WRITE(!Z_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_STEPPER_I
|
||||
#define ENABLE_STEPPER_I() TERN(HAS_I_ENABLE, I_ENABLE_WRITE( I_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
#ifndef DISABLE_STEPPER_I
|
||||
#define DISABLE_STEPPER_I() TERN(HAS_I_ENABLE, I_ENABLE_WRITE(!I_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_STEPPER_J
|
||||
#define ENABLE_STEPPER_J() TERN(HAS_J_ENABLE, J_ENABLE_WRITE( J_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
#ifndef DISABLE_STEPPER_J
|
||||
#define DISABLE_STEPPER_J() TERN(HAS_J_ENABLE, J_ENABLE_WRITE(!J_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_STEPPER_K
|
||||
#define ENABLE_STEPPER_K() TERN(HAS_K_ENABLE, K_ENABLE_WRITE( K_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
#ifndef DISABLE_STEPPER_K
|
||||
#define DISABLE_STEPPER_K() TERN(HAS_K_ENABLE, K_ENABLE_WRITE(!K_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_STEPPER_E0
|
||||
#if HAS_E0_ENABLE
|
||||
#define ENABLE_STEPPER_E0() E0_ENABLE_WRITE( E_ENABLE_ON)
|
||||
#else
|
||||
#define ENABLE_STEPPER_E0() NOOP
|
||||
#endif
|
||||
#define ENABLE_STEPPER_E0() TERN(HAS_E0_ENABLE, E0_ENABLE_WRITE( E_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
#ifndef DISABLE_STEPPER_E0
|
||||
#if HAS_E0_ENABLE
|
||||
#define DISABLE_STEPPER_E0() E0_ENABLE_WRITE(!E_ENABLE_ON)
|
||||
#else
|
||||
#define DISABLE_STEPPER_E0() NOOP
|
||||
#endif
|
||||
#define DISABLE_STEPPER_E0() TERN(HAS_E0_ENABLE, E0_ENABLE_WRITE(!E_ENABLE_ON), NOOP)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_STEPPER_E1
|
||||
@@ -840,21 +858,71 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
||||
//
|
||||
// Axis steppers enable / disable macros
|
||||
//
|
||||
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
|
||||
// Avoid expensive calls to enable / disable steppers
|
||||
extern xyz_bool_t axis_sw_enabled;
|
||||
#define SHOULD_ENABLE(N) !axis_sw_enabled.N
|
||||
#define SHOULD_DISABLE(N) axis_sw_enabled.N
|
||||
#define AFTER_CHANGE(N,TF) axis_sw_enabled.N = TF
|
||||
#else
|
||||
#define SHOULD_ENABLE(N) true
|
||||
#define SHOULD_DISABLE(N) true
|
||||
#define AFTER_CHANGE(N,TF) NOOP
|
||||
#endif
|
||||
|
||||
#define ENABLE_AXIS_X() do{ ENABLE_STEPPER_X(); ENABLE_STEPPER_X2(); }while(0)
|
||||
#define DISABLE_AXIS_X() do{ DISABLE_STEPPER_X(); DISABLE_STEPPER_X2(); CBI(axis_known_position, X_AXIS); }while(0)
|
||||
#define ENABLE_AXIS_X() if (SHOULD_ENABLE(x)) { ENABLE_STEPPER_X(); ENABLE_STEPPER_X2(); AFTER_CHANGE(x, true); }
|
||||
#define DISABLE_AXIS_X() if (SHOULD_DISABLE(x)) { DISABLE_STEPPER_X(); DISABLE_STEPPER_X2(); AFTER_CHANGE(x, false); set_axis_untrusted(X_AXIS); }
|
||||
|
||||
#define ENABLE_AXIS_Y() do{ ENABLE_STEPPER_Y(); ENABLE_STEPPER_Y2(); }while(0)
|
||||
#define DISABLE_AXIS_Y() do{ DISABLE_STEPPER_Y(); DISABLE_STEPPER_Y2(); CBI(axis_known_position, Y_AXIS); }while(0)
|
||||
#if HAS_Y_AXIS
|
||||
#define ENABLE_AXIS_Y() if (SHOULD_ENABLE(y)) { ENABLE_STEPPER_Y(); ENABLE_STEPPER_Y2(); AFTER_CHANGE(y, true); }
|
||||
#define DISABLE_AXIS_Y() if (SHOULD_DISABLE(y)) { DISABLE_STEPPER_Y(); DISABLE_STEPPER_Y2(); AFTER_CHANGE(y, false); set_axis_untrusted(Y_AXIS); }
|
||||
#else
|
||||
#define ENABLE_AXIS_Y() NOOP
|
||||
#define DISABLE_AXIS_Y() NOOP
|
||||
#endif
|
||||
|
||||
#define ENABLE_AXIS_Z() do{ ENABLE_STEPPER_Z(); ENABLE_STEPPER_Z2(); ENABLE_STEPPER_Z3(); ENABLE_STEPPER_Z4(); }while(0)
|
||||
#define DISABLE_AXIS_Z() do{ DISABLE_STEPPER_Z(); DISABLE_STEPPER_Z2(); DISABLE_STEPPER_Z3(); DISABLE_STEPPER_Z4(); CBI(axis_known_position, Z_AXIS); }while(0)
|
||||
#if HAS_Z_AXIS
|
||||
#define ENABLE_AXIS_Z() if (SHOULD_ENABLE(z)) { ENABLE_STEPPER_Z(); ENABLE_STEPPER_Z2(); ENABLE_STEPPER_Z3(); ENABLE_STEPPER_Z4(); AFTER_CHANGE(z, true); }
|
||||
#define DISABLE_AXIS_Z() if (SHOULD_DISABLE(z)) { DISABLE_STEPPER_Z(); DISABLE_STEPPER_Z2(); DISABLE_STEPPER_Z3(); DISABLE_STEPPER_Z4(); AFTER_CHANGE(z, false); set_axis_untrusted(Z_AXIS); Z_RESET(); }
|
||||
#else
|
||||
#define ENABLE_AXIS_Z() NOOP
|
||||
#define DISABLE_AXIS_Z() NOOP
|
||||
#endif
|
||||
|
||||
#ifdef Z_IDLE_HEIGHT
|
||||
#define Z_RESET() do{ current_position.z = Z_IDLE_HEIGHT; sync_plan_position(); }while(0)
|
||||
#else
|
||||
#define Z_RESET()
|
||||
#endif
|
||||
|
||||
#if LINEAR_AXES >= 4
|
||||
#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 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 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
|
||||
#define DISABLE_AXIS_K() NOOP
|
||||
#endif
|
||||
|
||||
//
|
||||
// Extruder steppers enable / disable macros
|
||||
//
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
|
||||
/**
|
||||
* Mixing steppers keep all their enable (and direction) states synchronized
|
||||
*/
|
||||
@@ -862,17 +930,23 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
||||
#define _CALL_DIS_E(N) DISABLE_STEPPER_E##N () ;
|
||||
#define ENABLE_AXIS_E0() { RREPEAT(MIXING_STEPPERS, _CALL_ENA_E) }
|
||||
#define DISABLE_AXIS_E0() { RREPEAT(MIXING_STEPPERS, _CALL_DIS_E) }
|
||||
|
||||
#elif ENABLED(E_DUAL_STEPPER_DRIVERS)
|
||||
|
||||
#define ENABLE_AXIS_E0() do{ ENABLE_STEPPER_E0(); ENABLE_STEPPER_E1(); }while(0)
|
||||
#define DISABLE_AXIS_E0() do{ DISABLE_STEPPER_E0(); DISABLE_STEPPER_E1(); }while(0)
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_AXIS_E0
|
||||
#if E_STEPPERS > 0 && HAS_E0_ENABLE
|
||||
#if E_STEPPERS && HAS_E0_ENABLE
|
||||
#define ENABLE_AXIS_E0() ENABLE_STEPPER_E0()
|
||||
#else
|
||||
#define ENABLE_AXIS_E0() NOOP
|
||||
#endif
|
||||
#endif
|
||||
#ifndef DISABLE_AXIS_E0
|
||||
#if E_STEPPERS > 0 && HAS_E0_ENABLE
|
||||
#if E_STEPPERS && HAS_E0_ENABLE
|
||||
#define DISABLE_AXIS_E0() DISABLE_STEPPER_E0()
|
||||
#else
|
||||
#define DISABLE_AXIS_E0() NOOP
|
||||
|
Reference in New Issue
Block a user