#674 correct standby temperature

This commit is contained in:
supermerill 2020-11-17 12:24:37 +01:00
parent c4851d5896
commit 4a0928d279

View File

@ -100,13 +100,13 @@ double get_default_acceleration(PrintConfig & config) {
void AvoidCrossingPerimeters::init_external_mp(const Print &print) void AvoidCrossingPerimeters::init_external_mp(const Print &print)
{ {
m_external_mp = Slic3r::make_unique<MotionPlanner>(union_ex(this->collect_contours_all_layers(print.objects()))); m_external_mp = Slic3r::make_unique<MotionPlanner>(union_ex(this->collect_contours_all_layers(print.objects())));
} }
// Plan a travel move while minimizing the number of perimeter crossings. // Plan a travel move while minimizing the number of perimeter crossings.
// point is in unscaled coordinates, in the coordinate system of the current active object // point is in unscaled coordinates, in the coordinate system of the current active object
// (set by gcodegen.set_origin()). // (set by gcodegen.set_origin()).
Polyline AvoidCrossingPerimeters::travel_to(const GCode& gcodegen, const Point& point) Polyline AvoidCrossingPerimeters::travel_to(const GCode& gcodegen, const Point& point)
{ {
// If use_external, then perform the path planning in the world coordinate system (correcting for the gcodegen offset). // If use_external, then perform the path planning in the world coordinate system (correcting for the gcodegen offset).
// Otherwise perform the path planning in the coordinate system of the active object. // Otherwise perform the path planning in the coordinate system of the active object.
bool use_external = this->use_external_mp || this->use_external_mp_once; bool use_external = this->use_external_mp || this->use_external_mp_once;
@ -116,13 +116,13 @@ void AvoidCrossingPerimeters::init_external_mp(const Print &print)
if (use_external) if (use_external)
result.translate(-scaled_origin); result.translate(-scaled_origin);
return result; return result;
} }
// Collect outer contours of all objects over all layers. // Collect outer contours of all objects over all layers.
// Discard objects only containing thin walls (offset would fail on an empty polygon). // Discard objects only containing thin walls (offset would fail on an empty polygon).
// Used by avoid crossing perimeters feature. // Used by avoid crossing perimeters feature.
Polygons AvoidCrossingPerimeters::collect_contours_all_layers(const PrintObjectPtrs& objects) Polygons AvoidCrossingPerimeters::collect_contours_all_layers(const PrintObjectPtrs& objects)
{ {
Polygons islands; Polygons islands;
for (const PrintObject* object : objects) { for (const PrintObject* object : objects) {
// Reducing all the object slices into the Z projection in a logarithimc fashion. // Reducing all the object slices into the Z projection in a logarithimc fashion.
@ -182,11 +182,11 @@ void AvoidCrossingPerimeters::init_external_mp(const Print &print)
} }
} }
return islands; return islands;
} }
std::string OozePrevention::pre_toolchange(GCode& gcodegen) std::string OozePrevention::pre_toolchange(GCode& gcodegen)
{ {
std::string gcode; std::string gcode;
// move to the nearest standby point // move to the nearest standby point
@ -213,27 +213,27 @@ void AvoidCrossingPerimeters::init_external_mp(const Print &print)
} }
return gcode; return gcode;
} }
std::string OozePrevention::post_toolchange(GCode& gcodegen) std::string OozePrevention::post_toolchange(GCode& gcodegen)
{ {
return (gcodegen.config().standby_temperature_delta.value != 0 && gcodegen.writer().tool_is_extruder()) ? return (gcodegen.config().standby_temperature_delta.value != 0 && gcodegen.writer().tool_is_extruder()) ?
gcodegen.writer().set_temperature(this->_get_temp(gcodegen), true, gcodegen.writer().tool()->id()) : gcodegen.writer().set_temperature(this->_get_temp(gcodegen), true, gcodegen.writer().tool()->id()) :
std::string(); std::string();
} }
int OozePrevention::_get_temp(GCode& gcodegen) int OozePrevention::_get_temp(GCode& gcodegen)
{ {
if (gcodegen.writer().tool_is_extruder()) if (gcodegen.writer().tool_is_extruder())
return (gcodegen.layer() == NULL || gcodegen.layer()->id() == 0) return (gcodegen.layer() == NULL || gcodegen.layer()->id() == 0)
? gcodegen.config().first_layer_temperature.get_at(gcodegen.writer().tool()->id()) ? gcodegen.config().first_layer_temperature.get_at(gcodegen.writer().tool()->id())
: gcodegen.config().temperature.get_at(gcodegen.writer().tool()->id()); : gcodegen.config().temperature.get_at(gcodegen.writer().tool()->id());
else else
return 0; return 0;
} }
std::string Wipe::wipe(GCode& gcodegen, bool toolchange) std::string Wipe::wipe(GCode& gcodegen, bool toolchange)
{ {
std::string gcode; std::string gcode;
/* Reduce feedrate a bit; travel speed is often too high to move on existing material. /* Reduce feedrate a bit; travel speed is often too high to move on existing material.
@ -291,7 +291,7 @@ void AvoidCrossingPerimeters::init_external_mp(const Print &print)
} }
return gcode; return gcode;
} }
//if first layer, ask for a bigger lift for travel to object, to be on the safe side //if first layer, ask for a bigger lift for travel to object, to be on the safe side
static inline void set_extra_lift(const Layer& layer, const Print& print, GCodeWriter & writer, int extruder_id) { static inline void set_extra_lift(const Layer& layer, const Print& print, GCodeWriter & writer, int extruder_id) {
@ -1237,9 +1237,12 @@ static void init_multiextruders(FILE *file, Print &print, GCodeWriter & writer,
//set standby temp for reprap //set standby temp for reprap
if (std::set<uint8_t>{gcfRepRap}.count(print.config().gcode_flavor.value) > 0) { if (std::set<uint8_t>{gcfRepRap}.count(print.config().gcode_flavor.value) > 0) {
for (uint16_t tool_id : tool_ordering.all_extruders()) { for (uint16_t tool_id : tool_ordering.all_extruders()) {
int standby_temp = int(print.config().temperature.get_at(tool_id));
if(print.config().ooze_prevention.value)
standby_temp += print.config().standby_temperature_delta.value;
fprintf(file, "G10 P%d R%d S%d ; sets the standby temperature\n", fprintf(file, "G10 P%d R%d S%d ; sets the standby temperature\n",
tool_id, tool_id,
int(print.config().filament_toolchange_temp.get_at(tool_id)), standby_temp,
int(print.config().temperature.get_at(tool_id))); int(print.config().temperature.get_at(tool_id)));
} }
} }