From 868eebfdeee0a0d00d35496ae95baa7e8258b278 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 2 Mar 2016 02:05:21 -0800 Subject: [PATCH] Simplify configuration of Z2 endstops --- Marlin/Conditionals.h | 41 +++++++++++++++++++ Marlin/Configuration_adv.h | 4 +- Marlin/SanityCheck.h | 2 + .../Felix/Configuration_adv.h | 4 +- .../Hephestos/Configuration_adv.h | 4 +- .../Hephestos_2/Configuration_adv.h | 4 +- .../K8200/Configuration_adv.h | 4 +- .../RigidBot/Configuration_adv.h | 4 +- .../SCARA/Configuration_adv.h | 4 +- .../TAZ4/Configuration_adv.h | 4 +- .../WITBOX/Configuration_adv.h | 4 +- .../delta/biv2.5/Configuration_adv.h | 4 +- .../delta/generic/Configuration_adv.h | 4 +- .../delta/kossel_mini/Configuration_adv.h | 4 +- .../delta/kossel_pro/Configuration_adv.h | 4 +- .../delta/kossel_xl/Configuration_adv.h | 4 +- .../makibox/Configuration_adv.h | 4 +- .../tvrrug/Round2/Configuration_adv.h | 4 +- 18 files changed, 59 insertions(+), 48 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index 7e6e64c91..146565b4f 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -503,6 +503,47 @@ #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1) + /** + * Z_DUAL_ENDSTOPS endstop reassignment + */ + #if ENABLED(Z_DUAL_ENDSTOPS) + #define _XMIN_ 100 + #define _YMIN_ 200 + #define _ZMIN_ 300 + #define _XMAX_ 101 + #define _YMAX_ 201 + #define _ZMAX_ 301 + const bool Z2_MAX_ENDSTOP_INVERTING = + #if Z2_USE_ENDSTOP == _XMAX_ + X_MAX_ENDSTOP_INVERTING + #define Z2_MAX_PIN X_MAX_PIN + #undef USE_XMAX_PLUG + #elif Z2_USE_ENDSTOP == _YMAX_ + Y_MAX_ENDSTOP_INVERTING + #define Z2_MAX_PIN Y_MAX_PIN + #undef USE_YMAX_PLUG + #elif Z2_USE_ENDSTOP == _ZMAX_ + Z_MAX_ENDSTOP_INVERTING + #define Z2_MAX_PIN Z_MAX_PIN + #undef USE_ZMAX_PLUG + #elif Z2_USE_ENDSTOP == _XMIN_ + X_MIN_ENDSTOP_INVERTING + #define Z2_MAX_PIN X_MIN_PIN + #undef USE_XMIN_PLUG + #elif Z2_USE_ENDSTOP == _YMIN_ + Y_MIN_ENDSTOP_INVERTING + #define Z2_MAX_PIN Y_MIN_PIN + #undef USE_YMIN_PLUG + #elif Z2_USE_ENDSTOP == _ZMIN_ + Z_MIN_ENDSTOP_INVERTING + #define Z2_MAX_PIN Z_MIN_PIN + #undef USE_ZMIN_PLUG + #else + 0 + #endif + ; + #endif + /** * Shorthand for pin tests, used wherever needed */ diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 84f001fb8..4dd7739d2 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -201,9 +201,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index c1edb4a5b..8487792d2 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -469,6 +469,8 @@ #error FILAMENT_SENSOR is deprecated. Use FILAMENT_WIDTH_SENSOR instead. #elif defined(DISABLE_MAX_ENDSTOPS) || defined(DISABLE_MIN_ENDSTOPS) #error DISABLE_MAX_ENDSTOPS and DISABLE_MIN_ENDSTOPS deprecated - set USE_*_ENDSTOP flags instead +#elif ENABLED(Z_DUAL_ENDSTOPS) && !defined(Z2_USE_ENDSTOP) + #error Z_DUAL_ENDSTOPS settings are simplified. Just set Z2_USE_ENDSTOP to the endstop you want to repurpose for Z2 #endif #endif //SANITYCHECK_H diff --git a/Marlin/example_configurations/Felix/Configuration_adv.h b/Marlin/example_configurations/Felix/Configuration_adv.h index 5608d4b39..d5b2942d6 100644 --- a/Marlin/example_configurations/Felix/Configuration_adv.h +++ b/Marlin/example_configurations/Felix/Configuration_adv.h @@ -201,9 +201,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/Hephestos/Configuration_adv.h b/Marlin/example_configurations/Hephestos/Configuration_adv.h index fcdee236a..b92a73798 100644 --- a/Marlin/example_configurations/Hephestos/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos/Configuration_adv.h @@ -201,9 +201,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h index 3131e10b2..b5a451c53 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration_adv.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration_adv.h @@ -201,9 +201,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/K8200/Configuration_adv.h b/Marlin/example_configurations/K8200/Configuration_adv.h index f5b6e70ea..5c47bde71 100644 --- a/Marlin/example_configurations/K8200/Configuration_adv.h +++ b/Marlin/example_configurations/K8200/Configuration_adv.h @@ -207,9 +207,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/RigidBot/Configuration_adv.h b/Marlin/example_configurations/RigidBot/Configuration_adv.h index c93dde281..17e19b083 100644 --- a/Marlin/example_configurations/RigidBot/Configuration_adv.h +++ b/Marlin/example_configurations/RigidBot/Configuration_adv.h @@ -201,9 +201,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/SCARA/Configuration_adv.h b/Marlin/example_configurations/SCARA/Configuration_adv.h index 627067d77..1b09057ed 100644 --- a/Marlin/example_configurations/SCARA/Configuration_adv.h +++ b/Marlin/example_configurations/SCARA/Configuration_adv.h @@ -201,9 +201,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/TAZ4/Configuration_adv.h b/Marlin/example_configurations/TAZ4/Configuration_adv.h index c052253a1..62dde979c 100644 --- a/Marlin/example_configurations/TAZ4/Configuration_adv.h +++ b/Marlin/example_configurations/TAZ4/Configuration_adv.h @@ -209,9 +209,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/WITBOX/Configuration_adv.h b/Marlin/example_configurations/WITBOX/Configuration_adv.h index fcdee236a..b92a73798 100644 --- a/Marlin/example_configurations/WITBOX/Configuration_adv.h +++ b/Marlin/example_configurations/WITBOX/Configuration_adv.h @@ -201,9 +201,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h index 85734dc41..491cf38f3 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration_adv.h @@ -201,9 +201,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/delta/generic/Configuration_adv.h b/Marlin/example_configurations/delta/generic/Configuration_adv.h index 006502e7a..414d4de32 100644 --- a/Marlin/example_configurations/delta/generic/Configuration_adv.h +++ b/Marlin/example_configurations/delta/generic/Configuration_adv.h @@ -201,9 +201,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h index 4b93e4647..a9de9f43a 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h @@ -201,9 +201,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h index b3fec75c5..29d9607ac 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h @@ -206,9 +206,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h index 44e7942eb..23829cbbc 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h @@ -201,9 +201,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/makibox/Configuration_adv.h b/Marlin/example_configurations/makibox/Configuration_adv.h index 9b131b329..301f362b6 100644 --- a/Marlin/example_configurations/makibox/Configuration_adv.h +++ b/Marlin/example_configurations/makibox/Configuration_adv.h @@ -201,9 +201,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h index 37d3bd81e..0c62e7911 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h @@ -201,9 +201,7 @@ //#define Z_DUAL_ENDSTOPS #if ENABLED(Z_DUAL_ENDSTOPS) - #define Z2_MAX_PIN 36 //Endstop used for Z2 axis. In this case I'm using XMAX in a Rumba Board (pin 36) - const bool Z2_MAX_ENDSTOP_INVERTING = false; - #define DISABLE_XMAX_ENDSTOP //Better to disable the XMAX to avoid conflict. Just rename "XMAX_ENDSTOP" by the endstop you are using for Z2 axis. + #define Z2_USE_ENDSTOP _XMAX_ #endif #endif // Z_DUAL_STEPPER_DRIVERS