From dcb4cdaa9e974b19b377e00a640017467a6d4b54 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 25 Apr 2016 18:23:09 -0700 Subject: [PATCH 1/2] Call report_current_position instead of gcode_M114 directly --- Marlin/Marlin_main.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 6b0f52b6a..287b86896 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -504,7 +504,7 @@ void serial_echopair_P(const char* s_P, float v) { serialprintPGM(s_P); void serial_echopair_P(const char* s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } -void gcode_M114(); +static void report_current_position(); #if ENABLED(DEBUG_LEVELING_FEATURE) void print_xyz(const char* prefix, const float x, const float y, const float z) { @@ -2886,8 +2886,7 @@ inline void gcode_G28() { } #endif - gcode_M114(); // Send end position to RepetierHost - + report_current_position(); } #if ENABLED(MESH_BED_LEVELING) @@ -3595,8 +3594,7 @@ inline void gcode_G28() { } #endif - gcode_M114(); // Send end position to RepetierHost - + report_current_position(); } #if DISABLED(Z_PROBE_SLED) // could be avoided @@ -3632,7 +3630,7 @@ inline void gcode_G28() { #endif stow_z_probe(false); // Retract Z Servo endstop if available. Z_PROBE_SLED is missed here. - gcode_M114(); // Send end position to RepetierHost + report_current_position(); } #endif //!Z_PROBE_SLED @@ -4229,7 +4227,7 @@ inline void gcode_M42() { clean_up_after_endstop_move(); - gcode_M114(); // Send end position to RepetierHost + report_current_position(); } #endif // AUTO_BED_LEVELING_FEATURE && Z_MIN_PROBE_REPEATABILITY_TEST @@ -4878,9 +4876,9 @@ inline void gcode_M92() { } /** - * M114: Output current position to serial port + * Output the current position to serial */ -inline void gcode_M114() { +static void report_current_position() { SERIAL_PROTOCOLPGM("X:"); SERIAL_PROTOCOL(current_position[X_AXIS]); SERIAL_PROTOCOLPGM(" Y:"); @@ -4941,6 +4939,11 @@ inline void gcode_M114() { #endif } +/** + * M114: Output current position to serial port + */ +inline void gcode_M114() { report_current_position(); } + /** * M115: Capabilities string */ From 68d0347e677e4b2b3788d35617a5d3ebfac7e11e Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 25 Apr 2016 18:24:12 -0700 Subject: [PATCH 2/2] Call report_current_position after M206 / M428 --- Marlin/Marlin_main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 287b86896..bb231e23f 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5199,7 +5199,9 @@ inline void gcode_M206() { if (code_seen('T')) set_home_offset(X_AXIS, code_value()); // Theta if (code_seen('P')) set_home_offset(Y_AXIS, code_value()); // Psi #endif + sync_plan_position(); + report_current_position(); } #if ENABLED(DELTA) @@ -5918,6 +5920,7 @@ inline void gcode_M428() { if (!err) { sync_plan_position(); + report_current_position(); LCD_MESSAGEPGM(MSG_HOME_OFFSETS_APPLIED); #if HAS_BUZZER buzz(200, 659);