mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-03 20:13:59 -06:00
Optimisation: ERS - Reduce redundant gcode commands from extrusion rate smoothing (#7398)
* Optimisation: Reduce volume of output gcode commands for pressure equalizer * Update thresholds * Update PrintConfig.cpp * Merge branch 'main' into Optimisation-Reduce-reduntant-gcode-commands-produced-by-Estrusion-Rate-Smoothing * Merge branch 'SoftFever:main' into Optimisation-Reduce-reduntant-gcode-commands-produced-by-Estrusion-Rate-Smoothing * Merge branch 'SoftFever:main' into Optimisation-Reduce-reduntant-gcode-commands-produced-by-Estrusion-Rate-Smoothing * Merge branch 'SoftFever:main' into Optimisation-Reduce-reduntant-gcode-commands-produced-by-Estrusion-Rate-Smoothing * Merge branch 'main' into Optimisation-Reduce-reduntant-gcode-commands-produced-by-Estrusion-Rate-Smoothing * Merge branch 'SoftFever:main' into Optimisation-Reduce-reduntant-gcode-commands-produced-by-Estrusion-Rate-Smoothing * Merge branch 'main' into Optimisation-Reduce-reduntant-gcode-commands-produced-by-Estrusion-Rate-Smoothing * Merge branch 'SoftFever:main' into Optimisation-Reduce-reduntant-gcode-commands-produced-by-Estrusion-Rate-Smoothing * Merge branch 'main' into Optimisation-Reduce-reduntant-gcode-commands-produced-by-Estrusion-Rate-Smoothing
This commit is contained in:
parent
604ded5ff0
commit
67cc143916
1 changed files with 19 additions and 4 deletions
|
@ -482,11 +482,25 @@ void PressureEqualizer::output_gcode_line(const size_t line_idx)
|
|||
if (*comment != ';')
|
||||
comment = nullptr;
|
||||
|
||||
// Emit the line with lowered extrusion rates.
|
||||
// get the gcode line length
|
||||
float l = line.dist_xyz();
|
||||
if (auto nSegments = size_t(ceil(l / m_max_segment_length)); nSegments == 1) { // Just update this segment.
|
||||
// number of segments this line can be broken down to
|
||||
auto nSegments = size_t(ceil(l / m_max_segment_length));
|
||||
|
||||
// Orca:
|
||||
// Calculate the absolute difference in volumetric extrusion rate between the start and end point of the line.
|
||||
// Quantize it to 1mm3/min (0.016mm3/sec).
|
||||
int delta_volumetric_rate = std::round(fabs(line.volumetric_extrusion_rate_end - line.volumetric_extrusion_rate_start));
|
||||
|
||||
// Emit the line with lowered extrusion rates.
|
||||
// Orca:
|
||||
// First, check if the change in volumetric extrusion rate is trivial (less than 10mm3/min -> 0.16mm3/sec (5mm/sec speed for a 0.25 mm nozzle).
|
||||
// Or if the line size is equal in length with the smallest segment.
|
||||
// If so, then emit the line as a single extrusion, i.e. dont split into segments.
|
||||
if ( nSegments == 1 || delta_volumetric_rate < 10) {
|
||||
push_line_to_output(line_idx, line.feedrate() * line.volumetric_correction_avg(), comment);
|
||||
} else {
|
||||
} else // The line needs to be split the line into segments and apply extrusion rate smoothing
|
||||
{
|
||||
bool accelerating = line.volumetric_extrusion_rate_start < line.volumetric_extrusion_rate_end;
|
||||
// Update the initial and final feed rate values.
|
||||
line.pos_start[4] = line.volumetric_extrusion_rate_start * line.pos_end[4] / line.volumetric_extrusion_rate;
|
||||
|
@ -769,7 +783,8 @@ void PressureEqualizer::push_line_to_output(const size_t line_idx, float new_fee
|
|||
// Orca: sanity check, 1 mm/s is the minimum feedrate.
|
||||
if (new_feedrate < 60)
|
||||
new_feedrate = 60;
|
||||
new_feedrate = std::round(new_feedrate);
|
||||
// Quantize speed changes to a minimum of 1mm/sec, to reduce gcode volume for trivial speed changes.
|
||||
new_feedrate = std::round(new_feedrate / 60.0) * 60.0;
|
||||
const GCodeLine &line = m_gcode_lines[line_idx];
|
||||
if (line_idx > 0 && output_buffer_length > 0) {
|
||||
const std::string prev_line_str = std::string(output_buffer.begin() + int(this->output_buffer_prev_length),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue