The new chamber_minimal_temperature parameter is taken into account

This commit is contained in:
Lukas Matena 2024-03-26 11:16:31 +01:00
parent 30e2e20475
commit 8d26de63f3
4 changed files with 9 additions and 10 deletions

View File

@ -1212,7 +1212,7 @@ void GCodeGenerator::_do_export(Print& print, GCodeOutputStream &file, Thumbnail
std::string start_gcode = this->placeholder_parser_process("start_gcode", print.config().start_gcode.value, initial_extruder_id);
this->_print_first_layer_chamber_temperature(file, print, start_gcode, initial_extruder_id, false);
this->_print_first_layer_chamber_temperature(file, print, start_gcode, config().chamber_temperature.get_at(initial_extruder_id), false, false);
this->_print_first_layer_bed_temperature(file, print, start_gcode, initial_extruder_id, true);
this->_print_first_layer_extruder_temperatures(file, print, start_gcode, initial_extruder_id, false);
@ -1223,7 +1223,8 @@ void GCodeGenerator::_do_export(Print& print, GCodeOutputStream &file, Thumbnail
file.writeln(start_gcode);
this->_print_first_layer_extruder_temperatures(file, print, start_gcode, initial_extruder_id, true);
this->_print_first_layer_chamber_temperature(file, print, start_gcode, initial_extruder_id, true);
this->_print_first_layer_chamber_temperature(file, print, start_gcode, config().chamber_minimal_temperature.get_at(initial_extruder_id), true, false);
this->_print_first_layer_chamber_temperature(file, print, start_gcode, config().chamber_temperature.get_at(initial_extruder_id), false, false);
print.throw_if_canceled();
// Set other general things.
@ -1896,11 +1897,9 @@ void GCodeGenerator::_print_first_layer_bed_temperature(GCodeOutputStream &file,
// Only do that if the start G-code does not already contain any M-code controlling chamber temperature.
// M141 - Set chamber Temperature
// M191 - Set chamber Temperature and Wait
void GCodeGenerator::_print_first_layer_chamber_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait)
void GCodeGenerator::_print_first_layer_chamber_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, int temp, bool wait, bool accurate)
{
bool autoemit = print.config().autoemit_temperature_commands;
// Initial bed temperature based on the first extruder.
int temp = print.config().chamber_temperature.get_at(first_printing_extruder_id);
// Is the bed temperature set by the provided custom G-code?
int temp_by_gcode = -1;
bool temp_set_by_gcode = custom_gcode_sets_temperature(gcode, 141, 191, false, temp_by_gcode);
@ -1908,7 +1907,7 @@ void GCodeGenerator::_print_first_layer_chamber_temperature(GCodeOutputStream &f
temp = temp_by_gcode;
// Always call m_writer.set_bed_temperature() so it will set the internal "current" state of the bed temp as if
// the custom start G-code emited these.
std::string set_temp_gcode = m_writer.set_chamber_temperature(temp, wait);
std::string set_temp_gcode = m_writer.set_chamber_temperature(temp, wait, accurate);
if (autoemit && ! temp_set_by_gcode)
file.write(set_temp_gcode);
}

View File

@ -468,7 +468,7 @@ private:
std::string _extrude(
const ExtrusionAttributes &attribs, const Geometry::ArcWelder::Path &path, const std::string_view description, double speed = -1);
void print_machine_envelope(GCodeOutputStream &file, const Print &print);
void _print_first_layer_chamber_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
void _print_first_layer_chamber_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, int temp, bool wait, bool accurate);
void _print_first_layer_bed_temperature(GCodeOutputStream &file, const Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
void _print_first_layer_extruder_temperatures(GCodeOutputStream &file, const Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
// On the first printing layer. This flag triggers first layer speeds.

View File

@ -183,7 +183,7 @@ std::string GCodeWriter::set_bed_temperature(unsigned int temperature, bool wait
std::string GCodeWriter::set_chamber_temperature(unsigned int temperature, bool wait) const
std::string GCodeWriter::set_chamber_temperature(unsigned int temperature, bool wait, bool accurate) const
{
std::string_view code, comment;
if (wait) {
@ -195,7 +195,7 @@ std::string GCodeWriter::set_chamber_temperature(unsigned int temperature, bool
}
std::ostringstream gcode;
gcode << code << " S" << temperature << " ; " << comment << "\n";
gcode << code << (accurate ? " R" : " S") << temperature << " ; " << comment << "\n";
return gcode.str();
}

View File

@ -52,7 +52,7 @@ public:
std::string postamble() const;
std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1) const;
std::string set_bed_temperature(unsigned int temperature, bool wait = false);
std::string set_chamber_temperature(unsigned int temperature, bool wait) const;
std::string set_chamber_temperature(unsigned int temperature, bool wait, bool accurate) const;
std::string set_print_acceleration(unsigned int acceleration) { return set_acceleration_internal(Acceleration::Print, acceleration); }
std::string set_travel_acceleration(unsigned int acceleration) { return set_acceleration_internal(Acceleration::Travel, acceleration); }
std::string reset_e(bool force = false);