0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-01-19 16:16:13 +00:00

🎨 Misc. fixes, cleanup

This commit is contained in:
Scott Lahteine 2023-04-26 13:50:45 -05:00
parent 08edb6282f
commit 68f74784a3
9 changed files with 119 additions and 263 deletions

View file

@ -67,6 +67,8 @@ template <class L, class R> struct IF<true, L, R> { typedef L type; };
#define SECONDARY_AXIS_GANG(V...) GANG_N(SECONDARY_AXES, V)
#define SECONDARY_AXIS_CODE(V...) CODE_N(SECONDARY_AXES, V)
#define SECONDARY_AXIS_LIST(V...) LIST_N(SECONDARY_AXES, V)
#define SECONDARY_AXIS_ARGS(T) SECONDARY_AXIS_LIST(T i, T j, T k, T u, T v, T w)
#if HAS_ROTATIONAL_AXES
#define ROTATIONAL_AXIS_GANG(V...) GANG_N(ROTATIONAL_AXES, V)

View file

@ -22,7 +22,7 @@
#include "../../inc/MarlinConfig.h"
#if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS
#if EITHER(DELTA, HAS_EXTRA_ENDSTOPS)
#include "../gcode.h"

View file

@ -954,7 +954,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 665: M665(); break; // M665: Set Kinematics parameters
#endif
#if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS
#if EITHER(DELTA, HAS_EXTRA_ENDSTOPS)
case 666: M666(); break; // M666: Set delta or multiple endstop adjustment
#endif

View file

@ -514,12 +514,12 @@ void Endstops::update() {
#endif
// Macros to update / copy the live_state
#define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ_ENDSTOP(_ENDSTOP_PIN(AXIS, MINMAX)) == _ENDSTOP_HIT_STATE(AXIS, MINMAX)))
#define UPDATE_LIVE_STATE(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ_ENDSTOP(_ENDSTOP_PIN(AXIS, MINMAX)) == _ENDSTOP_HIT_STATE(AXIS, MINMAX)))
#define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT))
#if ENABLED(G38_PROBE_TARGET)
// For G38 moves check the probe's pin for ALL movement
if (G38_move) UPDATE_ENDSTOP_BIT(Z, TERN(USES_Z_MIN_PROBE_PIN, MIN_PROBE, MIN));
if (G38_move) UPDATE_LIVE_STATE(Z, TERN(USES_Z_MIN_PROBE_PIN, MIN_PROBE, MIN));
#endif
// With Dual X, endstops are only checked in the homing direction for the active extruder
@ -554,10 +554,10 @@ void Endstops::update() {
* Check and update endstops
*/
#if HAS_X_MIN && !X_SPI_SENSORLESS
UPDATE_ENDSTOP_BIT(X, MIN);
UPDATE_LIVE_STATE(X, MIN);
#if ENABLED(X_DUAL_ENDSTOPS)
#if HAS_X2_MIN
UPDATE_ENDSTOP_BIT(X2, MIN);
UPDATE_LIVE_STATE(X2, MIN);
#else
COPY_LIVE_STATE(X_MIN, X2_MIN);
#endif
@ -565,10 +565,10 @@ void Endstops::update() {
#endif
#if HAS_X_MAX && !X_SPI_SENSORLESS
UPDATE_ENDSTOP_BIT(X, MAX);
UPDATE_LIVE_STATE(X, MAX);
#if ENABLED(X_DUAL_ENDSTOPS)
#if HAS_X2_MAX
UPDATE_ENDSTOP_BIT(X2, MAX);
UPDATE_LIVE_STATE(X2, MAX);
#else
COPY_LIVE_STATE(X_MAX, X2_MAX);
#endif
@ -576,10 +576,10 @@ void Endstops::update() {
#endif
#if HAS_Y_MIN && !Y_SPI_SENSORLESS
UPDATE_ENDSTOP_BIT(Y, MIN);
UPDATE_LIVE_STATE(Y, MIN);
#if ENABLED(Y_DUAL_ENDSTOPS)
#if HAS_Y2_MIN
UPDATE_ENDSTOP_BIT(Y2, MIN);
UPDATE_LIVE_STATE(Y2, MIN);
#else
COPY_LIVE_STATE(Y_MIN, Y2_MIN);
#endif
@ -587,10 +587,10 @@ void Endstops::update() {
#endif
#if HAS_Y_MAX && !Y_SPI_SENSORLESS
UPDATE_ENDSTOP_BIT(Y, MAX);
UPDATE_LIVE_STATE(Y, MAX);
#if ENABLED(Y_DUAL_ENDSTOPS)
#if HAS_Y2_MAX
UPDATE_ENDSTOP_BIT(Y2, MAX);
UPDATE_LIVE_STATE(Y2, MAX);
#else
COPY_LIVE_STATE(Y_MAX, Y2_MAX);
#endif
@ -598,23 +598,23 @@ void Endstops::update() {
#endif
#if HAS_Z_MIN && NONE(Z_SPI_SENSORLESS, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
UPDATE_ENDSTOP_BIT(Z, MIN);
UPDATE_LIVE_STATE(Z, MIN);
#if ENABLED(Z_MULTI_ENDSTOPS)
#if HAS_Z2_MIN
UPDATE_ENDSTOP_BIT(Z2, MIN);
UPDATE_LIVE_STATE(Z2, MIN);
#else
COPY_LIVE_STATE(Z_MIN, Z2_MIN);
#endif
#if NUM_Z_STEPPERS >= 3
#if HAS_Z3_MIN
UPDATE_ENDSTOP_BIT(Z3, MIN);
UPDATE_LIVE_STATE(Z3, MIN);
#else
COPY_LIVE_STATE(Z_MIN, Z3_MIN);
#endif
#endif
#if NUM_Z_STEPPERS >= 4
#if HAS_Z4_MIN
UPDATE_ENDSTOP_BIT(Z4, MIN);
UPDATE_LIVE_STATE(Z4, MIN);
#else
COPY_LIVE_STATE(Z_MIN, Z4_MIN);
#endif
@ -625,189 +625,129 @@ void Endstops::update() {
#if HAS_BED_PROBE
// When closing the gap check the enabled probe
if (probe_switch_activated())
UPDATE_ENDSTOP_BIT(Z, TERN(USES_Z_MIN_PROBE_PIN, MIN_PROBE, MIN));
UPDATE_LIVE_STATE(Z, TERN(USES_Z_MIN_PROBE_PIN, MIN_PROBE, MIN));
#endif
#if HAS_Z_MAX && !Z_SPI_SENSORLESS
// Check both Z dual endstops
#if ENABLED(Z_MULTI_ENDSTOPS)
UPDATE_ENDSTOP_BIT(Z, MAX);
UPDATE_LIVE_STATE(Z, MAX);
#if HAS_Z2_MAX
UPDATE_ENDSTOP_BIT(Z2, MAX);
UPDATE_LIVE_STATE(Z2, MAX);
#else
COPY_LIVE_STATE(Z_MAX, Z2_MAX);
#endif
#if NUM_Z_STEPPERS >= 3
#if HAS_Z3_MAX
UPDATE_ENDSTOP_BIT(Z3, MAX);
UPDATE_LIVE_STATE(Z3, MAX);
#else
COPY_LIVE_STATE(Z_MAX, Z3_MAX);
#endif
#endif
#if NUM_Z_STEPPERS >= 4
#if HAS_Z4_MAX
UPDATE_ENDSTOP_BIT(Z4, MAX);
UPDATE_LIVE_STATE(Z4, MAX);
#else
COPY_LIVE_STATE(Z_MAX, Z4_MAX);
#endif
#endif
#elif TERN1(USES_Z_MIN_PROBE_PIN, Z_MAX_PIN != Z_MIN_PROBE_PIN)
// If this pin isn't the bed probe it's the Z endstop
UPDATE_ENDSTOP_BIT(Z, MAX);
UPDATE_LIVE_STATE(Z, MAX);
#endif
#endif
#if HAS_I_MIN && !I_SPI_SENSORLESS
#if ENABLED(I_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(I, MIN);
#if HAS_I2_MIN
UPDATE_ENDSTOP_BIT(I2, MAX);
UPDATE_LIVE_STATE(I, MIN);
#else
COPY_LIVE_STATE(I_MIN, I2_MIN);
#endif
#else
UPDATE_ENDSTOP_BIT(I, MIN);
UPDATE_LIVE_STATE(I, MIN);
#endif
#endif
#if HAS_I_MAX && !I_SPI_SENSORLESS
#if ENABLED(I_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(I, MAX);
#if HAS_I2_MAX
UPDATE_ENDSTOP_BIT(I2, MAX);
UPDATE_LIVE_STATE(I, MAX);
#else
COPY_LIVE_STATE(I_MAX, I2_MAX);
#endif
#else
UPDATE_ENDSTOP_BIT(I, MAX);
UPDATE_LIVE_STATE(I, MAX);
#endif
#endif
#if HAS_J_MIN && !J_SPI_SENSORLESS
#if ENABLED(J_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(J, MIN);
#if HAS_J2_MIN
UPDATE_ENDSTOP_BIT(J2, MIN);
UPDATE_LIVE_STATE(J, MIN);
#else
COPY_LIVE_STATE(J_MIN, J2_MIN);
#endif
#else
UPDATE_ENDSTOP_BIT(J, MIN);
UPDATE_LIVE_STATE(J, MIN);
#endif
#endif
#if HAS_J_MAX && !J_SPI_SENSORLESS
#if ENABLED(J_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(J, MAX);
#if HAS_J2_MAX
UPDATE_ENDSTOP_BIT(J2, MAX);
UPDATE_LIVE_STATE(J, MAX);
#else
COPY_LIVE_STATE(J_MAX, J2_MAX);
#endif
#else
UPDATE_ENDSTOP_BIT(J, MAX);
UPDATE_LIVE_STATE(J, MAX);
#endif
#endif
#if HAS_K_MIN && !K_SPI_SENSORLESS
#if ENABLED(K_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(K, MIN);
#if HAS_K2_MIN
UPDATE_ENDSTOP_BIT(K2, MIN);
UPDATE_LIVE_STATE(K, MIN);
#else
COPY_LIVE_STATE(K_MIN, K2_MIN);
#endif
#else
UPDATE_ENDSTOP_BIT(K, MIN);
UPDATE_LIVE_STATE(K, MIN);
#endif
#endif
#if HAS_K_MAX && !K_SPI_SENSORLESS
#if ENABLED(K_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(K, MAX);
#if HAS_K2_MAX
UPDATE_ENDSTOP_BIT(K2, MAX);
UPDATE_LIVE_STATE(K, MAX);
#else
COPY_LIVE_STATE(K_MAX, K2_MAX);
#endif
#else
UPDATE_ENDSTOP_BIT(K, MAX);
UPDATE_LIVE_STATE(K, MAX);
#endif
#endif
#if HAS_U_MIN && !U_SPI_SENSORLESS
#if ENABLED(U_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(U, MIN);
#if HAS_U2_MIN
UPDATE_ENDSTOP_BIT(U2, MIN);
UPDATE_LIVE_STATE(U, MIN);
#else
COPY_LIVE_STATE(U_MIN, U2_MIN);
#endif
#else
UPDATE_ENDSTOP_BIT(U, MIN);
UPDATE_LIVE_STATE(U, MIN);
#endif
#endif
#if HAS_U_MAX && !U_SPI_SENSORLESS
#if ENABLED(U_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(U, MAX);
#if HAS_U2_MAX
UPDATE_ENDSTOP_BIT(U2, MAX);
UPDATE_LIVE_STATE(U, MAX);
#else
COPY_LIVE_STATE(U_MAX, U2_MAX);
#endif
#else
UPDATE_ENDSTOP_BIT(U, MAX);
UPDATE_LIVE_STATE(U, MAX);
#endif
#endif
#if HAS_V_MIN && !V_SPI_SENSORLESS
#if ENABLED(V_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(V, MIN);
#if HAS_V2_MIN
UPDATE_ENDSTOP_BIT(V2, MIN);
UPDATE_LIVE_STATE(V, MIN);
#else
COPY_LIVE_STATE(V_MIN, V2_MIN);
#endif
#else
UPDATE_ENDSTOP_BIT(V, MIN);
UPDATE_LIVE_STATE(V, MIN);
#endif
#endif
#if HAS_V_MAX && !V_SPI_SENSORLESS
#if ENABLED(O_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(V, MAX);
#if HAS_V2_MAX
UPDATE_ENDSTOP_BIT(V2, MAX);
UPDATE_LIVE_STATE(V, MAX);
#else
COPY_LIVE_STATE(V_MAX, V2_MAX);
#endif
#else
UPDATE_ENDSTOP_BIT(V, MAX);
UPDATE_LIVE_STATE(V, MAX);
#endif
#endif
#if HAS_W_MIN && !W_SPI_SENSORLESS
#if ENABLED(W_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(W, MIN);
#if HAS_W2_MIN
UPDATE_ENDSTOP_BIT(W2, MIN);
UPDATE_LIVE_STATE(W, MIN);
#else
COPY_LIVE_STATE(W_MIN, W2_MIN);
#endif
#else
UPDATE_ENDSTOP_BIT(W, MIN);
UPDATE_LIVE_STATE(W, MIN);
#endif
#endif
#if HAS_W_MAX && !W_SPI_SENSORLESS
#if ENABLED(W_DUAL_ENDSTOPS)
UPDATE_ENDSTOP_BIT(W, MAX);
#if HAS_W2_MAX
UPDATE_ENDSTOP_BIT(W2, MAX);
UPDATE_LIVE_STATE(W, MAX);
#else
COPY_LIVE_STATE(W_MAX, W2_MAX);
#endif
#else
UPDATE_ENDSTOP_BIT(W, MAX);
UPDATE_LIVE_STATE(W, MAX);
#endif
#endif

View file

@ -28,58 +28,65 @@
#include "../inc/MarlinConfig.h"
#include <stdint.h>
#define __ES_ITEM(N) N,
#define _ES_ITEM(K,N) TERN_(K,DEFER4(__ES_ITEM)(N))
#define _ES_ITEM(N) N,
#define ES_ITEM(K,N) TERN_(K,DEFER4(_ES_ITEM)(N))
/**
* Basic Endstop Flag Bits:
* - Each axis gets one endstop flag bit based on the homing direction (e.g., "EndstopEnum::X_MIN").
* - Each axis with an endstop gets a flag for its homing direction.
* (The use of "MIN" or "MAX" makes it easier to pair with similarly-named endstop pins.)
* - Multi-stepper axes can optionally enable endstops for all axis steppers.
* - The bed probe gets a 'Z_PROBE' flag bit (but DELTA sensorless probing uses 3 endstops).
* - Bed probes with a single pin get a Z_MIN_PROBE flag. This includes Sensorless Z Probe.
*
* Extended Flag Bits:
* - Multi-stepper axes may have multi-endstops such as X2_MIN, Y2_MAX, etc.
* - DELTA gets X_MAX, Y_MAX, and Z_MAX corresponding to its "A", "B", "C" towers.
* - For DUAL_X_CARRIAGE the X axis has both X_MIN and X_MAX flags.
* - The Z axis may have both MIN and MAX when homing to MAX and the probe is Z_MIN.
* - DELTA Sensorless Probe uses X/Y/Z_MAX but sets the Z_MIN flag.
*
* Endstop Flag Bit Aliases:
* - Each *_MIN or *_MAX flag is aliased to *_ENDSTOP.
* - 'Z_ENDSTOP' is aliased to 'Z_PROBE' if homing with the probe.
* - Z_MIN_PROBE is an alias to Z_MIN when the Z_MIN_PIN is being used as the probe pin.
* - When homing with the probe Z_ENDSTOP is a Z_MIN_PROBE alias, otherwise a Z_MIN/MAX alias.
*/
enum EndstopEnum : char {
// Common XYZ (ABC) endstops. Defined according to USE_[XYZ](MIN|MAX)_PLUG settings.
_ES_ITEM(HAS_X_MIN, X_MIN) _ES_ITEM(HAS_X_MAX, X_MAX)
_ES_ITEM(HAS_Y_MIN, Y_MIN) _ES_ITEM(HAS_Y_MAX, Y_MAX)
_ES_ITEM(HAS_Z_MIN, Z_MIN) _ES_ITEM(HAS_Z_MAX, Z_MAX)
_ES_ITEM(HAS_I_MIN, I_MIN) _ES_ITEM(HAS_I_MAX, I_MAX)
_ES_ITEM(HAS_J_MIN, J_MIN) _ES_ITEM(HAS_J_MAX, J_MAX)
_ES_ITEM(HAS_K_MIN, K_MIN) _ES_ITEM(HAS_K_MAX, K_MAX)
_ES_ITEM(HAS_U_MIN, U_MIN) _ES_ITEM(HAS_U_MAX, U_MAX)
_ES_ITEM(HAS_V_MIN, V_MIN) _ES_ITEM(HAS_V_MAX, V_MAX)
_ES_ITEM(HAS_W_MIN, W_MIN) _ES_ITEM(HAS_W_MAX, W_MAX)
// Common XYZ (ABC) endstops.
ES_ITEM(HAS_X_MIN, X_MIN) ES_ITEM(HAS_X_MAX, X_MAX)
ES_ITEM(HAS_Y_MIN, Y_MIN) ES_ITEM(HAS_Y_MAX, Y_MAX)
ES_ITEM(HAS_Z_MIN, Z_MIN) ES_ITEM(HAS_Z_MAX, Z_MAX)
ES_ITEM(HAS_I_MIN, I_MIN) ES_ITEM(HAS_I_MAX, I_MAX)
ES_ITEM(HAS_J_MIN, J_MIN) ES_ITEM(HAS_J_MAX, J_MAX)
ES_ITEM(HAS_K_MIN, K_MIN) ES_ITEM(HAS_K_MAX, K_MAX)
ES_ITEM(HAS_U_MIN, U_MIN) ES_ITEM(HAS_U_MAX, U_MAX)
ES_ITEM(HAS_V_MIN, V_MIN) ES_ITEM(HAS_V_MAX, V_MAX)
ES_ITEM(HAS_W_MIN, W_MIN) ES_ITEM(HAS_W_MAX, W_MAX)
// Extra Endstops for XYZ
#if ENABLED(X_DUAL_ENDSTOPS)
_ES_ITEM(HAS_X_MIN, X2_MIN) _ES_ITEM(HAS_X_MAX, X2_MAX)
ES_ITEM(HAS_X_MIN, X2_MIN) ES_ITEM(HAS_X_MAX, X2_MAX)
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
_ES_ITEM(HAS_Y_MIN, Y2_MIN) _ES_ITEM(HAS_Y_MAX, Y2_MAX)
ES_ITEM(HAS_Y_MIN, Y2_MIN) ES_ITEM(HAS_Y_MAX, Y2_MAX)
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
_ES_ITEM(HAS_Z_MIN, Z2_MIN) _ES_ITEM(HAS_Z_MAX, Z2_MAX)
ES_ITEM(HAS_Z_MIN, Z2_MIN) ES_ITEM(HAS_Z_MAX, Z2_MAX)
#if NUM_Z_STEPPERS >= 3
_ES_ITEM(HAS_Z_MIN, Z3_MIN) _ES_ITEM(HAS_Z_MAX, Z3_MAX)
ES_ITEM(HAS_Z_MIN, Z3_MIN) ES_ITEM(HAS_Z_MAX, Z3_MAX)
#if NUM_Z_STEPPERS >= 4
_ES_ITEM(HAS_Z_MIN, Z4_MIN) _ES_ITEM(HAS_Z_MAX, Z4_MAX)
ES_ITEM(HAS_Z_MIN, Z4_MIN) ES_ITEM(HAS_Z_MAX, Z4_MAX)
#endif
#endif
#endif
// Bed Probe state is distinct or shared with Z_MIN (i.e., when the probe is the only Z endstop)
#if !HAS_DELTA_SENSORLESS_PROBING
_ES_ITEM(HAS_BED_PROBE, Z_MIN_PROBE IF_DISABLED(USES_Z_MIN_PROBE_PIN, = Z_MIN))
ES_ITEM(HAS_BED_PROBE, Z_MIN_PROBE IF_DISABLED(USES_Z_MIN_PROBE_PIN, = Z_MIN))
#endif
// The total number of states
NUM_ENDSTOP_STATES
// Endstops can be either MIN or MAX but not both
// Endstop aliased to MIN or MAX
#if HAS_X_ENDSTOP
, X_ENDSTOP = TERN(X_HOME_TO_MAX, X_MAX, X_MIN)
#if ENABLED(X_DUAL_ENDSTOPS)
@ -126,8 +133,8 @@ enum EndstopEnum : char {
#endif
};
#undef __ES_ITEM
#undef _ES_ITEM
#undef ES_ITEM
class Endstops {
public:

View file

@ -540,6 +540,21 @@ void _internal_move_to_destination(const_feedRate_t fr_mm_s/*=0.0f*/
prepare_line_to_destination();
}
#if SECONDARY_AXES
void secondary_axis_moves(SECONDARY_AXIS_ARGS(const_float_t), const_feedRate_t fr_mm_s) {
auto move_one = [&](const AxisEnum a, const_float_t p) {
const feedRate_t fr = fr_mm_s ?: homing_feedrate(a);
current_position[a] = p; line_to_current_position(fr);
};
SECONDARY_AXIS_CODE(
move_one(I_AXIS, i), move_one(J_AXIS, j), move_one(K_AXIS, k),
move_one(U_AXIS, u), move_one(V_AXIS, v), move_one(W_AXIS, w)
);
}
#endif
/**
* Plan a move to (X, Y, Z, [I, [J, [K...]]]) and set the current_position
* Plan a move to (X, Y, Z, [I, [J, [K...]]]) with separation of Z from other components.
@ -558,14 +573,6 @@ void do_blocking_move_to(NUM_AXIS_ARGS(const_float_t), const_feedRate_t fr_mm_s/
#if HAS_Z_AXIS
const feedRate_t z_feedrate = fr_mm_s ?: homing_feedrate(Z_AXIS);
#endif
SECONDARY_AXIS_CODE(
const feedRate_t i_feedrate = fr_mm_s ?: homing_feedrate(I_AXIS),
const feedRate_t j_feedrate = fr_mm_s ?: homing_feedrate(J_AXIS),
const feedRate_t k_feedrate = fr_mm_s ?: homing_feedrate(K_AXIS),
const feedRate_t u_feedrate = fr_mm_s ?: homing_feedrate(U_AXIS),
const feedRate_t v_feedrate = fr_mm_s ?: homing_feedrate(V_AXIS),
const feedRate_t w_feedrate = fr_mm_s ?: homing_feedrate(W_AXIS)
);
#if IS_KINEMATIC && DISABLED(POLARGRAPH)
// kinematic machines are expected to home to a point 1.5x their range? never reachable.
@ -608,6 +615,10 @@ void do_blocking_move_to(NUM_AXIS_ARGS(const_float_t), const_feedRate_t fr_mm_s/
if (DEBUGGING(LEVELING)) DEBUG_POS("z lower move", current_position);
}
#if SECONDARY_AXES
secondary_axis_moves(SECONDARY_AXIS_LIST(i, j, k, u, v, w), fr_mm_s);
#endif
#elif IS_SCARA
// If Z needs to raise, do it before moving XY
@ -615,6 +626,10 @@ void do_blocking_move_to(NUM_AXIS_ARGS(const_float_t), const_feedRate_t fr_mm_s/
destination.set(x, y); prepare_internal_fast_move_to_destination(xy_feedrate);
#if SECONDARY_AXES
secondary_axis_moves(SECONDARY_AXIS_LIST(i, j, k, u, v, w), fr_mm_s);
#endif
// If Z needs to lower, do it after moving XY
if (destination.z > z) { destination.z = z; prepare_internal_fast_move_to_destination(z_feedrate); }
@ -626,23 +641,8 @@ void do_blocking_move_to(NUM_AXIS_ARGS(const_float_t), const_feedRate_t fr_mm_s/
current_position.set(x OPTARG(HAS_Y_AXIS, y)); line_to_current_position(xy_feedrate);
#if HAS_I_AXIS
current_position.i = i; line_to_current_position(i_feedrate);
#endif
#if HAS_J_AXIS
current_position.j = j; line_to_current_position(j_feedrate);
#endif
#if HAS_K_AXIS
current_position.k = k; line_to_current_position(k_feedrate);
#endif
#if HAS_U_AXIS
current_position.u = u; line_to_current_position(u_feedrate);
#endif
#if HAS_V_AXIS
current_position.v = v; line_to_current_position(v_feedrate);
#endif
#if HAS_W_AXIS
current_position.w = w; line_to_current_position(w_feedrate);
#if SECONDARY_AXES
secondary_axis_moves(SECONDARY_AXIS_LIST(i, j, k, u, v, w), fr_mm_s);
#endif
#if HAS_Z_AXIS

View file

@ -499,39 +499,29 @@
//
// Assign endstop pins for boards with only 3 connectors
//
#ifdef X_STOP_PIN
#if HAS_X_AXIS
#ifdef X_STOP_PIN
#if X_HOME_TO_MIN
#define X_MIN_PIN X_STOP_PIN
#ifndef X_MAX_PIN
#define X_MAX_PIN -1
#endif
#else
#define X_MAX_PIN X_STOP_PIN
#ifndef X_MIN_PIN
#define X_MIN_PIN -1
#endif
#endif
#elif X_HOME_TO_MIN
#elif X_HOME_TO_MIN
#define X_STOP_PIN X_MIN_PIN
#else
#else
#define X_STOP_PIN X_MAX_PIN
#endif
#if !defined(X2_USE_ENDSTOP) && ENABLED(X_DUAL_ENDSTOPS) && PIN_EXISTS(X_STOP)
#endif
#if !defined(X2_USE_ENDSTOP) && ENABLED(X_DUAL_ENDSTOPS) && PIN_EXISTS(X_STOP)
#define X2_USE_ENDSTOP _XSTOP_
#endif
#endif
#if HAS_Y_AXIS
#ifdef Y_STOP_PIN
#if Y_HOME_TO_MIN
#define Y_MIN_PIN Y_STOP_PIN
#ifndef Y_MAX_PIN
#define Y_MAX_PIN -1
#endif
#else
#define Y_MAX_PIN Y_STOP_PIN
#ifndef Y_MIN_PIN
#define Y_MIN_PIN -1
#endif
#endif
#elif Y_HOME_TO_MIN
#define Y_STOP_PIN Y_MIN_PIN
@ -547,14 +537,8 @@
#ifdef Z_STOP_PIN
#if Z_HOME_TO_MIN
#define Z_MIN_PIN Z_STOP_PIN
#ifndef Z_MAX_PIN
#define Z_MAX_PIN -1
#endif
#else
#define Z_MAX_PIN Z_STOP_PIN
#ifndef Z_MIN_PIN
#define Z_MIN_PIN -1
#endif
#endif
#elif Z_HOME_TO_MIN
#define Z_STOP_PIN Z_MIN_PIN
@ -578,138 +562,84 @@
#ifdef I_STOP_PIN
#if I_HOME_TO_MIN
#define I_MIN_PIN I_STOP_PIN
#ifndef I_MAX_PIN
#define I_MAX_PIN -1
#endif
#else
#define I_MAX_PIN I_STOP_PIN
#ifndef I_MIN_PIN
#define I_MIN_PIN -1
#endif
#endif
#elif I_HOME_TO_MIN
#define I_STOP_PIN I_MIN_PIN
#else
#define I_STOP_PIN I_MAX_PIN
#endif
#else
#undef I_MIN_PIN
#undef I_MAX_PIN
#endif
#if HAS_J_AXIS
#ifdef J_STOP_PIN
#if J_HOME_TO_MIN
#define J_MIN_PIN J_STOP_PIN
#ifndef J_MAX_PIN
#define J_MAX_PIN -1
#endif
#else
#define J_MAX_PIN J_STOP_PIN
#ifndef J_MIN_PIN
#define J_MIN_PIN -1
#endif
#endif
#elif J_HOME_TO_MIN
#define J_STOP_PIN J_MIN_PIN
#else
#define J_STOP_PIN J_MAX_PIN
#endif
#else
#undef J_MIN_PIN
#undef J_MAX_PIN
#endif
#if HAS_K_AXIS
#ifdef K_STOP_PIN
#if K_HOME_TO_MIN
#define K_MIN_PIN K_STOP_PIN
#ifndef K_MAX_PIN
#define K_MAX_PIN -1
#endif
#else
#define K_MAX_PIN K_STOP_PIN
#ifndef K_MIN_PIN
#define K_MIN_PIN -1
#endif
#endif
#elif K_HOME_TO_MIN
#define K_STOP_PIN K_MIN_PIN
#else
#define K_STOP_PIN K_MAX_PIN
#endif
#else
#undef K_MIN_PIN
#undef K_MAX_PIN
#endif
#if HAS_U_AXIS
#ifdef U_STOP_PIN
#if U_HOME_TO_MIN
#define U_MIN_PIN U_STOP_PIN
#ifndef U_MAX_PIN
#define U_MAX_PIN -1
#endif
#else
#define U_MAX_PIN U_STOP_PIN
#ifndef U_MIN_PIN
#define U_MIN_PIN -1
#endif
#endif
#elif U_HOME_TO_MIN
#define U_STOP_PIN U_MIN_PIN
#else
#define U_STOP_PIN U_MAX_PIN
#endif
#else
#undef U_MIN_PIN
#undef U_MAX_PIN
#endif
#if HAS_V_AXIS
#ifdef V_STOP_PIN
#if V_HOME_TO_MIN
#define V_MIN_PIN V_STOP_PIN
#ifndef V_MAX_PIN
#define V_MAX_PIN -1
#endif
#else
#define V_MAX_PIN V_STOP_PIN
#ifndef V_MIN_PIN
#define V_MIN_PIN -1
#endif
#endif
#elif V_HOME_TO_MIN
#define V_STOP_PIN V_MIN_PIN
#else
#define V_STOP_PIN V_MAX_PIN
#endif
#else
#undef V_MIN_PIN
#undef V_MAX_PIN
#endif
#if HAS_W_AXIS
#ifdef W_STOP_PIN
#if W_HOME_TO_MIN
#define W_MIN_PIN W_STOP_PIN
#ifndef W_MAX_PIN
#define W_MAX_PIN -1
#endif
#else
#define W_MAX_PIN W_STOP_PIN
#ifndef W_MIN_PIN
#define W_MIN_PIN -1
#endif
#endif
#elif W_HOME_TO_MIN
#define W_STOP_PIN W_MIN_PIN
#else
#define W_STOP_PIN W_MAX_PIN
#endif
#else
#undef W_MIN_PIN
#undef W_MAX_PIN
#endif
// Filament Sensor first pin alias
@ -822,7 +752,6 @@
// Auto-assign pins for stallGuard sensorless homing
//
#if !defined(X2_DIAG_PIN) && !defined(X2_USE_ENDSTOP) && defined(X2_STALL_SENSITIVITY) && ENABLED(X_DUAL_ENDSTOPS) && _PEXI(X2_E_INDEX, DIAG)
#define X2_DIAG_PIN _EPIN(X2_E_INDEX, DIAG)
#if DIAG_REMAPPED(X2, X_MIN) // If already remapped in the pins file...
#define X2_USE_ENDSTOP _XMIN_
#elif DIAG_REMAPPED(X2, Y_MIN)
@ -839,7 +768,6 @@
#define X2_USE_ENDSTOP _En_DIAG_(X2_E_INDEX)
#endif
#define AUTO_ASSIGNED_X2_DIAG 1
#undef X2_DIAG_PIN // Defined in Conditionals_post.h based on X2_USE_ENDSTOP
#endif
#endif
@ -908,7 +836,6 @@
#endif
// Auto-assign pins for stallGuard sensorless homing
#if !defined(Y2_DIAG_PIN) && !defined(Y2_USE_ENDSTOP) && defined(Y2_STALL_SENSITIVITY) && ENABLED(Y_DUAL_ENDSTOPS) && _PEXI(Y2_E_INDEX, DIAG)
#define Y2_DIAG_PIN _EPIN(Y2_E_INDEX, DIAG)
#if DIAG_REMAPPED(Y2, X_MIN)
#define Y2_USE_ENDSTOP _XMIN_
#elif DIAG_REMAPPED(Y2, Y_MIN)
@ -925,7 +852,6 @@
#define Y2_USE_ENDSTOP _En_DIAG_(Y2_E_INDEX)
#endif
#define AUTO_ASSIGNED_Y2_DIAG 1
#undef Y2_DIAG_PIN // Defined in Conditionals_post.h based on Y2_USE_ENDSTOP
#endif
#endif
@ -994,7 +920,6 @@
#endif
// Auto-assign pins for stallGuard sensorless homing
#if !defined(Z2_DIAG_PIN) && !defined(Z2_USE_ENDSTOP) && defined(Z2_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && _PEXI(Z2_E_INDEX, DIAG)
#define Z2_DIAG_PIN _EPIN(Z2_E_INDEX, DIAG)
#if DIAG_REMAPPED(Z2, X_MIN)
#define Z2_USE_ENDSTOP _XMIN_
#elif DIAG_REMAPPED(Z2, Y_MIN)
@ -1011,7 +936,6 @@
#define Z2_USE_ENDSTOP _En_DIAG_(Z2_E_INDEX)
#endif
#define AUTO_ASSIGNED_Z2_DIAG 1
#undef Z2_DIAG_PIN // Defined in Conditionals_post.h based on Z2_USE_ENDSTOP
#endif
#endif
@ -1080,7 +1004,6 @@
#endif
// Auto-assign pins for stallGuard sensorless homing
#if !defined(Z3_DIAG_PIN) && !defined(Z3_USE_ENDSTOP) && defined(Z3_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && _PEXI(Z3_E_INDEX, DIAG)
#define Z3_DIAG_PIN _EPIN(Z3_E_INDEX, DIAG)
#if DIAG_REMAPPED(Z3, X_MIN)
#define Z3_USE_ENDSTOP _XMIN_
#elif DIAG_REMAPPED(Z3, Y_MIN)
@ -1097,7 +1020,6 @@
#define Z3_USE_ENDSTOP _En_DIAG_(Z3_E_INDEX)
#endif
#define AUTO_ASSIGNED_Z3_DIAG 1
#undef Z3_DIAG_PIN // Defined in Conditionals_post.h based on Z3_USE_ENDSTOP
#endif
#endif
@ -1166,7 +1088,6 @@
#endif
// Auto-assign pins for stallGuard sensorless homing
#if !defined(Z4_DIAG_PIN) && !defined(Z4_USE_ENDSTOP) && defined(Z4_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && _PEXI(Z4_E_INDEX, DIAG)
#define Z4_DIAG_PIN _EPIN(Z4_E_INDEX, DIAG)
#if DIAG_REMAPPED(Z4, X_MIN)
#define Z4_USE_ENDSTOP _XMIN_
#elif DIAG_REMAPPED(Z4, Y_MIN)
@ -1183,7 +1104,6 @@
#define Z4_USE_ENDSTOP _En_DIAG_(Z4_E_INDEX)
#endif
#define AUTO_ASSIGNED_Z4_DIAG 1
#undef Z4_DIAG_PIN // Defined in Conditionals_post.h based on Z4_USE_ENDSTOP
#endif
#endif
@ -1252,7 +1172,6 @@
#endif
// Auto-assign pins for stallGuard sensorless homing
#if !defined(I_DIAG_PIN) && !defined(I_USE_ENDSTOP) && defined(I_STALL_SENSITIVITY) && _PEXI(I_E_INDEX, DIAG)
#define I_DIAG_PIN _EPIN(I_E_INDEX, DIAG)
#if DIAG_REMAPPED(I, X_MIN)
#define I_USE_ENDSTOP _XMIN_
#elif DIAG_REMAPPED(I, Y_MIN)
@ -1269,7 +1188,6 @@
#define I_USE_ENDSTOP _En_DIAG_(I_E_INDEX)
#endif
#define AUTO_ASSIGNED_I_DIAG 1
#undef I_DIAG_PIN // Defined in Conditionals_post.h based on I_USE_ENDSTOP
#endif
#endif
@ -1338,7 +1256,6 @@
#endif
// Auto-assign pins for stallGuard sensorless homing
#if !defined(J_DIAG_PIN) && !defined(J_USE_ENDSTOP) && defined(J_STALL_SENSITIVITY) && _PEXI(J_E_INDEX, DIAG)
#define J_DIAG_PIN _EPIN(J_E_INDEX, DIAG)
#if DIAG_REMAPPED(J, X_MIN)
#define J_USE_ENDSTOP _XMIN_
#elif DIAG_REMAPPED(J, Y_MIN)
@ -1355,7 +1272,6 @@
#define J_USE_ENDSTOP _En_DIAG_(J_E_INDEX)
#endif
#define AUTO_ASSIGNED_J_DIAG 1
#undef J_DIAG_PIN // Defined in Conditionals_post.h based on J_USE_ENDSTOP
#endif
#endif
@ -1424,7 +1340,6 @@
#endif
// Auto-assign pins for stallGuard sensorless homing
#if !defined(K_DIAG_PIN) && !defined(K_USE_ENDSTOP) && defined(K_STALL_SENSITIVITY) && _PEXI(K_E_INDEX, DIAG)
#define K_DIAG_PIN _EPIN(K_E_INDEX, DIAG)
#if DIAG_REMAPPED(K, X_MIN)
#define K_USE_ENDSTOP _XMIN_
#elif DIAG_REMAPPED(K, Y_MIN)
@ -1441,7 +1356,6 @@
#define K_USE_ENDSTOP _En_DIAG_(K_E_INDEX)
#endif
#define AUTO_ASSIGNED_K_DIAG 1
#undef K_DIAG_PIN // Defined in Conditionals_post.h based on K_USE_ENDSTOP
#endif
#endif
@ -1510,7 +1424,6 @@
#endif
// Auto-assign pins for stallGuard sensorless homing
#if !defined(U_DIAG_PIN) && !defined(U_USE_ENDSTOP) && defined(U_STALL_SENSITIVITY) && _PEXI(U_E_INDEX, DIAG)
#define U_DIAG_PIN _EPIN(U_E_INDEX, DIAG)
#if DIAG_REMAPPED(U, X_MIN)
#define U_USE_ENDSTOP _XMIN_
#elif DIAG_REMAPPED(U, Y_MIN)
@ -1527,7 +1440,6 @@
#define U_USE_ENDSTOP _En_DIAG_(U_E_INDEX)
#endif
#define AUTO_ASSIGNED_U_DIAG 1
#undef U_DIAG_PIN // Defined in Conditionals_post.h based on U_USE_ENDSTOP
#endif
#endif
@ -1596,7 +1508,6 @@
#endif
// Auto-assign pins for stallGuard sensorless homing
#if !defined(V_DIAG_PIN) && !defined(V_USE_ENDSTOP) && defined(V_STALL_SENSITIVITY) && _PEXI(V_E_INDEX, DIAG)
#define V_DIAG_PIN _EPIN(V_E_INDEX, DIAG)
#if DIAG_REMAPPED(V, X_MIN)
#define V_USE_ENDSTOP _XMIN_
#elif DIAG_REMAPPED(V, Y_MIN)
@ -1613,7 +1524,6 @@
#define V_USE_ENDSTOP _En_DIAG_(V_E_INDEX)
#endif
#define AUTO_ASSIGNED_V_DIAG 1
#undef V_DIAG_PIN // Defined in Conditionals_post.h based on O_USE_ENDSTOP
#endif
#endif
@ -1676,7 +1586,6 @@
#endif
// Auto-assign pins for stallGuard sensorless homing
#if !defined(W_DIAG_PIN) && !defined(W_USE_ENDSTOP) && defined(W_STALL_SENSITIVITY) && _PEXI(W_E_INDEX, DIAG)
#define W_DIAG_PIN _EPIN(W_E_INDEX, DIAG)
#if DIAG_REMAPPED(W, X_MIN)
#define W_USE_ENDSTOP _XMIN_
#elif DIAG_REMAPPED(W, Y_MIN)
@ -1693,7 +1602,6 @@
#define W_USE_ENDSTOP _En_DIAG_(W_E_INDEX)
#endif
#define AUTO_ASSIGNED_W_DIAG 1
#undef W_DIAG_PIN // Defined in Conditionals_post.h based on Q_USE_ENDSTOP
#endif
#endif

View file

@ -53,9 +53,6 @@
#ifndef X_MIN_PIN
#define X_MIN_PIN 37
#endif
#ifndef X_MIN_PIN
#define X_MIN_PIN 37
#endif
#ifndef X_MAX_PIN
#define X_MAX_PIN 36
#endif

View file

@ -118,7 +118,9 @@
// Chiron uses AUX header for Y and Z endstops
#define Y_STOP_PIN 42 // AUX (1)
#define Z_STOP_PIN 43 // AUX (2)
#define Z2_MIN_PIN 18 // Z-
#ifndef Z2_STOP_PIN
#define Z2_STOP_PIN 18 // Z-
#endif
#ifndef Z_MIN_PROBE_PIN
#define Z_MIN_PROBE_PIN 2 // X+