⚡️ Handle shared enable pins (#22824)
This commit is contained in:
@@ -81,10 +81,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
#include "lcd/extui/ui_api.h"
|
||||
#endif
|
||||
|
||||
#if HAS_ETHERNET
|
||||
#include "feature/ethernet.h"
|
||||
#endif
|
||||
@@ -312,48 +308,6 @@ bool pin_is_protected(const pin_t pin) {
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
void enable_e_steppers() {
|
||||
#define _ENA_E(N) ENABLE_AXIS_E##N();
|
||||
REPEAT(E_STEPPERS, _ENA_E)
|
||||
}
|
||||
|
||||
void enable_all_steppers() {
|
||||
TERN_(AUTO_POWER_CONTROL, powerManager.power_on());
|
||||
ENABLE_AXIS_X();
|
||||
ENABLE_AXIS_Y();
|
||||
ENABLE_AXIS_Z();
|
||||
ENABLE_AXIS_I(); // Marlin 6-axis support by DerAndere (https://github.com/DerAndere1/Marlin/wiki)
|
||||
ENABLE_AXIS_J();
|
||||
ENABLE_AXIS_K();
|
||||
enable_e_steppers();
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onSteppersEnabled());
|
||||
}
|
||||
|
||||
void disable_e_steppers() {
|
||||
#define _DIS_E(N) DISABLE_AXIS_E##N();
|
||||
REPEAT(E_STEPPERS, _DIS_E)
|
||||
}
|
||||
|
||||
void disable_e_stepper(const uint8_t e) {
|
||||
#define _CASE_DIS_E(N) case N: DISABLE_AXIS_E##N(); break;
|
||||
switch (e) {
|
||||
REPEAT(E_STEPPERS, _CASE_DIS_E)
|
||||
}
|
||||
}
|
||||
|
||||
void disable_all_steppers() {
|
||||
DISABLE_AXIS_X();
|
||||
DISABLE_AXIS_Y();
|
||||
DISABLE_AXIS_Z();
|
||||
DISABLE_AXIS_I();
|
||||
DISABLE_AXIS_J();
|
||||
DISABLE_AXIS_K();
|
||||
disable_e_steppers();
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onSteppersDisabled());
|
||||
}
|
||||
|
||||
/**
|
||||
* A Print Job exists when the timer is running or SD is printing
|
||||
*/
|
||||
@@ -464,13 +418,13 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this
|
||||
|
||||
// Individual axes will be disabled if configured
|
||||
if (ENABLED(DISABLE_INACTIVE_X)) DISABLE_AXIS_X();
|
||||
if (ENABLED(DISABLE_INACTIVE_Y)) DISABLE_AXIS_Y();
|
||||
if (ENABLED(DISABLE_INACTIVE_Z)) DISABLE_AXIS_Z();
|
||||
if (ENABLED(DISABLE_INACTIVE_I)) DISABLE_AXIS_I();
|
||||
if (ENABLED(DISABLE_INACTIVE_J)) DISABLE_AXIS_J();
|
||||
if (ENABLED(DISABLE_INACTIVE_K)) DISABLE_AXIS_K();
|
||||
if (ENABLED(DISABLE_INACTIVE_E)) disable_e_steppers();
|
||||
TERN_(DISABLE_INACTIVE_X, stepper.disable_axis(X_AXIS));
|
||||
TERN_(DISABLE_INACTIVE_Y, stepper.disable_axis(Y_AXIS));
|
||||
TERN_(DISABLE_INACTIVE_Z, stepper.disable_axis(Z_AXIS));
|
||||
TERN_(DISABLE_INACTIVE_I, stepper.disable_axis(I_AXIS));
|
||||
TERN_(DISABLE_INACTIVE_J, stepper.disable_axis(J_AXIS));
|
||||
TERN_(DISABLE_INACTIVE_K, stepper.disable_axis(K_AXIS));
|
||||
TERN_(DISABLE_INACTIVE_E, stepper.disable_e_steppers());
|
||||
|
||||
TERN_(AUTO_BED_LEVELING_UBL, ubl.steppers_were_disabled());
|
||||
}
|
||||
@@ -689,13 +643,13 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
#if ENABLED(SWITCHING_EXTRUDER)
|
||||
bool oldstatus;
|
||||
switch (active_extruder) {
|
||||
default: oldstatus = E0_ENABLE_READ(); ENABLE_AXIS_E0(); break;
|
||||
default: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, 0); stepper.ENABLE_EXTRUDER(0); break;
|
||||
#if E_STEPPERS > 1
|
||||
case 2: case 3: oldstatus = E1_ENABLE_READ(); ENABLE_AXIS_E1(); break;
|
||||
case 2: case 3: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, 1); stepper.ENABLE_EXTRUDER(1); break;
|
||||
#if E_STEPPERS > 2
|
||||
case 4: case 5: oldstatus = E2_ENABLE_READ(); ENABLE_AXIS_E2(); break;
|
||||
case 4: case 5: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, 2); stepper.ENABLE_EXTRUDER(2); break;
|
||||
#if E_STEPPERS > 3
|
||||
case 6: case 7: oldstatus = E3_ENABLE_READ(); ENABLE_AXIS_E3(); break;
|
||||
case 6: case 7: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, 3); stepper.ENABLE_EXTRUDER(3); break;
|
||||
#endif // E_STEPPERS > 3
|
||||
#endif // E_STEPPERS > 2
|
||||
#endif // E_STEPPERS > 1
|
||||
@@ -704,7 +658,7 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
bool oldstatus;
|
||||
switch (active_extruder) {
|
||||
default:
|
||||
#define _CASE_EN(N) case N: oldstatus = E##N##_ENABLE_READ(); ENABLE_AXIS_E##N(); break;
|
||||
#define _CASE_EN(N) case N: oldstatus = stepper.AXIS_IS_ENABLED(E_AXIS, N); stepper.ENABLE_EXTRUDER(N); break;
|
||||
REPEAT(E_STEPPERS, _CASE_EN);
|
||||
}
|
||||
#endif
|
||||
@@ -718,17 +672,17 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
|
||||
|
||||
#if ENABLED(SWITCHING_EXTRUDER)
|
||||
switch (active_extruder) {
|
||||
default: oldstatus = E0_ENABLE_WRITE(oldstatus); break;
|
||||
default: if (oldstatus) stepper.ENABLE_EXTRUDER(0); else stepper.DISABLE_EXTRUDER(0); break;
|
||||
#if E_STEPPERS > 1
|
||||
case 2: case 3: oldstatus = E1_ENABLE_WRITE(oldstatus); break;
|
||||
case 2: case 3: if (oldstatus) stepper.ENABLE_EXTRUDER(1); else stepper.DISABLE_EXTRUDER(1); break;
|
||||
#if E_STEPPERS > 2
|
||||
case 4: case 5: oldstatus = E2_ENABLE_WRITE(oldstatus); break;
|
||||
case 4: case 5: if (oldstatus) stepper.ENABLE_EXTRUDER(2); else stepper.DISABLE_EXTRUDER(2); break;
|
||||
#endif // E_STEPPERS > 2
|
||||
#endif // E_STEPPERS > 1
|
||||
}
|
||||
#else // !SWITCHING_EXTRUDER
|
||||
switch (active_extruder) {
|
||||
#define _CASE_RESTORE(N) case N: E##N##_ENABLE_WRITE(oldstatus); break;
|
||||
#define _CASE_RESTORE(N) case N: if (oldstatus) stepper.ENABLE_EXTRUDER(N); else stepper.DISABLE_EXTRUDER(N); break;
|
||||
REPEAT(E_STEPPERS, _CASE_RESTORE);
|
||||
}
|
||||
#endif // !SWITCHING_EXTRUDER
|
||||
@@ -940,7 +894,7 @@ void minkill(const bool steppers_off/*=false*/) {
|
||||
TERN_(HAS_CUTTER, cutter.kill()); // Reiterate cutter shutdown
|
||||
|
||||
// Power off all steppers (for M112) or just the E steppers
|
||||
steppers_off ? disable_all_steppers() : disable_e_steppers();
|
||||
steppers_off ? stepper.disable_all_steppers() : stepper.disable_e_steppers();
|
||||
|
||||
TERN_(PSU_CONTROL, powerManager.power_off());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user