Skip to content
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

Clean up, simplify and generalize the Allen-key-probe code. #4207

Merged
merged 4 commits into from
Jul 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Marlin/Conditionals.h
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,10 @@

#define HAS_BED_PROBE (PROBE_SELECTED && PROBE_PIN_CONFIGURED)

#if ENABLED(Z_PROBE_ALLEN_KEY)
#define PROBE_IS_TRIGGERED_WHEN_STOWED_TEST
#endif

/**
* Bed Probe dependencies
*/
Expand Down
442 changes: 231 additions & 211 deletions Marlin/Marlin_main.cpp

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions Marlin/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,14 +425,11 @@
#endif

/**
* Allen Key Z probe requires Delta and Auto Bed Leveling grid
* Allen Key
* Deploying the Allen Key probe uses big moves in z direction. Too dangerous for an unhomed z-axis.
*/
#if ENABLED(Z_PROBE_ALLEN_KEY)
#if !ENABLED(DELTA)
#error "Z_PROBE_ALLEN_KEY is only usable with DELTA."
#elif ENABLED(MESH_BED_LEVELING) || (ENABLED(AUTO_BED_LEVELING_FEATURE) && !ENABLED(AUTO_BED_LEVELING_GRID))
#error "Z_PROBE_ALLEN_KEY can only use AUTO_BED_LEVELING_GRID leveling."
#endif
#if ENABLED(Z_PROBE_ALLEN_KEY) && (Z_HOME_DIR < 0) && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
#error "You can't home to a z min endstop with a Z_PROBE_ALLEN_KEY"
#endif

/**
Expand Down
10 changes: 10 additions & 0 deletions Marlin/example_configurations/delta/biv2.5/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
#define Z_PROBE_ALLEN_KEY_DEPLOY_2_Z 100.0
#define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE XY_PROBE_SPEED

#define Z_PROBE_ALLEN_KEY_DEPLOY_3_X Z_PROBE_ALLEN_KEY_DEPLOY_2_X * 0.75
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Y Z_PROBE_ALLEN_KEY_DEPLOY_2_Y * 0.75
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Z Z_PROBE_ALLEN_KEY_DEPLOY_2_Z
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE XY_PROBE_SPEED

#define Z_PROBE_ALLEN_KEY_DEPLOY_3_X 45.00 // Move right to trigger deploy pin
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Y -125.00
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Z 100.0
Expand All @@ -538,6 +543,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
#define Z_PROBE_ALLEN_KEY_STOW_3_Z 100.0
#define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE XY_PROBE_SPEED

#define Z_PROBE_ALLEN_KEY_STOW_4_X 0.0
#define Z_PROBE_ALLEN_KEY_STOW_4_Y 0.0
#define Z_PROBE_ALLEN_KEY_STOW_4_Z Z_PROBE_ALLEN_KEY_STOW_3_Z
#define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE XY_PROBE_SPEED
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I see the last move is just a move back to center… I wonder if that should just be the standard.

Copy link
Member Author

@AnHardt AnHardt Jul 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 -      destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Z;       
 -      prepare_move_to_destination();      
 -      
 -      // Home XY for safety       
 -      feedrate = homing_feedrate[X_AXIS] / 2;     
 -      destination[X_AXIS] = 0;        
 -      destination[Y_AXIS] = 0;        
 -      prepare_move_to_destination(); // this will also set_current_to_destination     
 -      
 -      feedrate = old_feedrate;        

Just a replacement for the formerly hard coded move. Now you can change or omit it - if you want.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja, I like the new configurable method better.


#endif // Z_PROBE_ALLEN_KEY

// Enable Z_MIN_PROBE_ENDSTOP to use _both_ a Z Probe and a Z-min-endstop on the same machine.
Expand Down
10 changes: 10 additions & 0 deletions Marlin/example_configurations/delta/generic/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
#define Z_PROBE_ALLEN_KEY_DEPLOY_2_Z 100.0
#define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_SPEED)/10

#define Z_PROBE_ALLEN_KEY_DEPLOY_3_X Z_PROBE_ALLEN_KEY_DEPLOY_2_X * 0.75
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Y Z_PROBE_ALLEN_KEY_DEPLOY_2_Y * 0.75
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Z Z_PROBE_ALLEN_KEY_DEPLOY_2_Z
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE XY_PROBE_SPEED

#define Z_PROBE_ALLEN_KEY_STOW_1_X -64.0 // Move the probe into position
#define Z_PROBE_ALLEN_KEY_STOW_1_Y 56.0
#define Z_PROBE_ALLEN_KEY_STOW_1_Z 23.0
Expand All @@ -532,6 +537,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
#define Z_PROBE_ALLEN_KEY_STOW_3_Z 50.0
#define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE XY_PROBE_SPEED

#define Z_PROBE_ALLEN_KEY_STOW_4_X 0.0
#define Z_PROBE_ALLEN_KEY_STOW_4_Y 0.0
#define Z_PROBE_ALLEN_KEY_STOW_4_Z Z_PROBE_ALLEN_KEY_STOW_3_Z
#define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE XY_PROBE_SPEED

#endif // Z_PROBE_ALLEN_KEY

// Enable Z_MIN_PROBE_ENDSTOP to use _both_ a Z Probe and a Z-min-endstop on the same machine.
Expand Down
10 changes: 10 additions & 0 deletions Marlin/example_configurations/delta/kossel_mini/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#define Z_PROBE_ALLEN_KEY_DEPLOY_2_Z 100.0
#define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_SPEED/10)

#define Z_PROBE_ALLEN_KEY_DEPLOY_3_X Z_PROBE_ALLEN_KEY_DEPLOY_2_X * 0.75
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Y Z_PROBE_ALLEN_KEY_DEPLOY_2_Y * 0.75
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Z Z_PROBE_ALLEN_KEY_DEPLOY_2_Z
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE XY_PROBE_SPEED

#define Z_PROBE_ALLEN_KEY_STOW_DEPTH 20
// Move the probe into position
#define Z_PROBE_ALLEN_KEY_STOW_1_X -64.0
Expand All @@ -535,6 +540,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#define Z_PROBE_ALLEN_KEY_STOW_3_Z (Z_PROBE_ALLEN_KEY_STOW_1_Z+Z_PROBE_ALLEN_KEY_STOW_DEPTH)
#define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE (XY_PROBE_SPEED/2)

#define Z_PROBE_ALLEN_KEY_STOW_4_X 0.0
#define Z_PROBE_ALLEN_KEY_STOW_4_Y 0.0
#define Z_PROBE_ALLEN_KEY_STOW_4_Z Z_PROBE_ALLEN_KEY_STOW_3_Z
#define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE XY_PROBE_SPEED

#endif // Z_PROBE_ALLEN_KEY

// Enable Z_MIN_PROBE_ENDSTOP to use _both_ a Z Probe and a Z-min-endstop on the same machine.
Expand Down
10 changes: 10 additions & 0 deletions Marlin/example_configurations/delta/kossel_pro/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#define Z_PROBE_ALLEN_KEY_DEPLOY_2_Z Z_PROBE_ALLEN_KEY_DEPLOY_1_Z
#define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE XY_PROBE_SPEED

#define Z_PROBE_ALLEN_KEY_DEPLOY_3_X Z_PROBE_ALLEN_KEY_DEPLOY_2_X * 0.75
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Y Z_PROBE_ALLEN_KEY_DEPLOY_2_Y * 0.75
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Z Z_PROBE_ALLEN_KEY_DEPLOY_2_Z
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE XY_PROBE_SPEED

#define Z_PROBE_ALLEN_KEY_DEPLOY_3_X 45.00 // Move right to trigger deploy pin
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Y -125.00
#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Z Z_PROBE_ALLEN_KEY_DEPLOY_2_Z
Expand All @@ -529,6 +534,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#define Z_PROBE_ALLEN_KEY_STOW_3_Z 100.0
#define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE XY_PROBE_SPEED

#define Z_PROBE_ALLEN_KEY_STOW_4_X 0.0
#define Z_PROBE_ALLEN_KEY_STOW_4_Y 0.0
#define Z_PROBE_ALLEN_KEY_STOW_4_Z Z_PROBE_ALLEN_KEY_STOW_3_Z
#define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE XY_PROBE_SPEED

#endif // Z_PROBE_ALLEN_KEY

// Enable Z_MIN_PROBE_ENDSTOP to use _both_ a Z Probe and a Z-min-endstop on the same machine.
Expand Down
10 changes: 10 additions & 0 deletions Marlin/example_configurations/delta/kossel_xl/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
//#define Z_PROBE_ALLEN_KEY_DEPLOY_2_Z 100.0
//#define Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE (XY_PROBE_SPEED)/10

//#define Z_PROBE_ALLEN_KEY_DEPLOY_3_X Z_PROBE_ALLEN_KEY_DEPLOY_2_X * 0.75
//#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Y Z_PROBE_ALLEN_KEY_DEPLOY_2_Y * 0.75
//#define Z_PROBE_ALLEN_KEY_DEPLOY_3_Z Z_PROBE_ALLEN_KEY_DEPLOY_2_Z
//#define Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE XY_PROBE_SPEED

//#define Z_PROBE_ALLEN_KEY_STOW_1_X -64.0 // Move the probe into position
//#define Z_PROBE_ALLEN_KEY_STOW_1_Y 56.0
//#define Z_PROBE_ALLEN_KEY_STOW_1_Z 23.0
Expand All @@ -530,6 +535,11 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
//#define Z_PROBE_ALLEN_KEY_STOW_3_Z 50.0
//#define Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE XY_PROBE_SPEED

//#define Z_PROBE_ALLEN_KEY_STOW_4_X 0.0
//#define Z_PROBE_ALLEN_KEY_STOW_4_Y 0.0
//#define Z_PROBE_ALLEN_KEY_STOW_4_Z Z_PROBE_ALLEN_KEY_STOW_3_Z
//#define Z_PROBE_ALLEN_KEY_STOW_4_FEEDRATE XY_PROBE_SPEED

#endif // Z_PROBE_ALLEN_KEY

// Enable Z_MIN_PROBE_ENDSTOP to use _both_ a Z Probe and a Z-min-endstop on the same machine.
Expand Down