diff --git a/config/printer.mendel.h b/config/printer.mendel.h index 35d5091..bd49d8b 100644 --- a/config/printer.mendel.h +++ b/config/printer.mendel.h @@ -112,9 +112,8 @@ #define E_ABSOLUTE /** \def HOMING_OPT - - Options for homing movements. 'none' means no movement at all. For each - option XXX, a function home_XXX() has to exist, typically in home.c/.h. + Options for homing movements a user should be able to choose from in configtool. All + commented out. */ //#define HOMING_OPT none //#define HOMING_OPT x_negative @@ -125,15 +124,10 @@ //#define HOMING_OPT z_positive /** \def DEFINE_HOMING - - Order (and number) of homing movements. + Order (and number) of homing movements. Up to 4 homing steps are allowed. + If you don't need even one axis just DEFINE_HOMING(none). */ -#ifndef DEFINE_HOMING - #define DEFINE_HOMING(...) -#endif -//DEFINE_HOMING_START -DEFINE_HOMING(x_negative, y_negative, z_negative, none) -//DEFINE_HOMING_END +DEFINE_HOMING(x_negative, y_negative, z_negative) /** \def ACCELERATION_REPRAP ACCELERATION_RAMPING ACCELERATION_TEMPORAL Choose optionally one of ACCELERATION_REPRAP, ACCELERATION_RAMPING or diff --git a/config/printer.mendel90.h b/config/printer.mendel90.h index 3a01a3a..5fb8ec0 100644 --- a/config/printer.mendel90.h +++ b/config/printer.mendel90.h @@ -112,9 +112,8 @@ #define E_ABSOLUTE /** \def HOMING_OPT - - Options for homing movements. 'none' means no movement at all. For each - option XXX, a function home_XXX() has to exist, typically in home.c/.h. + Options for homing movements a user should be able to choose from in configtool. All + commented out. */ //#define HOMING_OPT none //#define HOMING_OPT x_negative @@ -125,15 +124,10 @@ //#define HOMING_OPT z_positive /** \def DEFINE_HOMING - - Order (and number) of homing movements. + Order (and number) of homing movements. Up to 4 homing steps are allowed. + If you don't need even one axis just DEFINE_HOMING(none). */ -#ifndef DEFINE_HOMING - #define DEFINE_HOMING(...) -#endif -//DEFINE_HOMING_START -DEFINE_HOMING(x_negative, y_negative, z_negative, none) -//DEFINE_HOMING_END +DEFINE_HOMING(x_negative, y_negative, z_negative) /** \def ACCELERATION_REPRAP ACCELERATION_RAMPING ACCELERATION_TEMPORAL Choose optionally one of ACCELERATION_REPRAP, ACCELERATION_RAMPING or diff --git a/config/printer.pcbscriber.h b/config/printer.pcbscriber.h index 03dd26c..672ef9c 100644 --- a/config/printer.pcbscriber.h +++ b/config/printer.pcbscriber.h @@ -112,9 +112,8 @@ #define E_ABSOLUTE /** \def HOMING_OPT - - Options for homing movements. 'none' means no movement at all. For each - option XXX, a function home_XXX() has to exist, typically in home.c/.h. + Options for homing movements a user should be able to choose from in configtool. All + commented out. */ //#define HOMING_OPT none //#define HOMING_OPT x_negative @@ -125,15 +124,10 @@ //#define HOMING_OPT z_positive /** \def DEFINE_HOMING - - Order (and number) of homing movements. + Order (and number) of homing movements. Up to 4 homing steps are allowed. + If you don't need even one axis just DEFINE_HOMING(none). */ -#ifndef DEFINE_HOMING - #define DEFINE_HOMING(...) -#endif -//DEFINE_HOMING_START -DEFINE_HOMING(z_negative, x_negative, y_negative, none) -//DEFINE_HOMING_END +DEFINE_HOMING(z_negative, x_negative, y_negative) /** \def ACCELERATION_REPRAP ACCELERATION_RAMPING ACCELERATION_TEMPORAL Choose optionally one of ACCELERATION_REPRAP, ACCELERATION_RAMPING or diff --git a/config/printer.tronxy.h b/config/printer.tronxy.h index 7912be8..550716f 100644 --- a/config/printer.tronxy.h +++ b/config/printer.tronxy.h @@ -112,9 +112,8 @@ #define E_ABSOLUTE /** \def HOMING_OPT - - Options for homing movements. 'none' means no movement at all. For each - option XXX, a function home_XXX() has to exist, typically in home.c/.h. + Options for homing movements a user should be able to choose from in configtool. All + commented out. */ //#define HOMING_OPT none //#define HOMING_OPT x_negative @@ -125,15 +124,10 @@ //#define HOMING_OPT z_positive /** \def DEFINE_HOMING - - Order (and number) of homing movements. + Order (and number) of homing movements. Up to 4 homing steps are allowed. + If you don't need even one axis just DEFINE_HOMING(none). */ -#ifndef DEFINE_HOMING - #define DEFINE_HOMING(...) -#endif -//DEFINE_HOMING_START -DEFINE_HOMING(x_negative, y_negative, z_negative, none) -//DEFINE_HOMING_END +DEFINE_HOMING(x_negative, y_negative, z_negative) /** \def ACCELERATION_REPRAP ACCELERATION_RAMPING ACCELERATION_TEMPORAL Choose optionally one of ACCELERATION_REPRAP, ACCELERATION_RAMPING or diff --git a/config/printer.wolfstrap.h b/config/printer.wolfstrap.h index ca103ec..56bf35b 100644 --- a/config/printer.wolfstrap.h +++ b/config/printer.wolfstrap.h @@ -112,9 +112,8 @@ #define E_ABSOLUTE /** \def HOMING_OPT - - Options for homing movements. 'none' means no movement at all. For each - option XXX, a function home_XXX() has to exist, typically in home.c/.h. + Options for homing movements a user should be able to choose from in configtool. All + commented out. */ //#define HOMING_OPT none //#define HOMING_OPT x_negative @@ -125,15 +124,10 @@ //#define HOMING_OPT z_positive /** \def DEFINE_HOMING - - Order (and number) of homing movements. + Order (and number) of homing movements. Up to 4 homing steps are allowed. + If you don't need even one axis just DEFINE_HOMING(none). */ -#ifndef DEFINE_HOMING - #define DEFINE_HOMING(...) -#endif -//DEFINE_HOMING_START -DEFINE_HOMING(x_negative, y_negative, z_negative, none) -//DEFINE_HOMING_END +DEFINE_HOMING(x_negative, y_negative, z_negative) /** \def ACCELERATION_REPRAP ACCELERATION_RAMPING ACCELERATION_TEMPORAL Choose optionally one of ACCELERATION_REPRAP, ACCELERATION_RAMPING or diff --git a/config_wrapper.h b/config_wrapper.h index 8558a43..2cf73d9 100644 --- a/config_wrapper.h +++ b/config_wrapper.h @@ -24,6 +24,18 @@ #define DHTR_5(name, pin, invert, pwm, max_pwm) DEFINE_HEATER_ACTUAL(name, pin, invert, pwm, max_pwm) #define DHTR_6(name, pin, invert, pwm, max_pwm, arg6) DEFINE_HEATER_ACTUAL(name, pin, invert, pwm, max_pwm) +#ifndef DEFINE_HOMING_ACTUAL + #define DEFINE_HOMING_ACTUAL(...) +#endif + +// Homing movements helpers. +#define GET_MACRO_HOME(_1, _2, _3, _4, NAME, ...) NAME +#define DEFINE_HOMING(...) GET_MACRO_HOME(__VA_ARGS__, DHM_4, DHM_3, DHM_2, DHM_1)(__VA_ARGS__) +#define DHM_1(STEP_1) DEFINE_HOMING_ACTUAL(STEP_1, none, none, none) +#define DHM_2(STEP_1, STEP_2) DEFINE_HOMING_ACTUAL(STEP_1, STEP_2, none, none) +#define DHM_3(STEP_1, STEP_2, STEP_3) DEFINE_HOMING_ACTUAL(STEP_1, STEP_2, STEP_3, none) +#define DHM_4(STEP_1, STEP_2, STEP_3, STEP_4) DEFINE_HOMING_ACTUAL(STEP_1, STEP_2, STEP_3, STEP_4) + /** This wrapper config header is used to allow makefiles and test scripts to replace or augment the user's 'config.h' file in a controlled manner. A diff --git a/configtool/printer.generic.h b/configtool/printer.generic.h index e4a518b..e7b46fc 100644 --- a/configtool/printer.generic.h +++ b/configtool/printer.generic.h @@ -112,9 +112,8 @@ #define E_ABSOLUTE /** \def HOMING_OPT - - Options for homing movements. 'none' means no movement at all. For each - option XXX, a function home_XXX() has to exist, typically in home.c/.h. + Options for homing movements a user should be able to choose from in configtool. All + commented out. */ //#define HOMING_OPT none //#define HOMING_OPT x_negative @@ -125,15 +124,10 @@ //#define HOMING_OPT z_positive /** \def DEFINE_HOMING - - Order (and number) of homing movements. + Order (and number) of homing movements. Up to 4 homing steps are allowed. + If you don't need even one axis just DEFINE_HOMING(none). */ -#ifndef DEFINE_HOMING - #define DEFINE_HOMING(...) -#endif -//DEFINE_HOMING_START -DEFINE_HOMING(x_negative, y_negative, z_negative, none) -//DEFINE_HOMING_END +DEFINE_HOMING(x_negative, y_negative, z_negative) /** \def ACCELERATION_REPRAP ACCELERATION_RAMPING ACCELERATION_TEMPORAL Choose optionally one of ACCELERATION_REPRAP, ACCELERATION_RAMPING or diff --git a/home.c b/home.c index 4019fd9..48635b3 100644 --- a/home.c +++ b/home.c @@ -71,9 +71,9 @@ void set_axis_home_position(enum axis_e n, int8_t dir); /// home all 3 axes void home() { - #ifdef DEFINE_HOMING - #undef DEFINE_HOMING - #define DEFINE_HOMING(first, second, third, fourth) \ + #ifdef DEFINE_HOMING_ACTUAL + #undef DEFINE_HOMING_ACTUAL + #define DEFINE_HOMING_ACTUAL(first, second, third, fourth) \ { \ home_##first(); \ home_##second(); \ @@ -81,7 +81,7 @@ void home() { home_##fourth(); \ }; #include "config_wrapper.h" - #undef DEFINE_HOMING + #undef DEFINE_HOMING_ACTUAL #endif }