Skip to content

Commit

Permalink
Put note in gcode if min layer time has been applied. (Ultimaker#1943)
Browse files Browse the repository at this point in the history
  • Loading branch information
HellAholic authored Jun 7, 2024
2 parents b93f69b + 8712159 commit f4ddf76
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/ExtruderPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class ExtruderPlan
* \param maximum_cool_min_layer_time Maximum minimum layer time for all extruders in this layer
* \param time_other_extr_plans Time spend on other extruders in this layer
*/
void forceMinimalLayerTime(double maximum_cool_min_layer_time, double time_other_extr_plans);
bool forceMinimalLayerTime(double maximum_cool_min_layer_time, double time_other_extr_plans);

/*!
* @return The time needed for (un)retract the path
Expand Down
3 changes: 2 additions & 1 deletion include/LayerPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class Comb;
class SliceDataStorage;
class LayerPlanBuffer;


/*!
* The LayerPlan class stores multiple moves that are planned.
*
Expand Down Expand Up @@ -102,6 +101,8 @@ class LayerPlan : public NoCopy
Shape overhang_mask_; //!< The regions of a layer part where the walls overhang
Shape roofing_mask_; //!< The regions of a layer part where the walls are exposed to the air

bool min_layer_time_used = false; //!< Wether or not the minimum layer time (cool_min_layer_time) was actually used in this layerplan.

const std::vector<FanSpeedLayerTimeSettings> fan_speed_layer_time_settings_per_extruder_;

enum CombBoundary
Expand Down
11 changes: 9 additions & 2 deletions src/LayerPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,7 @@ void LayerPlan::spiralizeWallSlice(
}
}

void ExtruderPlan::forceMinimalLayerTime(double minTime, double time_other_extr_plans)
bool ExtruderPlan::forceMinimalLayerTime(double minTime, double time_other_extr_plans)
{
const double minimalSpeed = fan_speed_layer_time_settings_.cool_min_speed;
const double travelTime = estimates_.getTravelTime();
Expand Down Expand Up @@ -1808,7 +1808,10 @@ void ExtruderPlan::forceMinimalLayerTime(double minTime, double time_other_extr_
path.speed_factor *= slow_down_factor;
path.estimates.extrude_time /= slow_down_factor;
}

return true;
}
return false;
}

double ExtruderPlan::getRetractTime(const GCodePath& path)
Expand Down Expand Up @@ -2007,7 +2010,7 @@ void LayerPlan::processFanSpeedAndMinimalLayerTime(Point2LL starting_position)

// apply minimum layer time behaviour
ExtruderPlan& last_extruder_plan = extruder_plans_[last_extruder_idx];
last_extruder_plan.forceMinimalLayerTime(maximum_cool_min_layer_time, other_extr_plan_time);
min_layer_time_used |= last_extruder_plan.forceMinimalLayerTime(maximum_cool_min_layer_time, other_extr_plan_time);
last_extruder_plan.processFanSpeedForMinimalLayerTime(maximum_cool_min_layer_time, other_extr_plan_time);
}

Expand All @@ -2020,6 +2023,10 @@ void LayerPlan::writeGCode(GCodeExport& gcode)
gcode.setLayerNr(layer_nr_);

gcode.writeLayerComment(layer_nr_);
if (min_layer_time_used)
{
gcode.writeComment("note -- min layer time used");
}

// flow-rate compensation
const Settings& mesh_group_settings = Application::getInstance().current_slice_->scene.current_mesh_group->settings;
Expand Down

0 comments on commit f4ddf76

Please sign in to comment.