Skip to content

Commit

Permalink
CURA-11967 fix material print temp prepend not being disabled (#2116)
Browse files Browse the repository at this point in the history
  • Loading branch information
HellAholic authored Jul 10, 2024
2 parents 5d97590 + 6b5cced commit 40a6bf2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 24 deletions.
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

0 comments on commit 40a6bf2

Please sign in to comment.