home: use some helper macros

like the heater.
This commit is contained in:
Nico Tonnhofer 2019-01-14 22:22:01 +01:00
parent 86123f80f7
commit e4896a1257
8 changed files with 46 additions and 70 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

8
home.c
View File

@ -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
}