From 87eb97dcaf8fcbcad2d3f88f3f23623c3fda3d73 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 31 Aug 2023 16:52:45 +0200 Subject: [PATCH] Put note in gcode if min layer time has been applied. Will help with finding issues, debugging, and pointing out (the reason begind) unintuitive results to users, caused by the minimum layer time feature ('cool_min_layer_time'). implements request from print-processing and materials team CURA-10918 --- include/LayerPlan.h | 5 ++++- src/LayerPlan.cpp | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/LayerPlan.h b/include/LayerPlan.h index 64da17faa1..ea7b131918 100644 --- a/include/LayerPlan.h +++ b/include/LayerPlan.h @@ -188,8 +188,9 @@ 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 + * \return if minimal layer time has indeed been applied */ - 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 @@ -271,6 +272,8 @@ class LayerPlan : public NoCopy Polygons bridge_wall_mask; //!< The regions of a layer part that are not supported, used for bridging Polygons overhang_mask; //!< The regions of a layer part where the walls overhang + 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 fan_speed_layer_time_settings_per_extruder; enum CombBoundary diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index 9122bbb414..a44326a890 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -1586,7 +1586,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(); @@ -1664,7 +1664,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) @@ -1865,7 +1868,7 @@ void LayerPlan::processFanSpeedAndMinimalLayerTime(Point 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(starting_position_last_extruder, maximum_cool_min_layer_time, other_extr_plan_time); } @@ -1878,6 +1881,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;