diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 21e72b3db2244..6d74a130c79c4 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1104,17 +1104,17 @@ // Add a Duplicate option for well-separated conjoined nozzles //#define MULTI_NOZZLE_DUPLICATION -// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step. -#define INVERT_X_STEP_PIN false -#define INVERT_Y_STEP_PIN false -#define INVERT_Z_STEP_PIN false -#define INVERT_I_STEP_PIN false -#define INVERT_J_STEP_PIN false -#define INVERT_K_STEP_PIN false -#define INVERT_U_STEP_PIN false -#define INVERT_V_STEP_PIN false -#define INVERT_W_STEP_PIN false -#define INVERT_E_STEP_PIN false +// By default stepper drivers require an active-HIGH signal but some high-power drivers require an active-LOW signal to step. +#define STEP_STATE_X HIGH +#define STEP_STATE_Y HIGH +#define STEP_STATE_Z HIGH +#define STEP_STATE_I HIGH +#define STEP_STATE_J HIGH +#define STEP_STATE_K HIGH +#define STEP_STATE_U HIGH +#define STEP_STATE_V HIGH +#define STEP_STATE_W HIGH +#define STEP_STATE_E HIGH /** * Idle Stepper Shutdown diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index eacc5d191627b..ff2e54e393da5 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -99,6 +99,7 @@ #undef SHAPING_BUFFER_Y #undef SHAPING_FREQ_Y #undef STEALTHCHOP_Y + #undef STEP_STATE_Y #endif #if !HAS_Z_AXIS @@ -112,6 +113,7 @@ #undef NUM_Z_STEPPERS #undef SAFE_BED_LEVELING_START_Z #undef STEALTHCHOP_Z + #undef STEP_STATE_Z #undef Z_IDLE_HEIGHT #undef Z_PROBE_SLED #undef Z_SAFE_HOMING @@ -123,6 +125,7 @@ #undef DISABLE_INACTIVE_I #undef SAFE_BED_LEVELING_START_I #undef STEALTHCHOP_I + #undef STEP_STATE_I #endif #if !HAS_J_AXIS @@ -131,6 +134,7 @@ #undef DISABLE_INACTIVE_J #undef SAFE_BED_LEVELING_START_J #undef STEALTHCHOP_J + #undef STEP_STATE_J #endif #if !HAS_K_AXIS @@ -139,6 +143,7 @@ #undef DISABLE_INACTIVE_K #undef SAFE_BED_LEVELING_START_K #undef STEALTHCHOP_K + #undef STEP_STATE_K #endif #if !HAS_U_AXIS @@ -147,6 +152,7 @@ #undef DISABLE_INACTIVE_U #undef SAFE_BED_LEVELING_START_U #undef STEALTHCHOP_U + #undef STEP_STATE_U #endif #if !HAS_V_AXIS @@ -155,6 +161,7 @@ #undef DISABLE_INACTIVE_V #undef SAFE_BED_LEVELING_START_V #undef STEALTHCHOP_V + #undef STEP_STATE_V #endif #if !HAS_W_AXIS @@ -163,6 +170,7 @@ #undef DISABLE_INACTIVE_W #undef SAFE_BED_LEVELING_START_W #undef STEALTHCHOP_W + #undef STEP_STATE_W #endif // Disallowed with no extruders diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 2f7e389b497b8..11d27d6eaf9c7 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -674,6 +674,8 @@ #error "BABYSTEP_ZPROBE_GFX_OVERLAY is now BABYSTEP_GFX_OVERLAY." #elif defined(DISABLE_INACTIVE_E) #error "DISABLE_INACTIVE_E is now set with DISABLE_INACTIVE_EXTRUDER." +#elif defined(INVERT_X_STEP_PIN) || defined(INVERT_Y_STEP_PIN) || defined(INVERT_Z_STEP_PIN) || defined(INVERT_I_STEP_PIN) || defined(INVERT_J_STEP_PIN) || defined(INVERT_K_STEP_PIN) || defined(INVERT_U_STEP_PIN) || defined(INVERT_V_STEP_PIN) || defined(INVERT_W_STEP_PIN) || defined(INVERT_E_STEP_PIN) + #error "INVERT_*_STEP_PIN true is now STEP_STATE_* LOW, and INVERT_*_STEP_PIN false is now STEP_STATE_* HIGH." #endif // L64xx stepper drivers have been removed diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index f9de7498d72d1..c636ec1ee29ca 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -1933,7 +1933,7 @@ void Stepper::pulse_phase_isr() { #if ENABLED(MIXING_EXTRUDER) if (step_needed.e) { count_position[E_AXIS] += count_direction[E_AXIS]; - E_STEP_WRITE(mixer.get_next_stepper(), !INVERT_E_STEP_PIN); + E_STEP_WRITE(mixer.get_next_stepper(), STEP_STATE_E); } #elif HAS_E0_STEP PULSE_START(E); @@ -1977,7 +1977,7 @@ void Stepper::pulse_phase_isr() { #endif #if ENABLED(MIXING_EXTRUDER) - if (step_needed.e) E_STEP_WRITE(mixer.get_stepper(), INVERT_E_STEP_PIN); + if (step_needed.e) E_STEP_WRITE(mixer.get_stepper(), !STEP_STATE_E); #elif HAS_E0_STEP PULSE_STOP(E); #endif @@ -2638,7 +2638,7 @@ uint32_t Stepper::block_phase_isr() { la_delta_error -= advance_divisor; // Set the STEP pulse ON - E_STEP_WRITE(TERN(MIXING_EXTRUDER, mixer.get_next_stepper(), stepper_extruder), !INVERT_E_STEP_PIN); + E_STEP_WRITE(TERN(MIXING_EXTRUDER, mixer.get_next_stepper(), stepper_extruder), STEP_STATE_E); } TERN_(I2S_STEPPER_STREAM, i2s_push_sample()); @@ -2652,7 +2652,7 @@ uint32_t Stepper::block_phase_isr() { #endif // Set the STEP pulse OFF - E_STEP_WRITE(TERN(MIXING_EXTRUDER, mixer.get_stepper(), stepper_extruder), INVERT_E_STEP_PIN); + E_STEP_WRITE(TERN(MIXING_EXTRUDER, mixer.get_stepper(), stepper_extruder), !STEP_STATE_E); } } @@ -2915,7 +2915,7 @@ void Stepper::init() { #if HAS_X_STEP #if HAS_X2_STEPPER X2_STEP_INIT(); - X2_STEP_WRITE(INVERT_X_STEP_PIN); + X2_STEP_WRITE(!STEP_STATE_X); #endif AXIS_INIT(X, X); #endif @@ -2923,7 +2923,7 @@ void Stepper::init() { #if HAS_Y_STEP #if HAS_DUAL_Y_STEPPERS Y2_STEP_INIT(); - Y2_STEP_WRITE(INVERT_Y_STEP_PIN); + Y2_STEP_WRITE(!STEP_STATE_Y); #endif AXIS_INIT(Y, Y); #endif @@ -2931,15 +2931,15 @@ void Stepper::init() { #if HAS_Z_STEP #if NUM_Z_STEPPERS >= 2 Z2_STEP_INIT(); - Z2_STEP_WRITE(INVERT_Z_STEP_PIN); + Z2_STEP_WRITE(!STEP_STATE_Z); #endif #if NUM_Z_STEPPERS >= 3 Z3_STEP_INIT(); - Z3_STEP_WRITE(INVERT_Z_STEP_PIN); + Z3_STEP_WRITE(!STEP_STATE_Z); #endif #if NUM_Z_STEPPERS >= 4 Z4_STEP_INIT(); - Z4_STEP_WRITE(INVERT_Z_STEP_PIN); + Z4_STEP_WRITE(!STEP_STATE_Z); #endif AXIS_INIT(Z, Z); #endif @@ -3466,58 +3466,58 @@ void Stepper::report_positions() { _SAVE_START(); - X_STEP_WRITE(!INVERT_X_STEP_PIN); + X_STEP_WRITE(STEP_STATE_X); #ifdef Y_STEP_WRITE - Y_STEP_WRITE(!INVERT_Y_STEP_PIN); + Y_STEP_WRITE(STEP_STATE_Y); #endif #ifdef Z_STEP_WRITE - Z_STEP_WRITE(!INVERT_Z_STEP_PIN); + Z_STEP_WRITE(STEP_STATE_Z); #endif #ifdef I_STEP_WRITE - I_STEP_WRITE(!INVERT_I_STEP_PIN); + I_STEP_WRITE(STEP_STATE_I); #endif #ifdef J_STEP_WRITE - J_STEP_WRITE(!INVERT_J_STEP_PIN); + J_STEP_WRITE(STEP_STATE_J); #endif #ifdef K_STEP_WRITE - K_STEP_WRITE(!INVERT_K_STEP_PIN); + K_STEP_WRITE(STEP_STATE_K); #endif #ifdef U_STEP_WRITE - U_STEP_WRITE(!INVERT_U_STEP_PIN); + U_STEP_WRITE(STEP_STATE_U); #endif #ifdef V_STEP_WRITE - V_STEP_WRITE(!INVERT_V_STEP_PIN); + V_STEP_WRITE(STEP_STATE_V); #endif #ifdef W_STEP_WRITE - W_STEP_WRITE(!INVERT_W_STEP_PIN); + W_STEP_WRITE(STEP_STATE_W); #endif _PULSE_WAIT(); - X_STEP_WRITE(INVERT_X_STEP_PIN); + X_STEP_WRITE(!STEP_STATE_X); #ifdef Y_STEP_WRITE - Y_STEP_WRITE(INVERT_Y_STEP_PIN); + Y_STEP_WRITE(!STEP_STATE_Y); #endif #ifdef Z_STEP_WRITE - Z_STEP_WRITE(INVERT_Z_STEP_PIN); + Z_STEP_WRITE(!STEP_STATE_Z); #endif #ifdef I_STEP_WRITE - I_STEP_WRITE(INVERT_I_STEP_PIN); + I_STEP_WRITE(!STEP_STATE_I); #endif #ifdef J_STEP_WRITE - J_STEP_WRITE(INVERT_J_STEP_PIN); + J_STEP_WRITE(!STEP_STATE_J); #endif #ifdef K_STEP_WRITE - K_STEP_WRITE(INVERT_K_STEP_PIN); + K_STEP_WRITE(!STEP_STATE_K); #endif #ifdef U_STEP_WRITE - U_STEP_WRITE(INVERT_U_STEP_PIN); + U_STEP_WRITE(!STEP_STATE_U); #endif #ifdef V_STEP_WRITE - V_STEP_WRITE(INVERT_V_STEP_PIN); + V_STEP_WRITE(!STEP_STATE_V); #endif #ifdef W_STEP_WRITE - W_STEP_WRITE(INVERT_W_STEP_PIN); + W_STEP_WRITE(!STEP_STATE_W); #endif // Restore direction bits