Skip to content

Commit

Permalink
Add extruder start/end gcode duration settings
Browse files Browse the repository at this point in the history
  • Loading branch information
casperlamboo committed Nov 13, 2023
1 parent 0c3e9d0 commit fdffc4f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/gcodeExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1254,8 +1254,8 @@ void GCodeExport::startExtruder(const size_t new_extruder)
assert(getCurrentExtrudedVolume() == 0.0 && "Just after an extruder switch we haven't extruded anything yet!");
resetExtrusionValue(); // zero the E value on the new extruder, just to be sure

const std::string start_code = Application::getInstance().current_slice->scene.extruders[new_extruder].settings.get<std::string>("machine_extruder_start_code");

const auto extruder_settings = Application::getInstance().current_slice->scene.extruders[new_extruder].settings;
const auto start_code = extruder_settings.get<std::string>("machine_extruder_start_code");
if (! start_code.empty())
{
if (relative_extrusion)
Expand All @@ -1271,6 +1271,9 @@ void GCodeExport::startExtruder(const size_t new_extruder)
}
}

const auto start_code_duration = extruder_settings.get<Duration>("machine_extruder_start_code_duration");
estimateCalculator.addTime(start_code_duration);

Application::getInstance().communication->setExtruderForSend(Application::getInstance().current_slice->scene.extruders[new_extruder]);
Application::getInstance().communication->sendCurrentPosition(getPositionXY());

Expand Down Expand Up @@ -1302,7 +1305,7 @@ void GCodeExport::switchExtruder(size_t new_extruder, const RetractionConfig& re

resetExtrusionValue(); // zero the E value on the old extruder, so that the current_e_value is registered on the old extruder

const std::string end_code = old_extruder_settings.get<std::string>("machine_extruder_end_code");
const auto end_code = old_extruder_settings.get<std::string>("machine_extruder_end_code");

if (! end_code.empty())
{
Expand All @@ -1319,6 +1322,9 @@ void GCodeExport::switchExtruder(size_t new_extruder, const RetractionConfig& re
}
}

const auto end_code_duration = old_extruder_settings.get<Duration>("machine_extruder_end_code_duration");
estimateCalculator.addTime(end_code_duration);

startExtruder(new_extruder);
}

Expand Down

0 comments on commit fdffc4f

Please sign in to comment.