Browse Source

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

pull/1/head
Robert Mendon 7 years ago
committed by Scott Lahteine
parent
commit
86170e6a66
  1. 11
      Marlin/src/gcode/bedlevel/abl/G29.cpp
  2. 12
      Marlin/src/gcode/calibrate/G28.cpp

11
Marlin/src/gcode/bedlevel/abl/G29.cpp

@ -68,6 +68,8 @@
* *
* Enhanced G29 Auto Bed Leveling Probe Routine * 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 * D Dry-Run mode. Just evaluate the bed Topology - Don't apply
* or alter the bed level data. Useful to check the topology * or alter the bed level data. Useful to check the topology
* after a first run of G29. * after a first run of G29.
@ -174,6 +176,15 @@ void GcodeSuite::G29() {
// Don't allow auto-leveling without homing first // Don't allow auto-leveling without homing first
if (axis_unhomed_error()) return; 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 // Define local vars 'static' for manual probing, 'auto' otherwise
#if ENABLED(PROBE_MANUALLY) #if ENABLED(PROBE_MANUALLY)
#define ABL_VAR static #define ABL_VAR static

12
Marlin/src/gcode/calibrate/G28.cpp

@ -152,6 +152,8 @@
* None Home to all axes with no parameters. * None Home to all axes with no parameters.
* With QUICK_HOME enabled XY will home together, then Z. * 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 * Rn Raise by n mm/inches before homing
* *
* Cartesian/SCARA parameters * Cartesian/SCARA parameters
@ -170,6 +172,16 @@ void GcodeSuite::G28(const bool always_home_all) {
} }
#endif #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! // Wait for planner moves to finish!
planner.synchronize(); planner.synchronize();

Loading…
Cancel
Save