Mostly refactoring of the wipe tower improvements

- setting of the wipe tower parameters based od whether SE MM printer is selected is done in the WipeTowerPrusaMM constructor, so it does not distract in Print.cpp
- WipeTowerPrusaMM.cpp conditions checking for SE MM printer are now using a more descriptive const member variable, not the loading/unloading speeds (hopefully the functionality is the same)
This commit is contained in:
Lukas Matena 2019-06-12 10:54:52 +02:00
parent da1aea889f
commit 9df93c0125
3 changed files with 51 additions and 76 deletions

View file

@ -857,7 +857,7 @@ void WipeTowerPrusaMM::toolchange_Unload(
// Retraction:
float old_x = writer.x();
float turning_point = (!m_left_to_right ? xl : xr );
if ((m_cooling_tube_retraction != 0 || m_cooling_tube_length != 0) && m_filpar[m_current_tool].unloading_speed_start != 0 && m_filpar[m_current_tool].unloading_speed != 0) {
if (m_semm && (m_cooling_tube_retraction != 0 || m_cooling_tube_length != 0)) {
float total_retraction_distance = m_cooling_tube_retraction + m_cooling_tube_length/2.f - 15.f; // the 15mm is reserved for the first part after ramming
writer.suppress_preview()
.retract(15.f, m_filpar[m_current_tool].unloading_speed_start * 60.f) // feedrate 5000mm/min = 83mm/s
@ -935,7 +935,7 @@ void WipeTowerPrusaMM::toolchange_Load(
PrusaMultiMaterial::Writer &writer,
const box_coordinates &cleaning_box)
{
if ((m_parking_pos_retraction != 0 || m_extra_loading_move != 0) && m_filpar[m_current_tool].loading_speed_start != 0 && m_filpar[m_current_tool].loading_speed != 0) {
if (m_semm && (m_parking_pos_retraction != 0 || m_extra_loading_move != 0)) {
float xl = cleaning_box.ld.x + m_perimeter_width * 0.75f;
float xr = cleaning_box.rd.x - m_perimeter_width * 0.75f;
float oldx = writer.x(); // the nozzle is in place to do the first wiping moves, we will remember the position

View file

@ -46,26 +46,32 @@ public:
// y -- y coordinates of wipe tower in mm ( left bottom corner )
// width -- width of wipe tower in mm ( default 60 mm - leave as it is )
// wipe_area -- space available for one toolchange in mm
WipeTowerPrusaMM(float x, float y, float width, float rotation_angle, float cooling_tube_retraction,
WipeTowerPrusaMM(bool semm, float x, float y, float width, float rotation_angle, float cooling_tube_retraction,
float cooling_tube_length, float parking_pos_retraction, float extra_loading_move,
float bridging, bool set_extruder_trimpot, GCodeFlavor flavor,
const std::vector<std::vector<float>>& wiping_matrix, unsigned int initial_tool) :
m_semm(semm),
m_wipe_tower_pos(x, y),
m_wipe_tower_width(width),
m_wipe_tower_rotation_angle(rotation_angle),
m_y_shift(0.f),
m_z_pos(0.f),
m_is_first_layer(false),
m_cooling_tube_retraction(cooling_tube_retraction),
m_cooling_tube_length(cooling_tube_length),
m_parking_pos_retraction(parking_pos_retraction),
m_extra_loading_move(extra_loading_move),
m_bridging(bridging),
m_set_extruder_trimpot(set_extruder_trimpot),
m_gcode_flavor(flavor),
m_bridging(bridging),
m_current_tool(initial_tool),
wipe_volumes(wiping_matrix)
{}
{
// If this is a single extruder MM printer, we will use all the SE-specific config values.
// Otherwise, the defaults will be used to turn off the SE stuff.
if (m_semm) {
m_cooling_tube_retraction = cooling_tube_retraction;
m_cooling_tube_length = cooling_tube_length;
m_parking_pos_retraction = parking_pos_retraction;
m_extra_loading_move = extra_loading_move;
m_set_extruder_trimpot = set_extruder_trimpot;
}
}
virtual ~WipeTowerPrusaMM() {}
@ -81,6 +87,10 @@ public:
m_filpar[idx].material = material;
m_filpar[idx].temperature = temp;
m_filpar[idx].first_layer_temperature = first_layer_temp;
// If this is a single extruder MM printer, we will use all the SE-specific config values.
// Otherwise, the defaults will be used to turn off the SE stuff.
if (m_semm) {
m_filpar[idx].loading_speed = loading_speed;
m_filpar[idx].loading_speed_start = loading_speed_start;
m_filpar[idx].unloading_speed = unloading_speed;
@ -89,13 +99,15 @@ public:
m_filpar[idx].cooling_moves = cooling_moves;
m_filpar[idx].cooling_initial_speed = cooling_initial_speed;
m_filpar[idx].cooling_final_speed = cooling_final_speed;
}
if (max_volumetric_speed != 0.f)
m_filpar[idx].max_e_speed = (max_volumetric_speed / Filament_Area);
m_filpar[idx].nozzle_diameter = nozzle_diameter; // to be used in future with (non-single) multiextruder MM
m_perimeter_width = nozzle_diameter * Width_To_Nozzle_Ratio; // all extruders are now assumed to have the same diameter
std::stringstream stream{ramming_parameters};
std::stringstream stream{m_semm ? ramming_parameters : std::string()};
float speed = 0.f;
stream >> m_filpar[idx].ramming_line_width_multiplicator >> m_filpar[idx].ramming_step_multiplicator;
m_filpar[idx].ramming_line_width_multiplicator /= 100;
@ -220,6 +232,7 @@ private:
const float WT_EPSILON = 1e-3f;
bool m_semm = true; // Are we using a single extruder multimaterial printer?
xy m_wipe_tower_pos; // Left front corner of the wipe tower in mm.
float m_wipe_tower_width; // Width of the wipe tower.
float m_wipe_tower_depth = 0.f; // Depth of the wipe tower

View file

@ -1790,77 +1790,39 @@ void Print::_make_wipe_tower()
}
this->throw_if_canceled();
bool semm = m_config.single_extruder_multi_material.value;
float cooling_tube_retraction = 0.0;
float cooling_tube_length = 0.0;
float parking_pos_retraction = 0.0;
bool extra_loading_move = 0.0;
bool high_current_on_filament_swap = false;
if (semm) {
cooling_tube_retraction = float(m_config.cooling_tube_retraction.value);
cooling_tube_length = float(m_config.cooling_tube_length.value);
parking_pos_retraction = float(m_config.parking_pos_retraction.value);
extra_loading_move = float(m_config.extra_loading_move.value);
high_current_on_filament_swap = m_config.high_current_on_filament_swap.value;
}
// Initialize the wipe tower.
WipeTowerPrusaMM wipe_tower(
m_config.single_extruder_multi_material.value,
float(m_config.wipe_tower_x.value), float(m_config.wipe_tower_y.value),
float(m_config.wipe_tower_width.value),
float(m_config.wipe_tower_rotation_angle.value), cooling_tube_retraction,
cooling_tube_length, parking_pos_retraction,
extra_loading_move, float(m_config.wipe_tower_bridging),
high_current_on_filament_swap, m_config.gcode_flavor, wipe_volumes,
float(m_config.wipe_tower_rotation_angle.value), float(m_config.cooling_tube_retraction.value),
float(m_config.cooling_tube_length.value), float(m_config.parking_pos_retraction.value),
float(m_config.extra_loading_move.value), float(m_config.wipe_tower_bridging),
m_config.high_current_on_filament_swap.value, m_config.gcode_flavor, wipe_volumes,
m_wipe_tower_data.tool_ordering.first_extruder());
//wipe_tower.set_retract();
//wipe_tower.set_zhop();
// Set the extruder & material properties at the wipe tower object.
for (size_t i = 0; i < number_of_extruders; ++ i) {
float loading_speed = 0.0;
float loading_speed_start = 0.0;
float unloading_speed = 0.0;
float unloading_speed_start = 0.0;
float toolchange_delay = 0.0;
int cooling_moves = 0;
float cooling_initial_speed = 0.0;
float cooling_final_speed = 0.0;
float max_volumetric_speed = 0.f;
std::string ramming_parameters;
if (semm) {
loading_speed = m_config.filament_loading_speed.get_at(i);
loading_speed_start = m_config.filament_loading_speed_start.get_at(i);
unloading_speed = m_config.filament_unloading_speed.get_at(i);
unloading_speed_start = m_config.filament_unloading_speed_start.get_at(i);
toolchange_delay = m_config.filament_toolchange_delay.get_at(i);
cooling_moves = m_config.filament_cooling_moves.get_at(i);
cooling_initial_speed = m_config.filament_cooling_initial_speed.get_at(i);
cooling_final_speed = m_config.filament_cooling_final_speed.get_at(i);
ramming_parameters = m_config.filament_ramming_parameters.get_at(i);
max_volumetric_speed = m_config.filament_max_volumetric_speed.get_at(i);
}
for (size_t i = 0; i < number_of_extruders; ++ i)
wipe_tower.set_extruder(
i,
WipeTowerPrusaMM::parse_material(m_config.filament_type.get_at(i).c_str()),
m_config.temperature.get_at(i),
m_config.first_layer_temperature.get_at(i),
loading_speed,
loading_speed_start,
unloading_speed,
unloading_speed_start,
toolchange_delay,
cooling_moves,
cooling_initial_speed,
cooling_final_speed,
ramming_parameters,
max_volumetric_speed,
m_config.filament_loading_speed.get_at(i),
m_config.filament_loading_speed_start.get_at(i),
m_config.filament_unloading_speed.get_at(i),
m_config.filament_unloading_speed_start.get_at(i),
m_config.filament_toolchange_delay.get_at(i),
m_config.filament_cooling_moves.get_at(i),
m_config.filament_cooling_initial_speed.get_at(i),
m_config.filament_cooling_final_speed.get_at(i),
m_config.filament_ramming_parameters.get_at(i),
m_config.filament_max_volumetric_speed.get_at(i),
m_config.nozzle_diameter.get_at(i));
}
m_wipe_tower_data.priming = Slic3r::make_unique<WipeTower::ToolChangeResult>(
wipe_tower.prime(this->skirt_first_layer_height(), m_wipe_tower_data.tool_ordering.all_extruders(), false));