[2.0.x] Add O (optional) flag to G28/G29 (#10913)

This commit is contained in:
Robert Mendon 2018-06-11 20:51:48 -06:00 committed by Scott Lahteine
parent 2ddba201c0
commit 86170e6a66
2 changed files with 23 additions and 0 deletions

View File

@ -68,6 +68,8 @@
*
* Enhanced G29 Auto Bed Leveling Probe Routine
*
* O Auto-level only if needed
*
* D Dry-Run mode. Just evaluate the bed Topology - Don't apply
* or alter the bed level data. Useful to check the topology
* after a first run of G29.
@ -174,6 +176,15 @@ void GcodeSuite::G29() {
// Don't allow auto-leveling without homing first
if (axis_unhomed_error()) return;
if (!no_action && planner.leveling_active && parser.boolval('O')) { // Auto-level only if needed
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOLNPGM("> Auto-level not needed, skip");
SERIAL_ECHOLNPGM("<<< G29");
}
#endif
return;
}
// Define local vars 'static' for manual probing, 'auto' otherwise
#if ENABLED(PROBE_MANUALLY)
#define ABL_VAR static

View File

@ -152,6 +152,8 @@
* None Home to all axes with no parameters.
* With QUICK_HOME enabled XY will home together, then Z.
*
* O Home only if position is unknown
*
* Rn Raise by n mm/inches before homing
*
* Cartesian/SCARA parameters
@ -170,6 +172,16 @@ void GcodeSuite::G28(const bool always_home_all) {
}
#endif
if ((axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]) && parser.boolval('O')) { // home only if needed
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOLNPGM("> homing not needed, skip");
SERIAL_ECHOLNPGM("<<< G28");
}
#endif
return;
}
// Wait for planner moves to finish!
planner.synchronize();