Integrating cooling tube parameters into wipe tower generator

This commit is contained in:
Lukas Matena 2018-03-02 13:26:16 +01:00
parent d2006c8d8e
commit e1421da5e8
3 changed files with 25 additions and 13 deletions

View file

@ -841,14 +841,17 @@ void WipeTowerPrusaMM::toolchange_Unload(
.ram(xl + m_perimeter_width * 2, xr - m_perimeter_width * 2, y_step * 1.2f, e0, 1.74f * e, 5200);
}*/
}
// Pull the filament end into a cooling tube.
writer.retract(15, 5000).retract(50, 5400).retract(15, 3000).retract(12, 2000);
// Pull the filament end into a cooling tube (Alex)
//writer.retract(15, 5000).retract(50, 5400).retract(15, 3000).retract(12, 2000);
// Pull the filament end to the BEGINNING of the cooling tube
writer.retract(15, 5000).retract(m_cooling_tube_retraction+m_cooling_tube_length/2.f-42, 5400).retract(15, 3000).retract(12, 2000);
if (new_temperature != 0) // Set the extruder temperature, but don't wait.
writer.set_extruder_temp(new_temperature, false);
// cooling:
writer.retract(2, 2000);
writer.suppress_preview();
writer.travel(writer.x(), writer.y() + y_step);
const float start_x = writer.x();
@ -860,9 +863,10 @@ void WipeTowerPrusaMM::toolchange_Unload(
i = 0;
while (i<N) {
const float speed = std::min(3.4,2.2 + i*0.3 + (i==0 ? 0 : 0.3)); // mm per second: 2.2, 2.8, 3.1, 3.4, 3.4, 3.4, ...
const float e_dist = std::min(speed * time,10.f); // distance to travel
const float e_dist = std::min(speed * time,2*m_cooling_tube_length); // distance to travel
if (speed * time < 10.f) { // this move is the last one at this speed
// this move is the last one at this speed or someone set tube_length to zero
if (speed * time < 2*m_cooling_tube_length || m_cooling_tube_length<WT_EPSILON) {
++i;
time = m_par.cooling_time[m_current_tool] / N;
}
@ -874,7 +878,9 @@ void WipeTowerPrusaMM::toolchange_Unload(
const float feedrate = std::hypot(e_dist, x_dist) / ((e_dist / speed) / 60.f);
writer.cool(start_x+x_dist/2.f,start_x,e_dist/2.f,-e_dist/2.f, feedrate);
}
writer.retract(-2, 2000);
// we should be at the beginning of the cooling tube again - let's move to parking position:
writer.retract(-m_cooling_tube_length/2.f+m_parking_pos_retraction-m_cooling_tube_retraction, 2000);
writer.travel(writer.x(), writer.y() - y_step,2400);
// Alex's old cooling:
@ -944,8 +950,8 @@ void WipeTowerPrusaMM::toolchange_Load(
{
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
float oldy=writer.y();
float oldx = writer.x(); // the nozzle is in place to do the first wiping moves, we will remember the position
float oldy = writer.y();
writer.append("; CP TOOLCHANGE LOAD\n")
// Load the filament while moving left / right,
@ -954,7 +960,8 @@ void WipeTowerPrusaMM::toolchange_Load(
// Accelerate the filament loading
.load_move_x(xr, 20, 1400)
// Fast loading phase
.load_move_x(xl, 40, 3000)
//.load_move_x(xl, 40, 3000) - Alex
.load_move_x(xl,m_parking_pos_retraction-50-2,3000) // loading is 2mm shorter that previous retraction
// Slowing down
.load_move_x(xr, 20, 1600)
.load_move_x(xl, 10, 1000)

View file

@ -102,6 +102,9 @@ struct WipeTowerParameters {
for (unsigned int i=0;i<vect.size();++i)
if (i%2==1)
filament_wipe_volumes.push_back(std::make_pair(vect[i-1],vect[i]));
if (!validate()) // in case we did not parse the input right
set_defaults();
}
std::string to_string() {
@ -198,10 +201,12 @@ public:
m_z_pos(0.f),
m_is_first_layer(false),
m_is_last_layer(false),
m_cooling_tube_retraction(cooling_tube_retraction),
m_cooling_tube_length(cooling_tube_length),
m_parking_pos_retraction(parking_pos_retraction),
m_current_tool(initial_tool),
m_par(parameters)
{
printf("Jsem konstruktor WT a vidim cisla %f,%f,%f\n",cooling_tube_retraction,cooling_tube_length,parking_pos_retraction);
for (size_t i = 0; i < 4; ++ i) {
// Extruder specific parameters.
m_material[i] = PLA;

View file

@ -177,7 +177,7 @@ PrintConfigDef::PrintConfigDef()
def->sidetext = _L("mm");
def->cli = "cooling_tube_retraction=f";
def->min = 0;
def->default_value = new ConfigOptionFloat(0);
def->default_value = new ConfigOptionFloat(91.5f);
def = this->add("cooling_tube_length", coFloat);
def->label = _L("Cooling tube length");
@ -185,7 +185,7 @@ PrintConfigDef::PrintConfigDef()
def->sidetext = _L("mm");
def->cli = "cooling_tube_length=f";
def->min = 0;
def->default_value = new ConfigOptionFloat(0);
def->default_value = new ConfigOptionFloat(5.f);
def = this->add("default_acceleration", coFloat);
def->label = _L("Default");
@ -970,7 +970,7 @@ PrintConfigDef::PrintConfigDef()
def->sidetext = _L("mm");
def->cli = "parking_pos_retraction=f";
def->min = 0;
def->default_value = new ConfigOptionFloat(0);
def->default_value = new ConfigOptionFloat(92.f);
def = this->add("perimeter_acceleration", coFloat);
def->label = _L("Perimeters");