From 3d0a060a7a998b91d815a822bdf7774e3a8b9f6a Mon Sep 17 00:00:00 2001 From: Edward Patel Date: Sat, 21 Mar 2015 14:50:47 +0100 Subject: [PATCH] Added G29 command --- Marlin/Marlin_main.cpp | 89 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 87eb77a141..41955d86a6 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1983,6 +1983,89 @@ inline void gcode_G28() { endstops_hit_on_purpose(); } +#if defined(MESH_BED_LEVELING) + + inline void gcode_G29() { + static int probe_point = -1; + int state = 0; + if (code_seen('S') || code_seen('s')) { + state = code_value_long(); + if (state < 0 || state > 2) { + SERIAL_PROTOCOLPGM("S out of range (0-2).\n"); + return; + } + } + + if (state == 0) { // Dump mesh_bed_leveling + if (mbl.active) { + SERIAL_PROTOCOLPGM("Num X,Y: "); + SERIAL_PROTOCOL(MESH_NUM_X_POINTS); + SERIAL_PROTOCOLPGM(","); + SERIAL_PROTOCOL(MESH_NUM_Y_POINTS); + SERIAL_PROTOCOLPGM("\nZ search height: "); + SERIAL_PROTOCOL(MESH_HOME_SEARCH_Z); + SERIAL_PROTOCOLPGM("\nMeasured points:\n"); + for (int y=0; y