Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CURA-11967 fix material print temp prepend not being disabled #2116

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions include/gcodeExport.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,15 @@ class GCodeExport : public NoCopy
*/
void processInitialLayerBedTemperature();

/*!
* Set extruders temperatures for the initial layer. Called by 'processInitialLayerTemperatures'.
*
* \param storage The slice data storage
* \param wait_start_extruder Indicates whether we should always wait for the start extruder temperature to be reached
* \param start_extruder_nr The index of the start extruder
*/
void processInitialLayerExtrudersTemperatures(const SliceDataStorage& storage, const bool wait_start_extruder, const size_t start_extruder_nr);

public:
/*!
* Get ready for extrusion moves:
Expand Down
56 changes: 32 additions & 24 deletions src/gcodeExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,33 +760,18 @@ void GCodeExport::processInitialLayerBedTemperature()
}
}

void GCodeExport::processInitialLayerTemperature(const SliceDataStorage& storage, const size_t start_extruder_nr)
void GCodeExport::processInitialLayerExtrudersTemperatures(const SliceDataStorage& storage, const bool wait_start_extruder, const size_t start_extruder_nr)
{
Scene& scene = Application::getInstance().current_slice_->scene;
const size_t num_extruders = scene.extruders.size();
const bool material_print_temp_prepend = scene.current_mesh_group->settings.get<bool>("material_print_temp_prepend");
const bool material_print_temp_wait = scene.current_mesh_group->settings.get<bool>("material_print_temp_wait");
bool wait_start_extruder = false;

switch (getFlavor())
if (! material_print_temp_prepend && (scene.current_mesh_group == scene.mesh_groups.begin()))
{
case EGCodeFlavor::ULTIGCODE:
// Nozzle initial temperatures are handled by start GCode, ignore
return;
case EGCodeFlavor::GRIFFIN:
wait_start_extruder = true;
break;
default:
if (num_extruders > 1 || getFlavor() == EGCodeFlavor::REPRAP)
{
std::ostringstream tmp;
tmp << "T" << start_extruder_nr;
writeLine(tmp.str().c_str());
}
break;
}

processInitialLayerBedTemperature();

struct ExtruderInitialize
{
size_t nr;
Expand Down Expand Up @@ -816,25 +801,48 @@ void GCodeExport::processInitialLayerTemperature(const SliceDataStorage& storage
}

// First set all the required temperatures at once, but without waiting so that all heaters start heating right now
const bool prepend_all_temperatures = material_print_temp_prepend || (scene.current_mesh_group != scene.mesh_groups.begin());
for (ExtruderInitialize& extruder : all_extruders)
{
if (extruder.nr == start_extruder_nr || prepend_all_temperatures)
{
writeTemperatureCommand(extruder.nr, extruder.temperature, false, true);
}
writeTemperatureCommand(extruder.nr, extruder.temperature, false, true);
}

// Now wait for all the required temperatures one after the other
for (ExtruderInitialize& extruder : all_extruders)
{
if (material_print_temp_wait || (extruder.nr == start_extruder_nr && wait_start_extruder))
if (material_print_temp_wait || ((extruder.nr == start_extruder_nr) && wait_start_extruder))
{
writeTemperatureCommand(extruder.nr, extruder.temperature, true, true);
}
}
}

void GCodeExport::processInitialLayerTemperature(const SliceDataStorage& storage, const size_t start_extruder_nr)
{
Scene& scene = Application::getInstance().current_slice_->scene;
const size_t num_extruders = scene.extruders.size();
bool wait_start_extruder = false;

switch (getFlavor())
{
case EGCodeFlavor::ULTIGCODE:
return;
case EGCodeFlavor::GRIFFIN:
wait_start_extruder = true;
break;
default:
if (num_extruders > 1 || getFlavor() == EGCodeFlavor::REPRAP)
{
std::ostringstream tmp;
tmp << "T" << start_extruder_nr;
writeLine(tmp.str().c_str());
}
break;
}

processInitialLayerBedTemperature();
processInitialLayerExtrudersTemperatures(storage, wait_start_extruder, start_extruder_nr);
}

bool GCodeExport::needPrimeBlob() const
{
switch (getFlavor())
Expand Down
Loading