From 9b519864bfeb043bad7d07f4bf10fe249ab8e27a Mon Sep 17 00:00:00 2001 From: GMagician <3684609+GMagician@users.noreply.github.com> Date: Sat, 20 Jan 2018 22:22:03 +0100 Subject: [PATCH] [2.0.x] Relative movements fix (#9259) --- Marlin/src/gcode/gcode.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 3187186662..421d0b1f62 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -94,8 +94,10 @@ bool GcodeSuite::get_target_extruder_from_command() { void GcodeSuite::get_destination_from_command() { LOOP_XYZE(i) { if (parser.seen(axis_codes[i])) { - const float v = parser.value_axis_units((AxisEnum)i) + (axis_relative_modes[i] || relative_mode ? current_position[i] : 0); - destination[i] = i == E_AXIS ? v : LOGICAL_TO_NATIVE(v, i); + const float v = parser.value_axis_units((AxisEnum)i); + destination[i] = (axis_relative_modes[i] || relative_mode) + ? current_position[i] + v + : (i == E_AXIS) ? v : LOGICAL_TO_NATIVE(v, i); } else destination[i] = current_position[i];