From 4e3ea41ba4b4704e7d14756233dbd2cb0c43f532 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Tue, 20 Feb 2018 15:30:18 +0100 Subject: [PATCH] Fix of a loss in precission when the extruder multiplier is set with M221. For 50um layers, the precision loss leads to holes in the print. --- Firmware/Marlin_main.cpp | 6 +++++- Firmware/planner.cpp | 6 +----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 7d3b0d5a..a96abe2e 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -6527,7 +6527,11 @@ void get_coordinates() for(int8_t i=0; i < NUM_AXIS; i++) { if(code_seen(axis_codes[i])) { - destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i]; + destination[i] = (float)code_value(); + if (i == E_AXIS && extrudemultiply != 100) + destination[i] *= (extrudemultiply * 0.01f); + if (axis_relative_modes[i] || relative_mode) + destination[i] += current_position[i]; seen[i]=true; } else destination[i] = current_position[i]; //Are these else lines really needed? diff --git a/Firmware/planner.cpp b/Firmware/planner.cpp index d7f30d23..2f5f358e 100644 --- a/Firmware/planner.cpp +++ b/Firmware/planner.cpp @@ -784,10 +784,6 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi block->steps_e = labs(target[E_AXIS]-position[E_AXIS]); if (volumetric_multiplier[active_extruder] != 1.f) block->steps_e *= volumetric_multiplier[active_extruder]; - if (extrudemultiply != 100) { - block->steps_e *= extrudemultiply; - block->steps_e /= 100; - } block->step_event_count = max(block->steps_x, max(block->steps_y, max(block->steps_z, block->steps_e))); // Bail if this is a zero-length block @@ -919,7 +915,7 @@ Having the real displacement of the head, we can calculate the total movement le delta_mm[Y_AXIS] = ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]))/axis_steps_per_unit[Y_AXIS]; #endif delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS]; - delta_mm[E_AXIS] = ((target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS])*volumetric_multiplier[active_extruder]*extrudemultiply/100.0; + delta_mm[E_AXIS] = ((target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS])*volumetric_multiplier[active_extruder]; if ( block->steps_x <=dropsegments && block->steps_y <=dropsegments && block->steps_z <=dropsegments ) { block->millimeters = fabs(delta_mm[E_AXIS]);