️ Handle shared enable pins (#22824)

This commit is contained in:
Scott Lahteine
2021-09-28 01:07:51 -05:00
committed by Scott Lahteine
parent 25a131b942
commit 021ceeba0b
26 changed files with 523 additions and 252 deletions

View File

@ -1375,13 +1375,13 @@ void Planner::check_axes_activity() {
// Disable inactive axes
//
LOGICAL_AXIS_CODE(
if (TERN0(DISABLE_E, !axis_active.e)) disable_e_steppers(),
if (TERN0(DISABLE_X, !axis_active.x)) DISABLE_AXIS_X(),
if (TERN0(DISABLE_Y, !axis_active.y)) DISABLE_AXIS_Y(),
if (TERN0(DISABLE_Z, !axis_active.z)) DISABLE_AXIS_Z(),
if (TERN0(DISABLE_I, !axis_active.i)) DISABLE_AXIS_I(),
if (TERN0(DISABLE_J, !axis_active.j)) DISABLE_AXIS_J(),
if (TERN0(DISABLE_K, !axis_active.k)) DISABLE_AXIS_K()
if (TERN0(DISABLE_E, !axis_active.e)) stepper.disable_e_steppers(),
if (TERN0(DISABLE_X, !axis_active.x)) stepper.disable_axis(X_AXIS),
if (TERN0(DISABLE_Y, !axis_active.y)) stepper.disable_axis(Y_AXIS),
if (TERN0(DISABLE_Z, !axis_active.z)) stepper.disable_axis(Z_AXIS),
if (TERN0(DISABLE_I, !axis_active.i)) stepper.disable_axis(I_AXIS),
if (TERN0(DISABLE_J, !axis_active.j)) stepper.disable_axis(J_AXIS),
if (TERN0(DISABLE_K, !axis_active.k)) stepper.disable_axis(K_AXIS)
);
//
@ -1707,7 +1707,7 @@ float Planner::triggered_position_mm(const AxisEnum axis) {
void Planner::finish_and_disable() {
while (has_blocks_queued() || cleaning_buffer_counter) idle();
disable_all_steppers();
stepper.disable_all_steppers();
}
/**
@ -2144,7 +2144,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
block->e_to_p_pressure = baricuda_e_to_p_pressure;
#endif
TERN_(HAS_MULTI_EXTRUDER, block->extruder = extruder);
E_TERN_(block->extruder = extruder);
#if ENABLED(AUTO_POWER_CONTROL)
if (LINEAR_AXIS_GANG(
@ -2160,43 +2160,43 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
// Enable active axes
#if EITHER(CORE_IS_XY, MARKFORGED_XY)
if (block->steps.a || block->steps.b) {
ENABLE_AXIS_X();
ENABLE_AXIS_Y();
stepper.enable_axis(X_AXIS);
stepper.enable_axis(Y_AXIS);
}
#if DISABLED(Z_LATE_ENABLE)
if (block->steps.z) ENABLE_AXIS_Z();
if (block->steps.z) stepper.enable_axis(Z_AXIS);
#endif
#elif CORE_IS_XZ
if (block->steps.a || block->steps.c) {
ENABLE_AXIS_X();
ENABLE_AXIS_Z();
stepper.enable_axis(X_AXIS);
stepper.enable_axis(Z_AXIS);
}
if (block->steps.y) ENABLE_AXIS_Y();
if (block->steps.y) stepper.enable_axis(Y_AXIS);
#elif CORE_IS_YZ
if (block->steps.b || block->steps.c) {
ENABLE_AXIS_Y();
ENABLE_AXIS_Z();
stepper.enable_axis(Y_AXIS);
stepper.enable_axis(Z_AXIS);
}
if (block->steps.x) ENABLE_AXIS_X();
if (block->steps.x) stepper.enable_axis(X_AXIS);
#else
LINEAR_AXIS_CODE(
if (block->steps.x) ENABLE_AXIS_X(),
if (block->steps.y) ENABLE_AXIS_Y(),
if (TERN(Z_LATE_ENABLE, 0, block->steps.z)) ENABLE_AXIS_Z(),
if (block->steps.i) ENABLE_AXIS_I(),
if (block->steps.j) ENABLE_AXIS_J(),
if (block->steps.k) ENABLE_AXIS_K()
if (block->steps.x) stepper.enable_axis(X_AXIS),
if (block->steps.y) stepper.enable_axis(Y_AXIS),
if (TERN(Z_LATE_ENABLE, 0, block->steps.z)) stepper.enable_axis(Z_AXIS),
if (block->steps.i) stepper.enable_axis(I_AXIS),
if (block->steps.j) stepper.enable_axis(J_AXIS),
if (block->steps.k) stepper.enable_axis(K_AXIS)
);
#endif
#if EITHER(IS_CORE, MARKFORGED_XY)
#if LINEAR_AXES >= 4
if (block->steps.i) ENABLE_AXIS_I();
if (block->steps.i) stepper.enable_axis(I_AXIS);
#endif
#if LINEAR_AXES >= 5
if (block->steps.j) ENABLE_AXIS_J();
if (block->steps.j) stepper.enable_axis(J_AXIS);
#endif
#if LINEAR_AXES >= 6
if (block->steps.k) ENABLE_AXIS_K();
if (block->steps.k) stepper.enable_axis(K_AXIS);
#endif
#endif
@ -2214,27 +2214,27 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
#define ENABLE_ONE_E(N) do{ \
if (E_STEPPER_INDEX(extruder) == N) { \
ENABLE_AXIS_E##N(); \
stepper.ENABLE_EXTRUDER(N); \
g_uc_extruder_last_move[N] = (BLOCK_BUFFER_SIZE) * 2; \
if ((N) == 0 && TERN0(HAS_DUPLICATION_MODE, extruder_duplication_enabled)) \
ENABLE_AXIS_E1(); \
stepper.ENABLE_EXTRUDER(1); \
} \
else if (!g_uc_extruder_last_move[N]) { \
DISABLE_AXIS_E##N(); \
stepper.DISABLE_EXTRUDER(N); \
if ((N) == 0 && TERN0(HAS_DUPLICATION_MODE, extruder_duplication_enabled)) \
DISABLE_AXIS_E1(); \
stepper.DISABLE_EXTRUDER(1); \
} \
}while(0);
#else
#define ENABLE_ONE_E(N) ENABLE_AXIS_E##N();
#define ENABLE_ONE_E(N) stepper.ENABLE_EXTRUDER(N);
#endif
REPEAT(E_STEPPERS, ENABLE_ONE_E); // (ENABLE_ONE_E must end with semicolon)
}
#endif // EXTRUDERS
#endif // HAS_EXTRUDERS
if (esteps)
NOLESS(fr_mm_s, settings.min_feedrate_mm_s);
@ -3049,7 +3049,7 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s, cons
FANS_LOOP(i) block->fan_speed[i] = thermalManager.fan_speed[i];
#endif
TERN_(HAS_MULTI_EXTRUDER, block->extruder = extruder);
E_TERN_(block->extruder = extruder);
block->page_idx = page_idx;
@ -3085,7 +3085,7 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s, cons
// Move buffer head
block_buffer_head = next_buffer_head;
enable_all_steppers();
stepper.enable_all_steppers();
stepper.wake_up();
}