-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup and consolidate probe conditionals for clarity #3672
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -628,7 +628,7 @@ | |
#define HAS_Z_MAX (PIN_EXISTS(Z_MAX)) | ||
#define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN)) | ||
#define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX)) | ||
#define HAS_Z_PROBE (PIN_EXISTS(Z_MIN_PROBE)) | ||
#define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE)) | ||
#define HAS_SOLENOID_1 (PIN_EXISTS(SOL1)) | ||
#define HAS_SOLENOID_2 (PIN_EXISTS(SOL2)) | ||
#define HAS_SOLENOID_3 (PIN_EXISTS(SOL3)) | ||
|
@@ -742,16 +742,11 @@ | |
#endif | ||
#endif | ||
|
||
#if ( (HAS_Z_MIN && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)) || HAS_Z_PROBE ) \ | ||
&& ( \ | ||
ENABLED(FIX_MOUNTED_PROBE) \ | ||
|| ENABLED(MECHANICAL_PROBE) \ | ||
|| HAS_Z_ENDSTOP_SERVO \ | ||
|| ENABLED(Z_PROBE_ALLEN_KEY) \ | ||
|| ENABLED(Z_PROBE_SLED) \ | ||
) | ||
#define HAS_Z_MIN_PROBE | ||
#endif | ||
#define PROBE_SELECTED (ENABLED(FIX_MOUNTED_PROBE) || ENABLED(MECHANICAL_PROBE) || HAS_Z_ENDSTOP_SERVO || ENABLED(Z_PROBE_SLED)) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
#define PROBE_PIN_CONFIGURED (HAS_Z_MIN_PROBE_PIN || (HAS_Z_MIN && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN))) | ||
|
||
#define HAS_BED_PROBE (PROBE_SELECTED && PROBE_PIN_CONFIGURED) | ||
|
||
/** | ||
* Delta radius/rod trimmers | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,50 +204,55 @@ | |
* Probes | ||
*/ | ||
|
||
/** | ||
* A probe needs a pin | ||
*/ | ||
#if (!((HAS_Z_MIN && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)) || HAS_Z_PROBE )) && ( ENABLED(FIX_MOUNTED_PROBE) || defined(Z_ENDSTOP_SERVO_NR) || ENABLED(MECHANICAL_PROBE) || ENABLED(Z_PROBE_SLED)) | ||
#error A probe needs a pin! [Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN || HAS_Z_PROBE] | ||
#endif | ||
#if PROBE_SELECTED | ||
|
||
#if ((HAS_Z_MIN && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)) && HAS_Z_PROBE) && ( ENABLED(FIX_MOUNTED_PROBE) || defined(Z_ENDSTOP_SERVO_NR) || ENABLED(MECHANICAL_PROBE) || ENABLED(Z_PROBE_SLED)) | ||
#error A probe should not be connected to more than one pin! [Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN || HAS_Z_PROBE] | ||
#endif | ||
/** | ||
* A probe needs a pin | ||
*/ | ||
#if !PROBE_PIN_CONFIGURED | ||
#error A probe needs a pin! Use Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN or Z_MIN_PROBE_PIN. | ||
#endif | ||
|
||
/** | ||
* Require one kind of probe | ||
*/ | ||
#if ENABLED(AUTO_BED_LEVELING_FEATURE) && !( ENABLED(FIX_MOUNTED_PROBE) || defined(Z_ENDSTOP_SERVO_NR) || ENABLED(MECHANICAL_PROBE) || ENABLED(Z_PROBE_SLED)) | ||
#error For AUTO_BED_LEVELING_FEATURE define one kind of probe! [Servo | MECHANICAL_PROBE | Z_PROBE_SLED | FIX_MOUNTED_PROBE] | ||
#endif | ||
/** | ||
* Z_MIN_PIN and Z_MIN_PROBE_PIN can't co-exist when Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN | ||
*/ | ||
#if HAS_Z_MIN && HAS_Z_MIN_PROBE_PIN && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) | ||
#error A probe cannot have more than one pin! Use Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN or Z_MIN_PROBE_PIN. | ||
#endif | ||
|
||
// To do: Fail with more than one probe defined | ||
/** | ||
* Make sure the plug is enabled if it's used | ||
*/ | ||
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && DISABLED(USE_ZMIN_PLUG) | ||
#error You must enable USE_ZMIN_PLUG if any probe or endstop is connected to the ZMIN plug. | ||
#endif | ||
|
||
/** | ||
* Auto Bed Leveling | ||
*/ | ||
#if ENABLED(AUTO_BED_LEVELING_FEATURE) | ||
/** | ||
* Only allow one probe option to be defined | ||
*/ | ||
#if (ENABLED(FIX_MOUNTED_PROBE) && (ENABLED(MECHANICAL_PROBE) || HAS_Z_ENDSTOP_SERVO || ENABLED(Z_PROBE_SLED))) \ | ||
|| (ENABLED(MECHANICAL_PROBE) && (HAS_Z_ENDSTOP_SERVO || ENABLED(Z_PROBE_SLED))) \ | ||
|| (HAS_Z_ENDSTOP_SERVO && ENABLED(Z_PROBE_SLED)) | ||
#error Please define only one type of probe: Z Servo, MECHANICAL_PROBE, Z_PROBE_SLED, or FIX_MOUNTED_PROBE. | ||
#endif | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Allen Key? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
/** | ||
* Require a Z min pin | ||
* Don't allow nonsense probe-pin settings | ||
*/ | ||
#if !PIN_EXISTS(Z_MIN) | ||
#if !PIN_EXISTS(Z_MIN_PROBE) || (DISABLED(Z_MIN_PROBE_ENDSTOP) || ENABLED(DISABLE_Z_MIN_PROBE_ENDSTOP)) // It's possible for someone to set a pin for the Z probe, but not enable it. | ||
#if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) | ||
#error You must have a Z_MIN or Z_PROBE endstop to enable Z_MIN_PROBE_REPEATABILITY_TEST. | ||
#else | ||
#error AUTO_BED_LEVELING_FEATURE requires a Z_MIN or Z_PROBE endstop. Z_MIN_PIN or Z_MIN_PROBE_PIN must point to a valid hardware pin. | ||
#endif | ||
#endif | ||
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && ENABLED(Z_MIN_PROBE_ENDSTOP) | ||
#error You can't enable both Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN and Z_MIN_PROBE_ENDSTOP. | ||
#elif ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && ENABLED(DISABLE_Z_MIN_PROBE_ENDSTOP) | ||
#error Don't enable DISABLE_Z_MIN_PROBE_ENDSTOP with Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN. | ||
#elif ENABLED(DISABLE_Z_MIN_PROBE_ENDSTOP) && DISABLED(Z_MIN_PROBE_ENDSTOP) | ||
#error DISABLE_Z_MIN_PROBE_ENDSTOP requires Z_MIN_PROBE_ENDSTOP to be set. | ||
#endif | ||
|
||
/** | ||
* Require a Z probe pin if Z_MIN_PROBE_ENDSTOP is enabled. | ||
*/ | ||
#if ENABLED(Z_MIN_PROBE_ENDSTOP) | ||
#if !PIN_EXISTS(Z_MIN_PROBE) | ||
#error You must have a Z_MIN_PROBE_PIN defined in your pins_XXXX.h file if you enable Z_MIN_PROBE_ENDSTOP. | ||
#if !HAS_Z_MIN_PROBE_PIN | ||
#error Z_MIN_PROBE_ENDSTOP requires a Z_MIN_PROBE_PIN in your board's pins_XXXX.h file. | ||
#endif | ||
// Forcing Servo definitions can break some hall effect sensor setups. Leaving these here for further comment. | ||
//#ifndef NUM_SERVOS | ||
|
@@ -263,6 +268,36 @@ | |
// #error You must have SERVO_ENDSTOP_ANGLES defined for Z Extend and Retract to use Z_MIN_PROBE_ENDSTOP. | ||
//#endif | ||
#endif | ||
|
||
#else | ||
|
||
/** | ||
* Require some kind of probe for bed leveling | ||
*/ | ||
#if ENABLED(AUTO_BED_LEVELING_FEATURE) | ||
#error AUTO_BED_LEVELING_FEATURE requires a probe! Define a Z Servo, MECHANICAL_PROBE, Z_PROBE_SLED, or FIX_MOUNTED_PROBE. | ||
#endif | ||
|
||
#endif | ||
|
||
/** | ||
* Auto Bed Leveling | ||
*/ | ||
#if ENABLED(AUTO_BED_LEVELING_FEATURE) | ||
|
||
/** | ||
* Require a Z min pin | ||
*/ | ||
#if !PIN_EXISTS(Z_MIN) | ||
#if !PIN_EXISTS(Z_MIN_PROBE) || (DISABLED(Z_MIN_PROBE_ENDSTOP) || ENABLED(DISABLE_Z_MIN_PROBE_ENDSTOP)) // It's possible for someone to set a pin for the Z probe, but not enable it. | ||
#if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) | ||
#error You must have a Z_MIN or Z_PROBE endstop to enable Z_MIN_PROBE_REPEATABILITY_TEST. | ||
#else | ||
#error AUTO_BED_LEVELING_FEATURE requires a Z_MIN or Z_PROBE endstop. Z_MIN_PIN or Z_MIN_PROBE_PIN must point to a valid hardware pin. | ||
#endif | ||
#endif | ||
#endif | ||
|
||
/** | ||
* Check if Probe_Offset * Grid Points is greater than Probing Range | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
Z_MIN
inHAS_Z_MIN_PROBE_PIN
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It reflects the naming of the pin. If the pin was called
PROBE_PIN
then by convention, this would beHAS_PROBE
(but you can see why that's confusing, given the naming of some other conditionals, likeHAS_ANY_PROBE
andHAS_Z_PROBE
.) It's because of this confusion that I even added_PIN
to the end in contravention.Maybe we should consider
BED_PROBE_PIN
as the pin name. ButBED
almost always refers to heaters/thermistors and the bed, not things that probe the bed… Naming things can be tricky.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's really
Z_MIN_PROBE_ENDSTOP
that I most want to rename. It's too damn vague.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed we have removed the possibility to have z-max, x-max, x-min, y-max, y-min probes/servo-endstops. So z-min is the only remaining one. So PROBE seems to be enough to describe.
A possible concept for the use and pin configuration of a probe could be
The names are a bit long, but hopefully self explaining.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like nobody told
homeaxis()
that fact…