Further commits

This commit is contained in:
igiannakas
2023-09-17 19:06:17 +03:00
parent 1133c71190
commit 8ec8e999ec
2 changed files with 21 additions and 7 deletions

View File

@@ -2606,8 +2606,7 @@ void GCode::process_layers(
// Pressure equalizer need insert empty input. Because it returns one layer back.
// Insert NOP (no operation) layer;
++layer_to_print_idx;
return {}; // IG TO CHANGE
// return LayerResult::make_nop_layer_result();
return LayerResult::make_nop_layer_result();
}
//fc.stop();
//return {};
@@ -2626,6 +2625,9 @@ void GCode::process_layers(
const auto spiral_mode = tbb::make_filter<LayerResult, LayerResult>(slic3r_tbb_filtermode::serial_in_order,
[&spiral_mode = *this->m_spiral_vase.get()](LayerResult in) -> LayerResult {
if (in.nop_layer_result)
return in;
spiral_mode.enable(in.spiral_vase_enable);
return { spiral_mode.process_layer(std::move(in.gcode)), in.layer_id, in.spiral_vase_enable, in.cooling_buffer_flush };
});
@@ -2635,6 +2637,8 @@ void GCode::process_layers(
});
const auto cooling = tbb::make_filter<LayerResult, std::string>(slic3r_tbb_filtermode::serial_in_order,
[&cooling_buffer = *this->m_cooling_buffer.get()](LayerResult in) -> std::string {
if (in.nop_layer_result)
return in.gcode;
return cooling_buffer.process_layer(std::move(in.gcode), in.layer_id, in.cooling_buffer_flush);
});
const auto output = tbb::make_filter<std::string, void>(slic3r_tbb_filtermode::serial_in_order,
@@ -2643,6 +2647,7 @@ void GCode::process_layers(
const auto fan_mover = tbb::make_filter<std::string, std::string>(slic3r_tbb_filtermode::serial_in_order,
[&fan_mover = this->m_fan_mover, &config = this->config(), &writer = this->m_writer](std::string in)->std::string {
CNumericLocalesSetter locales_setter;
if (config.fan_speedup_time.value != 0 || config.fan_kickstart.value > 0) {
@@ -2662,9 +2667,9 @@ void GCode::process_layers(
// The pipeline elements are joined using const references, thus no copying is performed.
if (m_spiral_vase)
tbb::parallel_pipeline(12, generator & spiral_mode & cooling & fan_mover & output);
tbb::parallel_pipeline(12, generator & spiral_mode & pressure_equalizer & cooling & fan_mover & output);
else
tbb::parallel_pipeline(12, generator & cooling & fan_mover & output);
tbb::parallel_pipeline(12, generator & pressure_equalizer & cooling & fan_mover & output);
}
// Process all layers of a single object instance (sequential mode) with a parallel pipeline:

View File

@@ -25,13 +25,19 @@ static const std::string EXTERNAL_PERIMETER_TAG = ";_EXTERNAL_PERIMETER";
// Maximum segment length to split a long segment if the initial and the final flow rate differ.
// Smaller value means a smoother transition between two different flow rates.
static constexpr float max_segment_length = 5.f;
static constexpr float max_segment_length = 1.f;
// For how many GCode lines back will adjust a flow rate from the latest line.
// Bigger values affect the GCode export speed a lot, and smaller values could
// affect how distant will be propagated a flow rate adjustment.
static constexpr int max_look_back_limit = 128;
// Max non-extruding XY distance (travel move) in mm between two continous extrusions where we pretend
// its all one continous extruded line. Above this distance we assume extruder pressure hits 0
// This exists because often there's tiny travel moves between stuff like infill
// lines where some extruder pressure will remain (so we should equalize between these small travels)
static constexpr long max_ignored_gap_between_extruding_segments = 3;
PressureEqualizer::PressureEqualizer(const Slic3r::GCodeConfig &config) : m_use_relative_e_distances(config.use_relative_e_distances.value)
{
// Preallocate some data, so that output_buffer.data() will return an empty string.
@@ -58,8 +64,11 @@ PressureEqualizer::PressureEqualizer(const Slic3r::GCodeConfig &config) : m_use_
// Slope of the volumetric rate, changing from 20mm/s to 60mm/s over 2 seconds: (5.4-1.8)*60*60/2=60*60*1.8 = 6480 mm^3/min^2 = 1.8 mm^3/s^2
//---IG
m_max_volumetric_extrusion_rate_slope_positive = 0.1;//float(config.max_volumetric_extrusion_rate_slope_positive.value) * 60.f * 60.f;
m_max_volumetric_extrusion_rate_slope_negative = 0.1;//float(config.max_volumetric_extrusion_rate_slope_negative.value) * 60.f * 60.f;
//m_max_volumetric_extrusion_rate_slope_positive = float(config.max_volumetric_extrusion_rate_slope_positive.value) * 60.f * 60.f;
//m_max_volumetric_extrusion_rate_slope_negative = float(config.max_volumetric_extrusion_rate_slope_negative.value) * 60.f * 60.f;
m_max_volumetric_extrusion_rate_slope_positive = float(10) * 60.f * 60.f;
m_max_volumetric_extrusion_rate_slope_negative = float(10) * 60.f * 60.f;
for (ExtrusionRateSlope &extrusion_rate_slope : m_max_volumetric_extrusion_rate_slopes) {
extrusion_rate_slope.negative = m_max_volumetric_extrusion_rate_slope_negative;