From 5b45aab262445fc7e1fdf96ed5887ef55c98c0d8 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 12 Mar 2018 08:14:25 -0500 Subject: [PATCH] M218: report with no parameters --- Marlin/src/gcode/config/M218.cpp | 40 +++++++++++++++++++++----------- Marlin/src/gcode/gcode.h | 2 +- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Marlin/src/gcode/config/M218.cpp b/Marlin/src/gcode/config/M218.cpp index 8d12ef5957..144abb2899 100644 --- a/Marlin/src/gcode/config/M218.cpp +++ b/Marlin/src/gcode/config/M218.cpp @@ -38,26 +38,38 @@ void GcodeSuite::M218() { if (get_target_extruder_from_command() || target_extruder == 0) return; - if (parser.seenval('X')) hotend_offset[X_AXIS][target_extruder] = parser.value_linear_units(); - if (parser.seenval('Y')) hotend_offset[Y_AXIS][target_extruder] = parser.value_linear_units(); + bool report = true; + if (parser.seenval('X')) { + hotend_offset[X_AXIS][target_extruder] = parser.value_linear_units(); + report = false; + } + if (parser.seenval('Y')) { + hotend_offset[Y_AXIS][target_extruder] = parser.value_linear_units(); + report = false; + } #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER) - if (parser.seenval('Z')) hotend_offset[Z_AXIS][target_extruder] = parser.value_linear_units(); + if (parser.seenval('Z')) { + hotend_offset[Z_AXIS][target_extruder] = parser.value_linear_units(); + report = false; + } #endif - SERIAL_ECHO_START(); - SERIAL_ECHOPGM(MSG_HOTEND_OFFSET); - HOTEND_LOOP() { - SERIAL_CHAR(' '); - SERIAL_ECHO(hotend_offset[X_AXIS][e]); - SERIAL_CHAR(','); - SERIAL_ECHO(hotend_offset[Y_AXIS][e]); - #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER) + if (report) { + SERIAL_ECHO_START(); + SERIAL_ECHOPGM(MSG_HOTEND_OFFSET); + HOTEND_LOOP() { + SERIAL_CHAR(' '); + SERIAL_ECHO(hotend_offset[X_AXIS][e]); SERIAL_CHAR(','); - SERIAL_ECHO(hotend_offset[Z_AXIS][e]); - #endif + SERIAL_ECHO(hotend_offset[Y_AXIS][e]); + #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER) + SERIAL_CHAR(','); + SERIAL_ECHO(hotend_offset[Z_AXIS][e]); + #endif + } + SERIAL_EOL(); } - SERIAL_EOL(); } #endif // HOTENDS > 1 diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index e618dcf05a..548987c96f 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -161,7 +161,7 @@ * M209 - Turn Automatic Retract Detection on/off: S<0|1> (For slicers that don't support G10/11). (Requires FWRETRACT) Every normal extrude-only move will be classified as retract depending on the direction. * M211 - Enable, Disable, and/or Report software endstops: S<0|1> (Requires MIN_SOFTWARE_ENDSTOPS or MAX_SOFTWARE_ENDSTOPS) - * M218 - Set a tool offset: "M218 T X Y". (Requires 2 or more extruders) + * M218 - Set/get a tool offset: "M218 T X Y". (Requires 2 or more extruders) * M220 - Set Feedrate Percentage: "M220 S" (i.e., "FR" on the LCD) * M221 - Set Flow Percentage: "M221 S" * M226 - Wait until a pin is in a given state: "M226 P S"