Fix of Supports printed too slowly. #984

Processing of CoolingBuffer is newly staggered for support layers
until the 1st object layer above supports is received by CoolingBuffer.
This commit is contained in:
Vojtech Bubnik 2021-02-16 11:30:49 +01:00
parent b14d872104
commit 6ea5781709
4 changed files with 29 additions and 10 deletions

View file

@ -279,11 +279,24 @@ finished:
return new_feedrate;
}
std::string CoolingBuffer::process_layer(const std::string &gcode, size_t layer_id)
std::string CoolingBuffer::process_layer(std::string &&gcode, size_t layer_id, bool flush)
{
std::vector<PerExtruderAdjustments> per_extruder_adjustments = this->parse_layer_gcode(gcode, m_current_pos);
float layer_time_stretched = this->calculate_layer_slowdown(per_extruder_adjustments);
return this->apply_layer_cooldown(gcode, layer_id, layer_time_stretched, per_extruder_adjustments);
// Cache the input G-code.
if (m_gcode.empty())
m_gcode = std::move(gcode);
else
m_gcode += gcode;
std::string out;
if (flush) {
// This is either an object layer or the very last print layer. Calculate cool down over the collected support layers
// and one object layer.
std::vector<PerExtruderAdjustments> per_extruder_adjustments = this->parse_layer_gcode(m_gcode, m_current_pos);
float layer_time_stretched = this->calculate_layer_slowdown(per_extruder_adjustments);
out = this->apply_layer_cooldown(m_gcode, layer_id, layer_time_stretched, per_extruder_adjustments);
m_gcode.clear();
}
return out;
}
// Parse the layer G-code for the moves, which could be adjusted.

View file

@ -25,7 +25,7 @@ public:
CoolingBuffer(GCode &gcodegen);
void reset();
void set_current_extruder(unsigned int extruder_id) { m_current_extruder = extruder_id; }
std::string process_layer(const std::string &gcode, size_t layer_id);
std::string process_layer(std::string &&gcode, size_t layer_id, bool flush);
GCode* gcodegen() { return &m_gcodegen; }
private:
@ -37,6 +37,7 @@ private:
std::string apply_layer_cooldown(const std::string &gcode, size_t layer_id, float layer_time, std::vector<PerExtruderAdjustments> &per_extruder_adjustments);
GCode& m_gcodegen;
// G-code snippet cached for the support layers preceding an object layer.
std::string m_gcode;
// Internal data.
// X,Y,Z,E,F