Skip to content

Commit

Permalink
Applied clang-format.
Browse files Browse the repository at this point in the history
  • Loading branch information
rburema authored and github-actions[bot] committed Oct 23, 2024
1 parent abff1e0 commit 669da73
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 32 deletions.
39 changes: 13 additions & 26 deletions src/FffGcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,44 +337,27 @@ void FffGcodeWriter::setConfigFanSpeedLayerTime()

static bool retractConfigIsSame(const RetractionConfig& a, const RetractionConfig& b)
{
return a.distance == b.distance
&& a.prime_volume == b.prime_volume
&& a.speed == b.speed
&& a.primeSpeed == b.primeSpeed
&& a.zHop == b.zHop
&& a.retraction_min_travel_distance == b.retraction_min_travel_distance
&& a.retraction_extrusion_window == b.retraction_extrusion_window
return a.distance == b.distance && a.prime_volume == b.prime_volume && a.speed == b.speed && a.primeSpeed == b.primeSpeed && a.zHop == b.zHop
&& a.retraction_min_travel_distance == b.retraction_min_travel_distance && a.retraction_extrusion_window == b.retraction_extrusion_window
&& a.retraction_count_max == b.retraction_count_max;
}

static bool switchRetractConfigIsSame(const RetractionAndWipeConfig& a, const RetractionAndWipeConfig& b)
{
return retractConfigIsSame(a.extruder_switch_retraction_config, b.extruder_switch_retraction_config)
&& a.retraction_hop_after_extruder_switch == b.retraction_hop_after_extruder_switch
&& a.switch_extruder_extra_prime_amount == b.switch_extruder_extra_prime_amount;
&& a.retraction_hop_after_extruder_switch == b.retraction_hop_after_extruder_switch && a.switch_extruder_extra_prime_amount == b.switch_extruder_extra_prime_amount;
}

static bool wipeConfigIsSame(const WipeScriptConfig& a, const WipeScriptConfig& b)
{
return retractConfigIsSame(a.retraction_config, b.retraction_config)
&& a.retraction_enable == b.retraction_enable
&& a.pause == b.pause
&& a.hop_enable == b.hop_enable
&& a.hop_amount == b.hop_amount
&& a.hop_speed == b.hop_speed
&& a.brush_pos_x == b.brush_pos_x
&& a.repeat_count == b.repeat_count
&& a.move_distance == b.move_distance
&& a.move_speed == b.move_speed
&& a.max_extrusion_mm3 == b.max_extrusion_mm3
&& a.clean_between_layers == b.clean_between_layers;
return retractConfigIsSame(a.retraction_config, b.retraction_config) && a.retraction_enable == b.retraction_enable && a.pause == b.pause && a.hop_enable == b.hop_enable
&& a.hop_amount == b.hop_amount && a.hop_speed == b.hop_speed && a.brush_pos_x == b.brush_pos_x && a.repeat_count == b.repeat_count && a.move_distance == b.move_distance
&& a.move_speed == b.move_speed && a.max_extrusion_mm3 == b.max_extrusion_mm3 && a.clean_between_layers == b.clean_between_layers;
}

static bool retractAndWipeConfigIsSame(const RetractionAndWipeConfig& a, const RetractionAndWipeConfig& b)
{
return retractConfigIsSame(a.retraction_config, b.retraction_config)
&& switchRetractConfigIsSame(a, b)
&& wipeConfigIsSame(a.wipe_config, b.wipe_config);
return retractConfigIsSame(a.retraction_config, b.retraction_config) && switchRetractConfigIsSame(a, b) && wipeConfigIsSame(a.wipe_config, b.wipe_config);
}

static void retractionConfigFromSettings(const Settings& settings, RetractionAndWipeConfig* config)
Expand Down Expand Up @@ -451,8 +434,12 @@ void FffGcodeWriter::setConfigRetractionAndWipe(SliceDataStorage& storage)
// This has potential conflicts with per-extruder retract/wipe settings.
// So, only override the settings on a per-object basis if all extruder retract/wipe settings are the same.
const auto& compare_with_first = storage.retraction_wipe_config_per_extruder[0];
const bool mesh_overrides_extruder_retraction_and_wipe = ranges::all_of(storage.retraction_wipe_config_per_extruder,
[&compare_with_first](const auto& config) { return retractAndWipeConfigIsSame(compare_with_first, config); });
const bool mesh_overrides_extruder_retraction_and_wipe = ranges::all_of(
storage.retraction_wipe_config_per_extruder,
[&compare_with_first](const auto& config)
{
return retractAndWipeConfigIsSame(compare_with_first, config);
});
for (std::shared_ptr<SliceMeshStorage>& mesh : storage.meshes)
{
retractionAndWipeConfigFromSettings(mesh->settings, &mesh->retraction_wipe_config);
Expand Down
15 changes: 9 additions & 6 deletions src/LayerPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,9 @@ GCodePath& LayerPlan::addTravel(const Point2LL& p, const bool force_retract, con
{
const GCodePathConfig& travel_config = configs_storage_.travel_config_per_extruder[getExtruder()];

const RetractionConfig& retraction_config
= current_mesh_ && current_mesh_->override_extruder_retract_settings ? current_mesh_->retraction_wipe_config.retraction_config : storage_.retraction_wipe_config_per_extruder[getExtruder()].retraction_config;
const RetractionConfig& retraction_config = current_mesh_ && current_mesh_->override_extruder_retract_settings
? current_mesh_->retraction_wipe_config.retraction_config
: storage_.retraction_wipe_config_per_extruder[getExtruder()].retraction_config;

GCodePath* path = getLatestPathWithConfig(travel_config, SpaceFillType::None, z_offset);

Expand Down Expand Up @@ -2282,8 +2283,9 @@ void LayerPlan::writeGCode(GCodeExport& gcode)
{
ExtruderPlan& extruder_plan = extruder_plans_[extruder_plan_idx];

const RetractionAndWipeConfig* retraction_config
= current_mesh && current_mesh->override_extruder_retract_settings ? &current_mesh->retraction_wipe_config : &storage_.retraction_wipe_config_per_extruder[extruder_plan.extruder_nr_];
const RetractionAndWipeConfig* retraction_config = current_mesh && current_mesh->override_extruder_retract_settings
? &current_mesh->retraction_wipe_config
: &storage_.retraction_wipe_config_per_extruder[extruder_plan.extruder_nr_];
coord_t z_hop_height = retraction_config->retraction_config.zHop;

if (extruder_nr != extruder_plan.extruder_nr_)
Expand Down Expand Up @@ -2693,8 +2695,9 @@ void LayerPlan::writeGCode(GCodeExport& gcode)
if (extruder.settings_.get<bool>("cool_lift_head") && extruder_plan.extra_time_ > 0.0)
{
gcode.writeComment("Small layer, adding delay");
const RetractionAndWipeConfig& actual_retraction_config
= current_mesh && current_mesh->override_extruder_retract_settings ? current_mesh->retraction_wipe_config : storage_.retraction_wipe_config_per_extruder[gcode.getExtruderNr()];
const RetractionAndWipeConfig& actual_retraction_config = current_mesh && current_mesh->override_extruder_retract_settings
? current_mesh->retraction_wipe_config
: storage_.retraction_wipe_config_per_extruder[gcode.getExtruderNr()];
gcode.writeRetraction(actual_retraction_config.retraction_config);
if (extruder_plan_idx == extruder_plans_.size() - 1 || ! extruder.settings_.get<bool>("machine_extruder_end_pos_abs"))
{ // only do the z-hop if it's the last extruder plan; otherwise it's already at the switching bay area
Expand Down

0 comments on commit 669da73

Please sign in to comment.