mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 15:37:30 -06:00
preheat work - part 1
This commit is contained in:
parent
a9668728bc
commit
7d0fb4f42a
12 changed files with 866 additions and 76 deletions
|
@ -90,48 +90,56 @@ std::string GCodeWriter::postamble() const
|
|||
return gcode.str();
|
||||
}
|
||||
|
||||
std::string GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool) const
|
||||
{
|
||||
if (wait && (FLAVOR_IS(gcfMakerWare) || FLAVOR_IS(gcfSailfish)))
|
||||
std::string GCodeWriter::set_temperature(unsigned int temperature, GCodeFlavor flavor, bool wait, int tool, std::string comment){
|
||||
if (wait && (flavor == gcfMakerWare || flavor == gcfSailfish))
|
||||
return "";
|
||||
|
||||
std::string code, comment;
|
||||
if (wait && FLAVOR_IS_NOT(gcfTeacup) && FLAVOR_IS_NOT(gcfRepRapFirmware)) {
|
||||
code = "M109";
|
||||
comment = "set nozzle temperature and wait for it to be reached";
|
||||
|
||||
std::string code;
|
||||
if (wait && flavor != gcfTeacup && flavor != gcfRepRapFirmware) {
|
||||
code = "M109";
|
||||
if(comment.empty())
|
||||
comment = "set nozzle temperature and wait for it to be reached";
|
||||
} else {
|
||||
if (FLAVOR_IS(gcfRepRapFirmware)) { // M104 is deprecated on RepRapFirmware
|
||||
if (flavor == gcfRepRapFirmware) { // M104 is deprecated on RepRapFirmware
|
||||
code = "G10";
|
||||
} else {
|
||||
code = "M104";
|
||||
}
|
||||
comment = "set nozzle temperature";
|
||||
if(comment.empty())
|
||||
comment = "set nozzle temperature";
|
||||
}
|
||||
|
||||
|
||||
std::ostringstream gcode;
|
||||
gcode << code << " ";
|
||||
if (FLAVOR_IS(gcfMach3) || FLAVOR_IS(gcfMachinekit)) {
|
||||
if (flavor == gcfMach3 || flavor == gcfMachinekit) {
|
||||
gcode << "P";
|
||||
} else {
|
||||
gcode << "S";
|
||||
}
|
||||
gcode << temperature;
|
||||
bool multiple_tools = this->multiple_extruders && ! m_single_extruder_multi_material;
|
||||
if (tool != -1 && (multiple_tools || FLAVOR_IS(gcfMakerWare) || FLAVOR_IS(gcfSailfish)) ) {
|
||||
if (FLAVOR_IS(gcfRepRapFirmware)) {
|
||||
if (tool != -1) {
|
||||
if (flavor == gcfRepRapFirmware) {
|
||||
gcode << " P" << tool;
|
||||
} else {
|
||||
gcode << " T" << tool;
|
||||
}
|
||||
}
|
||||
gcode << " ; " << comment << "\n";
|
||||
|
||||
if ((FLAVOR_IS(gcfTeacup) || FLAVOR_IS(gcfRepRapFirmware)) && wait)
|
||||
|
||||
if ((flavor == gcfTeacup || flavor == gcfRepRapFirmware) && wait)
|
||||
gcode << "M116 ; wait for temperature to be reached\n";
|
||||
|
||||
|
||||
return gcode.str();
|
||||
}
|
||||
|
||||
std::string GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool) const
|
||||
{
|
||||
// set tool to -1 to make sure we won't emit T parameter for single extruder or SEMM
|
||||
if (!this->multiple_extruders || m_single_extruder_multi_material)
|
||||
tool = -1;
|
||||
return set_temperature(temperature, this->config.gcode_flavor, wait, tool);
|
||||
}
|
||||
|
||||
// BBS
|
||||
std::string GCodeWriter::set_bed_temperature(int temperature, bool wait)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue