Configuration layer changes (cooling_time, bridging, adhesion moved from dedicated dialog to filament/print settings)

This commit is contained in:
Lukas Matena 2018-03-12 15:41:25 +01:00
parent b5fd4ddb8c
commit 27ab8ff4e1
9 changed files with 91 additions and 110 deletions

View file

@ -734,7 +734,7 @@ void WipeTowerPrusaMM::toolchange_Unload(
writer.travel(xl, cleaning_box.ld.y + m_depth_traversed + y_step/2.f ); // move to starting position
// if the ending point of the ram would end up in mid air, align it with the end of the wipe tower:
if (m_layer_info > m_plan.begin() && m_layer_info < m_plan.end() && (m_layer_info-1!=m_plan.begin() || !m_par.adhesion )) {
if (m_layer_info > m_plan.begin() && m_layer_info < m_plan.end() && (m_layer_info-1!=m_plan.begin() || !m_adhesion )) {
// this is y of the center of previous sparse infill border
float sparse_beginning_y = m_wipe_tower_pos.y;
@ -821,8 +821,8 @@ void WipeTowerPrusaMM::toolchange_Unload(
const float start_x = writer.x();
turning_point = ( xr-start_x > start_x-xl ? xr : xl );
const float max_x_dist = 2*std::abs(start_x-turning_point);
const unsigned int N = 4 + std::max(0,(m_par.cooling_time[m_current_tool]-14)/3);
float time = m_par.cooling_time[m_current_tool] / float(N);
const unsigned int N = 4 + std::max(0,(m_filpar[m_current_tool].cooling_time-14)/3);
float time = m_filpar[m_current_tool].cooling_time / float(N);
i = 0;
while (i<N) {
@ -832,7 +832,7 @@ void WipeTowerPrusaMM::toolchange_Unload(
// 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] / float(N);
time = m_filpar[m_current_tool].cooling_time / float(N);
}
else
time -= e_dist / speed; // subtract time this part will really take
@ -1020,7 +1020,7 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::finish_layer()
if (writer.x() > fill_box.ld.x+EPSILON) writer.travel(fill_box.ld.x,writer.y());
if (writer.y() > fill_box.ld.y+EPSILON) writer.travel(writer.x(),fill_box.ld.y);
if (m_is_first_layer && m_par.adhesion) {
if (m_is_first_layer && m_adhesion) {
// Extrude a dense infill at the 1st layer to improve 1st layer adhesion of the wipe tower.
box.expand(-m_perimeter_width/2.f);
unsigned nsteps = int(floor((box.lu.y - box.ld.y) / (2*m_perimeter_width)));
@ -1045,7 +1045,7 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::finish_layer()
writer.travel(fill_box.ld + xy(m_perimeter_width * 2, 0.f))
.extrude(fill_box.lu + xy(m_perimeter_width * 2, 0.f), 2900 * speed_factor);
const int n = 1+(right-left)/(m_par.bridging);
const int n = 1+(right-left)/(m_bridging);
const float dx = (right-left)/n;
for (int i=1;i<=n;++i) {
float x=left+dx*i;

View file

@ -68,13 +68,12 @@ struct WipeTowerParameters {
WipeTowerParameters() { } // create new empty object
WipeTowerParameters(const std::string& init_data) { // create object and initialize from std::string
std::istringstream in(init_data); // validation of input is left to the caller
in >> bridging >> adhesion >> sampling;
in >> sampling;
for (std::vector<float> vect{} ; in >> vect ;) { // until we get to fail state ("**")...
if (vect.size()>=3) {
cooling_time.push_back(vect[0]);
ramming_line_width_multiplicator.push_back(vect[1]);
ramming_step_multiplicator.push_back(vect[2]);
vect.erase(vect.begin(),vect.begin()+3);
if (vect.size()>=2) {
ramming_line_width_multiplicator.push_back(vect[0]);
ramming_step_multiplicator.push_back(vect[1]);
vect.erase(vect.begin(),vect.begin()+2);
}
else vect.clear(); // something's not right, we will restore defaults anyway
ramming_speed.push_back(vect);
@ -102,16 +101,16 @@ 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() {
std::ostringstream out;
out << bridging << " " << int(adhesion) << " " << sampling << "\n";
for (unsigned extruder=0;extruder<cooling_time.size();++extruder) {
out << "\n" << cooling_time[extruder] << " " << ramming_line_width_multiplicator[extruder] << " "
out << sampling << "\n";
for (unsigned extruder=0;extruder<ramming_step_multiplicator.size();++extruder) {
out << "\n" << ramming_line_width_multiplicator[extruder] << " "
<< ramming_step_multiplicator[extruder] << " " << ramming_speed[extruder] << "*"
<< ramming_buttons[extruder] << "*";
}
@ -124,7 +123,7 @@ struct WipeTowerParameters {
}
bool validate() const { // basic check for validity to distinguish most dramatic failures
const unsigned int num = cooling_time.size();
const unsigned int num = ramming_step_multiplicator.size();
if ( num < 1 || ramming_line_width_multiplicator.size()!=num || ramming_step_multiplicator.size()!=num ||
ramming_buttons.size()!=num || wipe_volumes.size()!=num ||
filament_wipe_volumes.size()!=num)
@ -135,10 +134,7 @@ struct WipeTowerParameters {
return true;
}
void set_defaults() {
bridging = 10;
adhesion = true;
sampling = 0.25f;
cooling_time = {15,15,15,15};
ramming_line_width_multiplicator = {1.5f, 1.5f, 1.5f, 1.5f};
ramming_step_multiplicator = {1.1f, 1.1f, 1.1f, 1.1f};
ramming_speed.clear();
@ -153,11 +149,8 @@ struct WipeTowerParameters {
{ 60.f, 60.f, 60.f, 0.f}};
filament_wipe_volumes = {{30.f,30.f},{30.f,30.f},{30.f,30.f},{30.f,30.f}};
}
int bridging = 0.f;
bool adhesion = false;
float sampling = 0.25f; // this does not quite work yet, keep it fixed to 0.25f
std::vector<int> cooling_time;
std::vector<float> ramming_line_width_multiplicator;
std::vector<float> ramming_step_multiplicator;
std::vector<std::vector<float>> ramming_speed;
@ -192,7 +185,7 @@ public:
// 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 wipe_area, float rotation_angle, float cooling_tube_retraction,
float cooling_tube_length, float parking_pos_retraction, std::string& parameters,
float cooling_tube_length, float parking_pos_retraction, float bridging, bool adhesion, std::string& parameters,
unsigned int initial_tool) :
m_wipe_tower_pos(x, y),
m_wipe_tower_width(width),
@ -205,8 +198,11 @@ public:
m_cooling_tube_length(cooling_tube_length),
m_parking_pos_retraction(parking_pos_retraction),
m_current_tool(initial_tool),
m_par(parameters)
m_par(parameters)
{
m_bridging = bridging;
m_adhesion = adhesion;
for (size_t i = 0; i < 4; ++ i) {
// Extruder specific parameters.
m_filpar[i].material = PLA;
@ -226,7 +222,7 @@ public:
// Set the extruder properties.
void set_extruder(size_t idx, material_type material, int temp, int first_layer_temp, float loading_speed,
float unloading_speed, float delay)
float unloading_speed, float delay, int cooling_time)
{
m_filpar[idx].material = material;
m_filpar[idx].temperature = temp;
@ -234,6 +230,7 @@ public:
m_filpar[idx].loading_speed = loading_speed;
m_filpar[idx].unloading_speed = unloading_speed;
m_filpar[idx].delay = delay;
m_filpar[idx].cooling_time = cooling_time;
}
@ -340,6 +337,8 @@ private:
float m_cooling_tube_retraction = 0.f;
float m_cooling_tube_length = 0.f;
float m_parking_pos_retraction = 0.f;
float m_bridging = 0.f;
bool m_adhesion = true;
float m_line_width = Nozzle_Diameter * Width_To_Nozzle_Ratio; // Width of an extrusion line, also a perimeter spacing for 100% infill.
float m_extrusion_flow = 0.038; //0.029f;// Extrusion flow is derived from m_perimeter_width, layer height and filament diameter.
@ -352,6 +351,7 @@ private:
float loading_speed;
float unloading_speed;
float delay;
int cooling_time;
};
// Extruder specific parameters.

View file

@ -188,6 +188,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
|| opt_key == "filament_loading_speed"
|| opt_key == "filament_unloading_speed"
|| opt_key == "filament_toolchange_delay"
|| opt_key == "filament_cooling_time"
|| opt_key == "gcode_flavor"
|| opt_key == "single_extruder_multi_material"
|| opt_key == "spiral_vase"
@ -199,6 +200,8 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
|| opt_key == "wipe_tower_width"
|| opt_key == "wipe_tower_per_color_wipe"
|| opt_key == "wipe_tower_rotation_angle"
|| opt_key == "wipe_tower_bridging"
|| opt_key == "wipe_tower_adhesion"
|| opt_key == "z_offset") {
steps.emplace_back(psWipeTower);
} else if (
@ -1030,6 +1033,7 @@ void Print::_make_wipe_tower()
float(this->config.wipe_tower_width.value), float(this->config.wipe_tower_per_color_wipe.value),
float(this->config.wipe_tower_rotation_angle.value), float(this->config.cooling_tube_retraction.value),
float(this->config.cooling_tube_length.value), float(this->config.parking_pos_retraction.value),
float(this->config.wipe_tower_bridging), bool(this->config.wipe_tower_adhesion),
this->config.wipe_tower_advanced.value,m_tool_ordering.first_extruder());
//wipe_tower.set_retract();
@ -1044,6 +1048,7 @@ void Print::_make_wipe_tower()
this->config.first_layer_temperature.get_at(i),
this->config.filament_loading_speed.get_at(i),
this->config.filament_unloading_speed.get_at(i),
this->config.filament_toolchange_delay.get_at(i),
this->config.filament_toolchange_delay.get_at(i));
// When printing the first layer's wipe tower, the first extruder is expected to be active and primed.

View file

@ -469,6 +469,15 @@ PrintConfigDef::PrintConfigDef()
def->cli = "filament-toolchange-delay=f@";
def->min = 0;
def->default_value = new ConfigOptionFloats { 0. };
def = this->add("filament_cooling_time", coInts);
def->label = L("Cooling time");
def->tooltip = L("The filament is slowly moved back and forth after retraction into the cooling tube "
"for this amount of time.");
def->cli = "filament_cooling_time=i@";
def->sidetext = L("s");
def->min = 0;
def->default_value = new ConfigOptionInts { 14 };
def = this->add("filament_diameter", coFloats);
def->label = L("Diameter");
@ -1800,6 +1809,20 @@ PrintConfigDef::PrintConfigDef()
def->sidetext = L("degrees");
def->cli = "wipe-tower-rotation-angle=f";
def->default_value = new ConfigOptionFloat(0.);
def = this->add("wipe_tower_bridging", coFloat);
def->label = L("Maximal bridging distance");
def->tooltip = L("Maximal distance between supports on sparse infill sections. ");
def->sidetext = L("mm");
def->cli = "wipe-tower-bridging=f";
def->default_value = new ConfigOptionFloat(10.);
def = this->add("wipe_tower_adhesion", coBool);
def->label = L("Increase first layer adhesion");
def->tooltip = L("This prevents using sparse infill on the first layer, if it would be "
"normally applied. Dense infill is used instead. ");
def->cli = "wipe-tower_adhesion!";
def->default_value = new ConfigOptionBool(true);
def = this->add("xy_size_compensation", coFloat);
def->label = L("XY Size Compensation");

View file

@ -470,6 +470,7 @@ public:
ConfigOptionFloats filament_loading_speed;
ConfigOptionFloats filament_unloading_speed;
ConfigOptionFloats filament_toolchange_delay;
ConfigOptionInts filament_cooling_time;
ConfigOptionBool gcode_comments;
ConfigOptionEnum<GCodeFlavor> gcode_flavor;
ConfigOptionString layer_gcode;
@ -525,6 +526,7 @@ protected:
OPT_PTR(filament_loading_speed);
OPT_PTR(filament_unloading_speed);
OPT_PTR(filament_toolchange_delay);
OPT_PTR(filament_cooling_time);
OPT_PTR(gcode_comments);
OPT_PTR(gcode_flavor);
OPT_PTR(layer_gcode);
@ -624,6 +626,8 @@ public:
ConfigOptionFloat wipe_tower_width;
ConfigOptionFloat wipe_tower_per_color_wipe;
ConfigOptionFloat wipe_tower_rotation_angle;
ConfigOptionFloat wipe_tower_bridging;
ConfigOptionBool wipe_tower_adhesion;
ConfigOptionFloat z_offset;
protected:
@ -690,6 +694,8 @@ protected:
OPT_PTR(wipe_tower_width);
OPT_PTR(wipe_tower_per_color_wipe);
OPT_PTR(wipe_tower_rotation_angle);
OPT_PTR(wipe_tower_bridging);
OPT_PTR(wipe_tower_adhesion);
OPT_PTR(z_offset);
}
};