diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 6b0f52b6a9..bb231e23f5 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 */ @@ -5196,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) @@ -5915,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);