First complete working version

This commit is contained in:
igiannakas 2023-09-18 01:16:09 +03:00
parent 5aba047275
commit d663947a0c
6 changed files with 42 additions and 63 deletions

View file

@ -1873,15 +1873,14 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
if (print.config().spiral_mode.value) if (print.config().spiral_mode.value)
m_spiral_vase = make_unique<SpiralVase>(print.config()); m_spiral_vase = make_unique<SpiralVase>(print.config());
//#ifdef HAS_PRESSURE_EQUALIZER
//if (print.config().max_volumetric_extrusion_rate_slope_positive.value > 0 || if (print.config().max_volumetric_extrusion_rate_slope_positive.value > 0 ||
// print.config().max_volumetric_extrusion_rate_slope_negative.value > 0) print.config().max_volumetric_extrusion_rate_slope_negative.value > 0){
const GCodeConfig& tmp_config = print.config(); m_pressure_equalizer = make_unique<PressureEqualizer>(print.config());
m_pressure_equalizer = make_unique<PressureEqualizer>(print.config()); m_enable_extrusion_role_markers = (bool)m_pressure_equalizer;
m_enable_extrusion_role_markers = (bool)m_pressure_equalizer; } else
//#else /* HAS_PRESSURE_EQUALIZER */ m_enable_extrusion_role_markers = false;
// m_enable_extrusion_role_markers = false;
//#endif /* HAS_PRESSURE_EQUALIZER */
file.write_format("; HEADER_BLOCK_START\n"); file.write_format("; HEADER_BLOCK_START\n");
// Write information on the generator. // Write information on the generator.
@ -2389,10 +2388,6 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
file.write("M1003 S0\n"); file.write("M1003 S0\n");
} }
} }
#ifdef HAS_PRESSURE_EQUALIZER
if (m_pressure_equalizer)
file.write(m_pressure_equalizer->process("", true));
#endif /* HAS_PRESSURE_EQUALIZER */
++ finished_objects; ++ finished_objects;
// Flag indicating whether the nozzle temperature changes from 1st to 2nd layer were performed. // Flag indicating whether the nozzle temperature changes from 1st to 2nd layer were performed.
// Reset it when starting another object from 1st layer. // Reset it when starting another object from 1st layer.
@ -2460,10 +2455,6 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
file.write("M1003 S0\n"); file.write("M1003 S0\n");
} }
} }
#ifdef HAS_PRESSURE_EQUALIZER
if (m_pressure_equalizer)
file.write(m_pressure_equalizer->process("", true));
#endif /* HAS_PRESSURE_EQUALIZER */
if (m_wipe_tower) if (m_wipe_tower)
// Purge the extruder, pull out the active filament. // Purge the extruder, pull out the active filament.
file.write(m_wipe_tower->finalize(*this)); file.write(m_wipe_tower->finalize(*this));
@ -2666,10 +2657,14 @@ void GCode::process_layers(
}); });
// The pipeline elements are joined using const references, thus no copying is performed. // The pipeline elements are joined using const references, thus no copying is performed.
if (m_spiral_vase) if (m_spiral_vase && m_pressure_equalizer)
tbb::parallel_pipeline(12, generator & spiral_mode & pressure_equalizer & cooling & fan_mover & output); tbb::parallel_pipeline(12, generator & spiral_mode & pressure_equalizer & cooling & fan_mover & output);
else else if (m_spiral_vase)
tbb::parallel_pipeline(12, generator & spiral_mode & cooling & fan_mover & output);
else if (m_pressure_equalizer)
tbb::parallel_pipeline(12, generator & pressure_equalizer & cooling & fan_mover & output); tbb::parallel_pipeline(12, generator & pressure_equalizer & cooling & fan_mover & output);
else
tbb::parallel_pipeline(12, generator & cooling & fan_mover & output);
} }
// Process all layers of a single object instance (sequential mode) with a parallel pipeline: // Process all layers of a single object instance (sequential mode) with a parallel pipeline:
@ -3899,14 +3894,6 @@ LayerResult GCode::process_layer(
// Flush the cooling buffer at each object layer or possibly at the last layer, even if it contains just supports (This should not happen). // Flush the cooling buffer at each object layer or possibly at the last layer, even if it contains just supports (This should not happen).
object_layer || last_layer); object_layer || last_layer);
#ifdef HAS_PRESSURE_EQUALIZER
// Apply pressure equalization if enabled;
// printf("G-code before filter:\n%s\n", gcode.c_str());
if (m_pressure_equalizer)
gcode = m_pressure_equalizer->process(gcode.c_str(), false);
// printf("G-code after filter:\n%s\n", out.c_str());
#endif /* HAS_PRESSURE_EQUALIZER */
file.write(gcode); file.write(gcode);
#endif #endif

View file

@ -26,7 +26,7 @@ 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. // 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. // Smaller value means a smoother transition between two different flow rates.
static constexpr float max_segment_length = 0.5f; static constexpr float max_segment_length = 1.f;
// For how many GCode lines back will adjust a flow rate from the latest line. // 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 // Bigger values affect the GCode export speed a lot, and smaller values could
@ -64,12 +64,10 @@ PressureEqualizer::PressureEqualizer(const Slic3r::GCodeConfig &config) : m_use_
// Volumetric rate of a 0.45mm x 0.2mm extrusion at 20mm/s XY movement: 0.45*0.2*20*60=1.8*60 = 108 mm^3/min // Volumetric rate of a 0.45mm x 0.2mm extrusion at 20mm/s XY movement: 0.45*0.2*20*60=1.8*60 = 108 mm^3/min
// 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 // 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 if(config.max_volumetric_extrusion_rate_slope_positive.value > 0 || config.max_volumetric_extrusion_rate_slope_negative.value > 0){
//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_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_negative = float(config.max_volumetric_extrusion_rate_slope_negative.value) * 60.f * 60.f;
}
m_max_volumetric_extrusion_rate_slope_positive = float(320) * 60.f * 60.f;
m_max_volumetric_extrusion_rate_slope_negative = float(320) * 60.f * 60.f;
for (ExtrusionRateSlope &extrusion_rate_slope : m_max_volumetric_extrusion_rate_slopes) { for (ExtrusionRateSlope &extrusion_rate_slope : m_max_volumetric_extrusion_rate_slopes) {
extrusion_rate_slope.negative = m_max_volumetric_extrusion_rate_slope_negative; extrusion_rate_slope.negative = m_max_volumetric_extrusion_rate_slope_negative;

View file

@ -725,9 +725,7 @@ static std::vector<std::string> s_Preset_print_options {
"ironing_type", "ironing_pattern", "ironing_flow", "ironing_speed", "ironing_spacing", "ironing_type", "ironing_pattern", "ironing_flow", "ironing_speed", "ironing_spacing",
"max_travel_detour_distance", "max_travel_detour_distance",
"fuzzy_skin", "fuzzy_skin_thickness", "fuzzy_skin_point_distance", "fuzzy_skin", "fuzzy_skin_thickness", "fuzzy_skin_point_distance",
#ifdef HAS_PRESSURE_EQUALIZER
"max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative", "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative",
#endif /* HAS_PRESSURE_EQUALIZER */
"inner_wall_speed", "outer_wall_speed", "sparse_infill_speed", "internal_solid_infill_speed", "inner_wall_speed", "outer_wall_speed", "sparse_infill_speed", "internal_solid_infill_speed",
"top_surface_speed", "support_speed", "support_object_xy_distance", "support_interface_speed", "top_surface_speed", "support_speed", "support_object_xy_distance", "support_interface_speed",
"bridge_speed", "internal_bridge_speed", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed", "bridge_speed", "internal_bridge_speed", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed",

View file

@ -2470,29 +2470,27 @@ def = this->add("filament_loading_speed", coFloats);
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats { 0. }); def->set_default_value(new ConfigOptionFloats { 0. });
#ifdef HAS_PRESSURE_EQUALIZER def = this->add("max_volumetric_extrusion_rate_slope_positive", coFloat);
//def = this->add("max_volumetric_extrusion_rate_slope_positive", coFloat); def->label = L("Max volumetric slope positive");
//def->label = L("Max volumetric slope positive"); def->tooltip = L("This experimental setting is used to limit the speed of change in extrusion rate. "
//def->tooltip = L("This experimental setting is used to limit the speed of change in extrusion rate. " "A value of 1.8 mm³/s² ensures, that a change from the extrusion rate "
// "A value of 1.8 mm³/s² ensures, that a change from the extrusion rate " "of 1.8 mm³/s (0.45mm extrusion width, 0.2mm extrusion height, feedrate 20 mm/s) "
// "of 1.8 mm³/s (0.45mm extrusion width, 0.2mm extrusion height, feedrate 20 mm/s) " "to 5.4 mm³/s (feedrate 60 mm/s) will take at least 2 seconds.");
// "to 5.4 mm³/s (feedrate 60 mm/s) will take at least 2 seconds."); def->sidetext = L("mm³/s²");
//def->sidetext = L("mm³/s²"); def->min = 0;
//def->min = 0; def->mode = comAdvanced;
//def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(0));
//def->set_default_value(new ConfigOptionFloat(0));
//def = this->add("max_volumetric_extrusion_rate_slope_negative", coFloat); def = this->add("max_volumetric_extrusion_rate_slope_negative", coFloat);
//def->label = L("Max volumetric slope negative"); def->label = L("Max volumetric slope negative");
//def->tooltip = L("This experimental setting is used to limit the speed of change in extrusion rate. " def->tooltip = L("This experimental setting is used to limit the speed of change in extrusion rate. "
// "A value of 1.8 mm³/s² ensures, that a change from the extrusion rate " "A value of 1.8 mm³/s² ensures, that a change from the extrusion rate "
// "of 1.8 mm³/s (0.45mm extrusion width, 0.2mm extrusion height, feedrate 20 mm/s) " "of 1.8 mm³/s (0.45mm extrusion width, 0.2mm extrusion height, feedrate 20 mm/s) "
// "to 5.4 mm³/s (feedrate 60 mm/s) will take at least 2 seconds."); "to 5.4 mm³/s (feedrate 60 mm/s) will take at least 2 seconds.");
//def->sidetext = L("mm³/s²"); def->sidetext = L("mm³/s²");
//def->min = 0; def->min = 0;
//def->mode = comAdvanced; def->mode = comAdvanced;
//def->set_default_value(new ConfigOptionFloat(0)); def->set_default_value(new ConfigOptionFloat(0));
#endif /* HAS_PRESSURE_EQUALIZER */
def = this->add("fan_min_speed", coInts); def = this->add("fan_min_speed", coInts);
def->label = L("Fan speed"); def->label = L("Fan speed");

View file

@ -884,8 +884,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionString, layer_change_gcode)) ((ConfigOptionString, layer_change_gcode))
//#ifdef HAS_PRESSURE_EQUALIZER //#ifdef HAS_PRESSURE_EQUALIZER
// ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_positive)) ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_positive))
// ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_negative)) ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_negative))
//#endif //#endif
((ConfigOptionPercents, retract_before_wipe)) ((ConfigOptionPercents, retract_before_wipe))
((ConfigOptionFloats, retraction_length)) ((ConfigOptionFloats, retraction_length))

View file

@ -1995,11 +1995,9 @@ void TabPrint::build()
optgroup->append_single_option_line("top_surface_jerk"); optgroup->append_single_option_line("top_surface_jerk");
optgroup->append_single_option_line("initial_layer_jerk"); optgroup->append_single_option_line("initial_layer_jerk");
optgroup->append_single_option_line("travel_jerk"); optgroup->append_single_option_line("travel_jerk");
#ifdef HAS_PRESSURE_EQUALIZER
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_positive"); optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_positive");
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_negative"); optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_negative");
#endif /* HAS_PRESSURE_EQUALIZER */
page = add_options_page(L("Support"), "support"); page = add_options_page(L("Support"), "support");
optgroup = page->new_optgroup(L("Support"), L"param_support"); optgroup = page->new_optgroup(L("Support"), L"param_support");