Skip to content

Commit

Permalink
💥 Num Axes / Multi-Stepper based on Driver Types (MarlinFirmware#24106,
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and Frank Roth committed Jun 7, 2022
1 parent e3034a7 commit 669084d
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 66 deletions.
52 changes: 48 additions & 4 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,25 @@
//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000"

/**
<<<<<<< HEAD
<<<<<<< HEAD
* Stepper Drivers
=======
* Define the number of coordinated axes.
* See https://github.com/DerAndere1/Marlin/wiki
* Each axis gets its own stepper control and endstop:
>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
=======
* Stepper Drivers
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
*
* These settings allow Marlin to tune stepper driver timing and enable advanced options for
* stepper drivers that support them. You may also override timing options in Configuration_adv.h.
*
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
* Use TMC2208/TMC2208_STANDALONE for TMC2225 drivers and TMC2209/TMC2209_STANDALONE for TMC2226 drivers.
*
* Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01,
Expand All @@ -171,6 +178,7 @@
* TMC26X, TMC26X_STANDALONE, TMC2660, TMC2660_STANDALONE,
* TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
* :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
<<<<<<< HEAD
*/
#define X_DRIVER_TYPE A4988
#define Y_DRIVER_TYPE A4988
Expand Down Expand Up @@ -199,6 +207,31 @@
*/
//#define NUM_AXES 3
>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
=======
*/
#define X_DRIVER_TYPE A4988
#define Y_DRIVER_TYPE A4988
#define Z_DRIVER_TYPE A4988
//#define X2_DRIVER_TYPE A4988
//#define Y2_DRIVER_TYPE A4988
//#define Z2_DRIVER_TYPE A4988
//#define Z3_DRIVER_TYPE A4988
//#define Z4_DRIVER_TYPE A4988
//#define I_DRIVER_TYPE A4988
//#define J_DRIVER_TYPE A4988
//#define K_DRIVER_TYPE A4988
//#define U_DRIVER_TYPE A4988
//#define V_DRIVER_TYPE A4988
//#define W_DRIVER_TYPE A4988
#define E0_DRIVER_TYPE A4988
//#define E1_DRIVER_TYPE A4988
//#define E2_DRIVER_TYPE A4988
//#define E3_DRIVER_TYPE A4988
//#define E4_DRIVER_TYPE A4988
//#define E5_DRIVER_TYPE A4988
//#define E6_DRIVER_TYPE A4988
//#define E7_DRIVER_TYPE A4988
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))

/**
* Additional Axis Settings
Expand All @@ -218,6 +251,7 @@
* Regardless of these settings the axes are internally named I, J, K, U, V, W.
*/
<<<<<<< HEAD
<<<<<<< HEAD
#ifdef I_DRIVER_TYPE
#define AXIS4_NAME 'A' // :['A', 'B', 'C', 'U', 'V', 'W']
#define AXIS4_ROTATES
Expand All @@ -241,27 +275,34 @@
#ifdef W_DRIVER_TYPE
=======
#if NUM_AXES >= 4
=======
#ifdef I_DRIVER_TYPE
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
#define AXIS4_NAME 'A' // :['A', 'B', 'C', 'U', 'V', 'W']
#define AXIS4_ROTATES
#endif
#if NUM_AXES >= 5
#ifdef J_DRIVER_TYPE
#define AXIS5_NAME 'B' // :['B', 'C', 'U', 'V', 'W']
#define AXIS5_ROTATES
#endif
#if NUM_AXES >= 6
#ifdef K_DRIVER_TYPE
#define AXIS6_NAME 'C' // :['C', 'U', 'V', 'W']
#define AXIS6_ROTATES
#endif
#if NUM_AXES >= 7
#ifdef U_DRIVER_TYPE
#define AXIS7_NAME 'U' // :['U', 'V', 'W']
//#define AXIS7_ROTATES
#endif
#if NUM_AXES >= 8
#ifdef V_DRIVER_TYPE
#define AXIS8_NAME 'V' // :['V', 'W']
//#define AXIS8_ROTATES
#endif
<<<<<<< HEAD
#if NUM_AXES >= 9
>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
=======
#ifdef W_DRIVER_TYPE
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
#define AXIS9_NAME 'W' // :['W']
//#define AXIS9_ROTATES
#endif
Expand Down Expand Up @@ -1000,6 +1041,7 @@
#define W_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // Set to true to invert the logic of the probe.

<<<<<<< HEAD
<<<<<<< HEAD
=======
/**
Expand Down Expand Up @@ -1044,6 +1086,8 @@
//#define E7_DRIVER_TYPE A4988

>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
=======
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
// Enable this feature if all enabled endstop pins are interrupt-capable.
// This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE
Expand Down
4 changes: 4 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2450,11 +2450,15 @@

/**
* Extra G-code to run while executing tool-change commands. Can be used to use an additional
<<<<<<< HEAD
<<<<<<< HEAD
* stepper motor (e.g., I axis in Configuration.h) to drive the tool-changer.
=======
* stepper motor (I axis, see option NUM_AXES in Configuration.h) to drive the tool-changer.
>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
=======
* stepper motor (e.g., I axis in Configuration.h) to drive the tool-changer.
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
*/
//#define EVENT_GCODE_TOOLCHANGE_T0 "G28 A\nG1 A0" // Extra G-code to run while executing tool-change command T0
//#define EVENT_GCODE_TOOLCHANGE_T1 "G1 A10" // Extra G-code to run while executing tool-change command T1
Expand Down
18 changes: 18 additions & 0 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,15 @@
* All the logical axes except for the tool (E) axis
*/
<<<<<<< HEAD
<<<<<<< HEAD
#ifdef LINEAR_AXES
#undef LINEAR_AXES
#define LINEAR_AXES_WARNING 1
=======
#ifdef NUM_AXES
#undef NUM_AXES
#define NUM_AXES_WARNING 1
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
#endif

#ifdef W_DRIVER_TYPE
Expand All @@ -693,17 +699,23 @@
#define NUM_AXES 2
#else
#define NUM_AXES 1
<<<<<<< HEAD
#endif
=======
#ifndef NUM_AXES
#define NUM_AXES XYZ
=======
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
#endif
>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
#if NUM_AXES >= XY
#define HAS_Y_AXIS 1
#if NUM_AXES >= XYZ
#define HAS_Z_AXIS 1
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
#ifdef Z4_DRIVER_TYPE
#define NUM_Z_STEPPERS 4
#elif defined(Z3_DRIVER_TYPE)
Expand All @@ -713,8 +725,11 @@
#else
#define NUM_Z_STEPPERS 1
#endif
<<<<<<< HEAD
=======
>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
=======
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
#if NUM_AXES >= 4
#define HAS_I_AXIS 1
#if NUM_AXES >= 5
Expand Down Expand Up @@ -1393,6 +1408,7 @@
#define HAS_ETHERNET 1
#endif

<<<<<<< HEAD
<<<<<<< HEAD
=======
// Fallback Stepper Driver types that don't depend on Configuration_adv.h
Expand Down Expand Up @@ -1494,6 +1510,8 @@
#endif

>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
=======
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
/**
* This setting is also used by M109 when trying to calculate
* a ballpark safe margin to prevent wait-forever situation.
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -943,11 +943,15 @@
#undef HOME_Z_FIRST
#undef HOMING_Z_WITH_PROBE
#undef ENABLE_LEVELING_FADE_HEIGHT
<<<<<<< HEAD
<<<<<<< HEAD
#undef NUM_Z_STEPPERS
=======
#undef NUM_Z_STEPPER_DRIVERS
>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
=======
#undef NUM_Z_STEPPERS
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
#undef CNC_WORKSPACE_PLANES
#if NUM_AXES < 2
#undef STEALTHCHOP_Y
Expand Down
9 changes: 9 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,16 @@
=======
#elif defined(LINEAR_AXES)
#error "LINEAR_AXES is now NUM_AXES (to account for rotational axes)."
<<<<<<< HEAD
>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
=======
#elif defined(X_DUAL_STEPPER_DRIVERS)
#error "X_DUAL_STEPPER_DRIVERS is no longer needed and should be removed."
#elif defined(Y_DUAL_STEPPER_DRIVERS)
#error "Y_DUAL_STEPPER_DRIVERS is no longer needed and should be removed."
#elif defined(NUM_Z_STEPPER_DRIVERS)
#error "NUM_Z_STEPPER_DRIVERS is no longer needed and should be removed."
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
#endif

constexpr float arm[] = AXIS_RELATIVE_MODES;
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/inc/Warnings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
#warning "WARNING! Disable MARLIN_DEV_MODE for the final build!"
#endif

#if LINEAR_AXES_WARNING
#warning "Note: LINEAR_AXES is now based on the *_DRIVER_TYPE settings so you can remove LINEAR_AXES from Configuration.h."
#if NUM_AXES_WARNING
#warning "Note: NUM_AXES is now based on the *_DRIVER_TYPE settings so you can remove NUM_AXES from Configuration.h."
#endif

// Safety Features
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/libs/L64XX/L64XX_Marlin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,16 @@ uint8_t L64XX_Marlin::dir_commands[MAX_L64XX]; // array to hold direction comma
#define _EN_ITEM(N) , ENABLED(INVERT_E##N##_DIR)
const uint8_t L64XX_Marlin::index_to_dir[MAX_L64XX] = {
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
NUM_AXIS_LIST(ENABLED(INVERT_X_DIR), ENABLED(INVERT_Y_DIR), ENABLED(INVERT_Z_DIR), ENABLED(INVERT_I_DIR), ENABLED(INVERT_J_DIR), ENABLED(INVERT_K_DIR), ENABLED(INVERT_U_DIR), ENABLED(INVERT_V_DIR), ENABLED(INVERT_W_DIR))
, ENABLED(INVERT_X_DIR) ^ BOTH(HAS_DUAL_X_STEPPERS, INVERT_X2_VS_X_DIR) // X2
, ENABLED(INVERT_Y_DIR) ^ BOTH(HAS_DUAL_Y_STEPPERS, INVERT_Y2_VS_Y_DIR) // Y2
, ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z2_VS_Z_DIR) // Z2
, ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z3_VS_Z_DIR) // Z3
, ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z4_VS_Z_DIR) // Z4
<<<<<<< HEAD
=======
NUM_AXIS_LIST(INVERT_X_DIR, INVERT_Y_DIR, INVERT_Z_DIR, INVERT_I_DIR, INVERT_J_DIR, INVERT_K_DIR)
, (INVERT_X_DIR) ^ BOTH(X_DUAL_STEPPER_DRIVERS, INVERT_X2_VS_X_DIR) // X2
Expand All @@ -83,6 +87,8 @@ const uint8_t L64XX_Marlin::index_to_dir[MAX_L64XX] = {
, (INVERT_Z_DIR) ^ ENABLED(INVERT_Z3_VS_Z_DIR) // Z3
, (INVERT_Z_DIR) ^ ENABLED(INVERT_Z4_VS_Z_DIR) // Z4
>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
=======
>>>>>>> a2cf60f45f (💥 Num Axes / Multi-Stepper based on Driver Types (#24106, #24120))
REPEAT(E_STEPPERS, _EN_ITEM)
};
#undef _EN_ITEM
Expand Down
40 changes: 0 additions & 40 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,13 +742,8 @@ void restore_feedrate_and_scaling() {
#define _AMAX(A) A##_MAX_POS
soft_endstops_t soft_endstop = {
true, false,
<<<<<<< HEAD
{ MAPLIST(_AMIN, MAIN_AXIS_NAMES) },
{ MAPLIST(_AMAX, MAIN_AXIS_NAMES) },
=======
NUM_AXIS_ARRAY(X_MIN_POS, Y_MIN_POS, Z_MIN_POS, I_MIN_POS, J_MIN_POS, K_MIN_POS, U_MIN_POS, V_MIN_POS, W_MIN_POS),
NUM_AXIS_ARRAY(X_MAX_BED, Y_MAX_BED, Z_MAX_POS, I_MAX_POS, J_MAX_POS, K_MAX_POS, U_MAX_POS, V_MAX_POS, W_MAX_POS)
>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
};

/**
Expand Down Expand Up @@ -1406,11 +1401,6 @@ void prepare_line_to_destination() {
bool homing_needed_error(main_axes_bits_t axis_bits/*=main_axes_mask*/) {
if ((axis_bits = axes_should_home(axis_bits))) {
PGM_P home_first = GET_TEXT(MSG_HOME_FIRST);
<<<<<<< HEAD
char msg[30];
#define _AXIS_CHAR(N) TEST(axis_bits, _AXIS(N)) ? STR_##N : ""
sprintf_P(msg, home_first, MAPLIST(_AXIS_CHAR, MAIN_AXIS_NAMES));
=======
char msg[strlen_P(home_first)+1];
sprintf_P(msg, home_first,
NUM_AXIS_LIST(
Expand All @@ -1425,7 +1415,6 @@ void prepare_line_to_destination() {
TEST(axis_bits, W_AXIS) ? STR_W : ""
)
);
>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
SERIAL_ECHO_START();
SERIAL_ECHOLN(msg);
ui.set_status(msg);
Expand Down Expand Up @@ -1845,30 +1834,6 @@ void prepare_line_to_destination() {
stepperBackoutDir = IF_DISABLED(INVERT_W_DIR, -)effectorBackoutDir;
break;
#endif
#ifdef U_MICROSTEPS
case U_AXIS:
phasePerUStep = PHASE_PER_MICROSTEP(U);
phaseCurrent = stepperU.get_microstep_counter();
effectorBackoutDir = -U_HOME_DIR;
stepperBackoutDir = INVERT_U_DIR ? effectorBackoutDir : -effectorBackoutDir;
break;
#endif
#ifdef V_MICROSTEPS
case V_AXIS:
phasePerUStep = PHASE_PER_MICROSTEP(V);
phaseCurrent = stepperV.get_microstep_counter();
effectorBackoutDir = -V_HOME_DIR;
stepperBackoutDir = INVERT_V_DIR ? effectorBackoutDir : -effectorBackoutDir;
break;
#endif
#ifdef W_MICROSTEPS
case W_AXIS:
phasePerUStep = PHASE_PER_MICROSTEP(W);
phaseCurrent = stepperW.get_microstep_counter();
effectorBackoutDir = -W_HOME_DIR;
stepperBackoutDir = INVERT_W_DIR ? effectorBackoutDir : -effectorBackoutDir;
break;
#endif
default: return;
}

Expand Down Expand Up @@ -1925,10 +1890,6 @@ void prepare_line_to_destination() {
|| TERN0(A##_HOME_TO_MIN, A##_MIN_PIN > -1) \
|| TERN0(A##_HOME_TO_MAX, A##_MAX_PIN > -1) \
))
<<<<<<< HEAD
#define _ANDCANT(N) && !_CAN_HOME(N)
if (true MAIN_AXIS_MAP(_ANDCANT)) return;
=======
if (NUM_AXIS_GANG(
!_CAN_HOME(X),
&& !_CAN_HOME(Y),
Expand All @@ -1940,7 +1901,6 @@ void prepare_line_to_destination() {
&& !_CAN_HOME(V),
&& !_CAN_HOME(W))
) return;
>>>>>>> 0a23f2e7fd (✨ Support for up to 9 axes (#23112, #24036, #24231))
#endif

if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> homeaxis(", AS_CHAR(AXIS_CHAR(axis)), ")");
Expand Down
Loading

0 comments on commit 669084d

Please sign in to comment.