Check probes only when deployed
Aim: Test probes in update_endstops only when activated Changes: Configurations Add define for FIX_MOUNTED_PROBE to handle the situation where formerly ENDSTOPS_ONLY_FOR_HOMING had to be set, or lowering the nozzle below Z_PROBE_OFFSET_FROM_EXTRUDER could give an "endstop hit" message. Add define for Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN to indicate a common situation, that we have a probe but it is connected to an endstop pin Add some comments Shift some entries to have related things together. Conditionals.h We have a probe (HAS_Z_MIN_PROBE) if one of the pins is defined AND one of the probes is defined. SanityCheck.h Add some tests if the probe is connected and if we have defined a probe. stepper.cpp Changes to test the probe only when it is deployed (z_probe_is_active). Test update_endstops() when the probe is deployed. MarlinMain.cpp a. set and reset z_probe_is_active in deploy_z_probe(), stow_z_probe() and dock_sled() b. set and reset z_probe_is_active in the case a z-servo is moved to a defined position. The only remaining unhandled servo move is in M280 where we do not end in a defined position. If you want to handle a probe use M401/402 c. skip deploying/stowing when already deployed/stowed in the dedicated deploy/stow functions. d. Handle the new FIX_MOUNTED_PROBE in parallel to a servo driven probe/endstop. To do: In another PR. handle all probes in deploy/stow_z_probe. Sort out SERVO_LEVELING vs. HAS_SERVO_ENDSTOPS.
This commit is contained in:
		| @@ -337,10 +337,52 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
| //#define DISABLE_MAX_ENDSTOPS | ||||
| //#define DISABLE_MIN_ENDSTOPS | ||||
|  | ||||
| //=========================================================================== | ||||
| //============================= Z Probe Options ============================= | ||||
| //=========================================================================== | ||||
|  | ||||
| // Enable Z_MIN_PROBE_ENDSTOP to use _both_ a Z-probe and a Z-min-endstop on the same machine. | ||||
| // With this option the Z_MIN_PROBE_PIN will only be used for probing, never for homing. | ||||
| // | ||||
| // *** PLEASE READ ALL INSTRUCTIONS BELOW FOR SAFETY! *** | ||||
| // | ||||
| // To continue using the Z-min-endstop for homing, be sure to disable Z_SAFE_HOMING. | ||||
| // Example: To park the head outside the bed area when homing with G28. | ||||
| // | ||||
| // To use a separate Z probe, your board must define a Z_MIN_PROBE_PIN. | ||||
| // | ||||
| // For a servo-based Z probe, you must set up servo support below, including | ||||
| // NUM_SERVOS, Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES. | ||||
| // | ||||
| // - RAMPS 1.3/1.4 boards may be able to use the 5V, GND, and Aux4->D32 pin. | ||||
| // - Use 5V for powered (usu. inductive) sensors. | ||||
| // - Otherwise connect: | ||||
| //   - normally-closed switches to GND and D32. | ||||
| //   - normally-open switches to 5V and D32. | ||||
| // | ||||
| // Normally-closed switches are advised and are the default. | ||||
| // | ||||
| // The Z_MIN_PROBE_PIN sets the Arduino pin to use. (See your board's pins file.) | ||||
| // Since the RAMPS Aux4->D32 pin maps directly to the Arduino D32 pin, D32 is the | ||||
| // default pin for all RAMPS-based boards. Some other boards map differently. | ||||
| // To set or change the pin for your board, edit the appropriate pins_XXXXX.h file. | ||||
| // | ||||
| // WARNING: | ||||
| // Setting the wrong pin may have unexpected and potentially disastrous consequences. | ||||
| // Use with caution and do your homework. | ||||
| // | ||||
| //#define Z_MIN_PROBE_ENDSTOP | ||||
|  | ||||
| // If you want to use the Z_MIN_PIN to connect your Z_MIN_PROBE comment out the next define. | ||||
| // In other words. The z-min-probe is connected to the Z_MIN_PIN and is used for homing and for probing. | ||||
| #define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN | ||||
| // If you want to use a probe you do have to define one of the two defines above! | ||||
|  | ||||
| // If you want to enable the Z probe pin, but disable its use, uncomment the line below. | ||||
| // This only affects a Z probe endstop if you have separate Z min endstop as well and have | ||||
| // activated Z_MIN_PROBE_ENDSTOP below. If you are using the Z Min endstop on your Z probe, | ||||
| // activated Z_MIN_PROBE_ENDSTOP above. If you are using the Z Min endstop on your Z probe, | ||||
| // this has no effect. | ||||
| // In other words. If a Z_MIN_PROBE_PIN is defined in your pin file - don't use it. | ||||
| //#define DISABLE_Z_MIN_PROBE_ENDSTOP | ||||
|  | ||||
| // For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1 | ||||
| @@ -521,6 +563,18 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
|   //#define Z_PROBE_END_SCRIPT "G1 Z10 F12000\nG1 X15 Y330\nG1 Z0.5\nG1 Z10" // These commands will be executed in the end of G29 routine. | ||||
|                                                                              // Useful to retract a deployable Z probe. | ||||
|  | ||||
|   // Probes are sensors/switches that need to be activated before they can be used | ||||
|   // and deactivated after the use. | ||||
|   // Allen Key Probes, Servo Probes, Z-Sled Probes, FIX_MOUNTED_PROBE, ... . You have to activate one of these for the AUTO_BED_LEVELING_FEATURE | ||||
|  | ||||
|   // A fix mounted probe, like the normal inductive probe, must be deactivated to go below Z_PROBE_OFFSET_FROM_EXTRUDER | ||||
|   // when the hardware endstops are active. | ||||
|   //#define FIX_MOUNTED_PROBE | ||||
|  | ||||
|   // A Servo Probe can be defined in the servo section below. | ||||
|  | ||||
|   // A Allen Key Probe is currently predefined only in the delta example configurations. | ||||
|  | ||||
|   //#define Z_PROBE_SLED // Turn on if you have a Z probe mounted on a sled like those designed by Charles Bell. | ||||
|   //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like. | ||||
|  | ||||
| @@ -528,7 +582,8 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
|   //If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing, | ||||
|   //it is highly recommended you let this Z_SAFE_HOMING enabled!!! | ||||
|  | ||||
|   #define Z_SAFE_HOMING   // This feature is meant to avoid Z homing with Z probe outside the bed area. | ||||
|   #define Z_SAFE_HOMING   // Use the z-min-probe for homing to z-min - not the z-min-endstop. | ||||
|                           // This feature is meant to avoid Z homing with Z probe outside the bed area. | ||||
|                           // When defined, it will: | ||||
|                           // - Allow Z homing only after X and Y homing AND stepper drivers still enabled. | ||||
|                           // - If stepper drivers timeout, it will need X and Y homing again before Z homing. | ||||
| @@ -542,37 +597,6 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l | ||||
|  | ||||
|   #endif | ||||
|  | ||||
|   // Support for a dedicated Z probe endstop separate from the Z min endstop. | ||||
|   // If you would like to use both a Z probe and a Z min endstop together, | ||||
|   // uncomment #define Z_MIN_PROBE_ENDSTOP and read the instructions below. | ||||
|   // If you still want to use the Z min endstop for homing, disable Z_SAFE_HOMING above. | ||||
|   // Example: To park the head outside the bed area when homing with G28. | ||||
|   // | ||||
|   // WARNING: | ||||
|   // The Z min endstop will need to set properly as it would without a Z probe | ||||
|   // to prevent head crashes and premature stopping during a print. | ||||
|   // | ||||
|   // To use a separate Z probe endstop, you must have a Z_MIN_PROBE_PIN | ||||
|   // defined in the pins_XXXXX.h file for your control board. | ||||
|   // If you are using a servo based Z probe, you will need to enable NUM_SERVOS, | ||||
|   // Z_ENDSTOP_SERVO_NR and SERVO_ENDSTOP_ANGLES in the R/C SERVO support below. | ||||
|   // RAMPS 1.3/1.4 boards may be able to use the 5V, Ground and the D32 pin | ||||
|   // in the Aux 4 section of the RAMPS board. Use 5V for powered sensors, | ||||
|   // otherwise connect to ground and D32 for normally closed configuration | ||||
|   // and 5V and D32 for normally open configurations. | ||||
|   // Normally closed configuration is advised and assumed. | ||||
|   // The D32 pin in Aux 4 on RAMPS maps to the Arduino D32 pin. | ||||
|   // Z_MIN_PROBE_PIN is setting the pin to use on the Arduino. | ||||
|   // Since the D32 pin on the RAMPS maps to D32 on Arduino, this works. | ||||
|   // D32 is currently selected in the RAMPS 1.3/1.4 pin file. | ||||
|   // All other boards will need changes to the respective pins_XXXXX.h file. | ||||
|   // | ||||
|   // WARNING: | ||||
|   // Setting the wrong pin may have unexpected and potentially disastrous outcomes. | ||||
|   // Use with caution and do your homework. | ||||
|   // | ||||
|   //#define Z_MIN_PROBE_ENDSTOP | ||||
|  | ||||
| #endif // AUTO_BED_LEVELING_FEATURE | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user