Skip to content

Commit d43f1f1

Browse files
committed
Setting to limit randomized layer speed to infill only.
Don't merge to main (yet?) -- part of PPQ-41
1 parent 0d0f0bb commit d43f1f1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

include/LayerPlan.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ class LayerPlan : public NoCopy
168168
bool min_layer_time_used = false; //!< Wether or not the minimum layer time (cool_min_layer_time) was actually used in this layerplan.
169169

170170
Ratio random_speed_variance_ = 1.0; //!< For this layer. Default to 1.0 (100% = this layer is not 'variegated' w.r.t the others), see constructor.
171+
bool random_speed_infill_only_ = true; //!< Apply the speed randomization to infill only, instead of the whole layer.
171172

172173
const std::vector<FanSpeedLayerTimeSettings> fan_speed_layer_time_settings_per_extruder_;
173174

src/LayerPlan.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ LayerPlan::LayerPlan(
159159
std::uniform_real_distribution<> dist(random_min, random_max);
160160
random_speed_variance_ = dist(gen);
161161
}
162+
random_speed_infill_only_ = local_settings.get<bool>("random_speed_infill_only");
162163
}
163164

164165
LayerPlan::~LayerPlan()
@@ -562,14 +563,18 @@ void LayerPlan::addExtrusionMove(
562563
const double fan_speed,
563564
const bool travel_to_z)
564565
{
566+
const auto speed_factor_randomization =
567+
(random_speed_infill_only_ && config.type != PrintFeatureType::Infill) ?
568+
Ratio(1.0) :
569+
random_speed_variance_;
565570
GCodePath* path = getLatestPathWithConfig(
566571
config,
567572
space_fill_type,
568573
config.z_offset,
569574
flow,
570575
width_factor,
571576
spiralize,
572-
speed_factor * random_speed_variance_
577+
speed_factor * speed_factor_randomization
573578
);
574579
path->points.push_back(p);
575580
path->setFanSpeed(fan_speed);

0 commit comments

Comments
 (0)