From 81ffd98dd9fda7cef2e9c75c7d4ffcb4ef9b78ed Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Sat, 25 Feb 2017 20:10:57 -0600
Subject: [PATCH] Allow faux leveling
---
Marlin/Marlin_main.cpp | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index 2ca660c991..b6d81f4ef8 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -4035,6 +4035,11 @@ inline void gcode_G28() {
* L Set the Left limit of the probing grid
* R Set the Right limit of the probing grid
*
+ * Parameters with DEBUG_LEVELING_FEATURE only:
+ *
+ * C Make a totally fake grid with no actual probing.
+ * For use in testing when no probing is possible.
+ *
* Parameters with BILINEAR leveling only:
*
* Z Supply an additional Z probe offset
@@ -4077,6 +4082,12 @@ inline void gcode_G28() {
#endif
#endif
+ #if ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(PROBE_MANUALLY)
+ const bool faux = code_seen('C') && code_value_bool();
+ #else
+ bool constexpr faux = false;
+ #endif
+
// Don't allow auto-leveling without homing first
if (axis_unhomed_error(true, true, true)) return;
@@ -4292,7 +4303,7 @@ inline void gcode_G28() {
SYNC_PLAN_POSITION_KINEMATIC();
}
- setup_for_endstop_or_probe_move();
+ if (!faux) setup_for_endstop_or_probe_move();
//xProbe = yProbe = measured_z = 0;
@@ -4550,7 +4561,7 @@ inline void gcode_G28() {
if (!position_is_reachable(pos, true)) continue;
#endif
- measured_z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
+ measured_z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
if (isnan(measured_z)) {
planner.abl_enabled = abl_should_enable;
@@ -4585,7 +4596,7 @@ inline void gcode_G28() {
// Retain the last probe position
xProbe = LOGICAL_X_POSITION(points[i].x);
yProbe = LOGICAL_Y_POSITION(points[i].y);
- measured_z = points[i].z = probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
+ measured_z = points[i].z = faux ? 0.001 * random(-100, 101) : probe_pt(xProbe, yProbe, stow_probe_after_each, verbose_level);
}
if (isnan(measured_z)) {
@@ -4624,7 +4635,7 @@ inline void gcode_G28() {
//
// Restore state after probing
- clean_up_after_endstop_or_probe_move();
+ if (!faux) clean_up_after_endstop_or_probe_move();
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
--
GitLab