[2.0.x] Relative movements fix (#9259)

This commit is contained in:
GMagician 2018-01-20 22:22:03 +01:00 committed by Scott Lahteine
parent 887664aa61
commit 9b519864bf

View file

@ -94,8 +94,10 @@ bool GcodeSuite::get_target_extruder_from_command() {
void GcodeSuite::get_destination_from_command() { void GcodeSuite::get_destination_from_command() {
LOOP_XYZE(i) { LOOP_XYZE(i) {
if (parser.seen(axis_codes[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); const float v = parser.value_axis_units((AxisEnum)i);
destination[i] = i == E_AXIS ? v : LOGICAL_TO_NATIVE(v, i); destination[i] = (axis_relative_modes[i] || relative_mode)
? current_position[i] + v
: (i == E_AXIS) ? v : LOGICAL_TO_NATIVE(v, i);
} }
else else
destination[i] = current_position[i]; destination[i] = current_position[i];