Skip to content

Commit

Permalink
Fixed unused variables warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Nov 22, 2023
1 parent 1c37545 commit 511971f
Show file tree
Hide file tree
Showing 25 changed files with 56 additions and 117 deletions.
3 changes: 1 addition & 2 deletions include/ExtruderPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ class ExtruderPlan
/*!
* Applying fan speed changes for minimal layer times.
*
* \param starting_position The position the head was before starting this extruder plan
* \param minTime Maximum minimum layer time for all extruders in this layer
* \param time_other_extr_plans The time spent on the other extruder plans in this layer
*/
void processFanSpeedForMinimalLayerTime(Point2LL starting_position, Duration maximum_cool_min_layer_time, double time_other_extr_plans);
void processFanSpeedForMinimalLayerTime(Duration maximum_cool_min_layer_time, double time_other_extr_plans);

/*!
* Applying fan speed changes for the first layers.
Expand Down
14 changes: 3 additions & 11 deletions include/FffGcodeWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,11 @@ class FffGcodeWriter : public NoCopy
/*!
* Add a single layer from a single mesh-volume to the layer plan \p gcodeLayer in mesh surface mode.
*
* \param[in] storage where the slice data is stored.
* \param mesh The mesh to add to the layer plan \p gcodeLayer.
* \param mesh_config the line config with which to print a print feature
* \param gcodeLayer The initial planning of the gcode of the layer.
*/
void addMeshLayerToGCode_meshSurfaceMode(const SliceDataStorage& storage, const SliceMeshStorage& mesh, const MeshPathConfigs& mesh_config, LayerPlan& gcodeLayer) const;
void addMeshLayerToGCode_meshSurfaceMode(const SliceMeshStorage& mesh, const MeshPathConfigs& mesh_config, LayerPlan& gcodeLayer) const;

/*!
* Add the open polylines from a single layer from a single mesh-volume to the layer plan \p gcodeLayer for mesh the surface modes.
Expand Down Expand Up @@ -398,13 +397,8 @@ class FffGcodeWriter : public NoCopy
* \param part The part for which to create gcode.
* \return Whether this function added anything to the layer plan.
*/
bool processMultiLayerInfill(
const SliceDataStorage& storage,
LayerPlan& gcodeLayer,
const SliceMeshStorage& mesh,
const size_t extruder_nr,
const MeshPathConfigs& mesh_config,
const SliceLayerPart& part) const;
bool processMultiLayerInfill(LayerPlan& gcodeLayer, const SliceMeshStorage& mesh, const size_t extruder_nr, const MeshPathConfigs& mesh_config, const SliceLayerPart& part)
const;

/*!
* \brief Add normal sparse infill for a given part in a layer.
Expand Down Expand Up @@ -549,7 +543,6 @@ class FffGcodeWriter : public NoCopy
* \param[in] storage where the slice data is stored.
* \param gcode_layer The initial planning of the gcode of the layer.
* \param mesh The mesh for which to add to the layer plan \p gcode_layer.
* \param mesh_config The mesh-config for which to add to the layer plan \p gcode_layer.
* \param extruder_nr The extruder for which to print all features of the mesh which should be printed with this extruder
* \param area The area to fill
* \param config the line config with which to print the print feature
Expand All @@ -566,7 +559,6 @@ class FffGcodeWriter : public NoCopy
const SliceDataStorage& storage,
LayerPlan& gcode_layer,
const SliceMeshStorage& mesh,
const MeshPathConfigs& mesh_config,
const size_t extruder_nr,
const Polygons& area,
const GCodePathConfig& config,
Expand Down
12 changes: 3 additions & 9 deletions include/PathOrderOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class PathOrderOptimizer
}
else
{
optimized_order = getOptimizerOrderWithConstraints(line_bucket_grid, snap_radius, *order_requirements_);
optimized_order = getOptimizerOrderWithConstraints(*order_requirements_);
}


Expand Down Expand Up @@ -300,10 +300,6 @@ class PathOrderOptimizer

std::unordered_map<OrderablePath*, bool> picked(paths_.size()); // Fixed size boolean flag for whether each path is already in the optimized vector.

auto isPicked = [&picked](OrderablePath* c)
{
return picked[c];
};
auto notPicked = [&picked](OrderablePath* c)
{
return ! picked[c];
Expand Down Expand Up @@ -356,8 +352,7 @@ class PathOrderOptimizer
return optimized_order;
}

std::vector<OrderablePath>
getOptimizerOrderWithConstraints(SparsePointGridInclusive<size_t> line_bucket_grid, size_t snap_radius, const std::unordered_multimap<Path, Path>& order_requirements)
std::vector<OrderablePath> getOptimizerOrderWithConstraints(const std::unordered_multimap<Path, Path>& order_requirements)
{
std::vector<OrderablePath> optimized_order; // To store our result in.

Expand Down Expand Up @@ -422,7 +417,7 @@ class PathOrderOptimizer
};

const std::function<std::nullptr_t(const Path, const std::nullptr_t)> handle_node
= [&current_position, &optimized_order, this](const Path current_node, const std::nullptr_t _state)
= [&current_position, &optimized_order, this](const Path current_node, [[maybe_unused]] const std::nullptr_t state)
{
// We should make map from node <-> path for this stuff
for (auto& path : paths_)
Expand Down Expand Up @@ -652,7 +647,6 @@ class PathOrderOptimizer
{
// For most seam types, the shortest distance matters. Not for SHARPEST_CORNER though.
// For SHARPEST_CORNER, use a fixed starting score of 0.
const coord_t distance = (combing_boundary_ == nullptr) ? getDirectDistance(here, target_pos) : getCombingDistance(here, target_pos);
const double score_distance = (seam_config_.type_ == EZSeamType::SHARPEST_CORNER && seam_config_.corner_pref_ != EZSeamCornerPrefType::Z_SEAM_CORNER_PREF_NONE)
? MM2INT(10)
: vSize2(here - target_pos);
Expand Down
11 changes: 5 additions & 6 deletions include/Preheat.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#ifndef PREHEAT_H
#define PREHEAT_H

#include <algorithm> // max
#include <cassert>

#include "settings/types/Duration.h"
#include "settings/types/Ratio.h"
#include "settings/types/Temperature.h"

#include <algorithm> // max
#include <cassert>

namespace cura
{

Expand Down Expand Up @@ -45,11 +45,10 @@ class Preheat
* or the initial layer temperature.
*
* \param extruder The extruder train
* \param flow The flow for which to get the optimal temperature
* \param is_initial_layer Whether the initial layer temperature should be returned instead of flow-based temperature
* \return The corresponding optimal temperature
*/
Temperature getTemp(const size_t extruder, const Ratio& flow, const bool is_initial_layer);
Temperature getTemp(const size_t extruder, const bool is_initial_layer);

/*!
* Decide when to start warming up again after starting to cool down towards \p temp_mid.
Expand Down Expand Up @@ -112,4 +111,4 @@ class Preheat

} // namespace cura

#endif // PREHEAT_H
#endif // PREHEAT_H
2 changes: 1 addition & 1 deletion include/SkeletalTrapezoidationGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class SkeletalTrapezoidationGraph : public HalfEdgeGraph<SkeletalTrapezoidationJ
*/
void collapseSmallEdges(coord_t snap_dist = 5);

void makeRib(edge_t*& prev_edge, Point2LL start_source_point, Point2LL end_source_point, bool is_next_to_start_or_end);
void makeRib(edge_t*& prev_edge, Point2LL start_source_point, Point2LL end_source_point);

/*!
* Insert a node into the graph and connect it to the input polygon using ribs
Expand Down
2 changes: 1 addition & 1 deletion include/TreeSupportTipGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace cura
class TreeSupportTipGenerator
{
public:
TreeSupportTipGenerator(const SliceDataStorage& storage, const SliceMeshStorage& mesh, TreeModelVolumes& volumes_);
TreeSupportTipGenerator(const SliceMeshStorage& mesh, TreeModelVolumes& volumes_);

/*!
* \brief Generate tips, that will later form branches
Expand Down
2 changes: 1 addition & 1 deletion include/plugins/slots.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct simplify_default

struct infill_generate_default
{
std::tuple<std::vector<VariableWidthLines>, Polygons, Polygons> operator()(auto&&... args)
std::tuple<std::vector<VariableWidthLines>, Polygons, Polygons> operator()([[maybe_unused]] auto&&... args)
{
// this code is only reachable when no slot is registered while the infill type is requested to be
// generated by a plugin; this should not be possible to set up in the first place. Return an empty
Expand Down
13 changes: 5 additions & 8 deletions include/support.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#ifndef SUPPORT_H
#define SUPPORT_H

#include "settings/types/LayerIndex.h"
#include "utils/polygon.h"

#include <cstddef>
#include <vector>

#include "settings/types/LayerIndex.h"
#include "utils/polygon.h"

namespace cura
{

Expand Down Expand Up @@ -219,11 +219,9 @@ class AreaSupport
* \param storage Where to store the resulting support.
* \param supportLayer_up The support areas the layer above.
* \param supportLayer_this The overhang areas of the current layer at hand.
* \param smoothing_distance Maximal distance in the X/Y directions of a
* line segment which is to be smoothed out.
* \return The joined support areas for this layer.
*/
static Polygons join(const SliceDataStorage& storage, const Polygons& supportLayer_up, Polygons& supportLayer_this, const coord_t smoothing_distance);
static Polygons join(const SliceDataStorage& storage, const Polygons& supportLayer_up, Polygons& supportLayer_this);

/*!
* Move the support up from model (cut away polygons to ensure bottom z distance)
Expand Down Expand Up @@ -322,11 +320,10 @@ class AreaSupport
* generates varying xy disallowed areas for \param layer_idx where the offset distance is dependent on the wall angle
*
* \param storage Data storage containing the input layer data and
* \param settings The settings to use to calculate the offsets
* \param layer_idx The layer for which the disallowed areas are to be calcualted
*
*/
static Polygons generateVaryingXYDisallowedArea(const SliceMeshStorage& storage, const Settings& infill_settings, const LayerIndex layer_idx);
static Polygons generateVaryingXYDisallowedArea(const SliceMeshStorage& storage, const LayerIndex layer_idx);
};


Expand Down
2 changes: 1 addition & 1 deletion src/BeadingStrategy/BeadingStrategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ double BeadingStrategy::getTransitionAnchorPos(coord_t lower_bead_count) const
return 1.0 - static_cast<double>(transition_point - lower_optimum) / static_cast<double>(upper_optimum - lower_optimum);
}

std::vector<coord_t> BeadingStrategy::getNonlinearThicknesses(coord_t lower_bead_count) const
std::vector<coord_t> BeadingStrategy::getNonlinearThicknesses([[maybe_unused]] coord_t lower_bead_count) const
{
return std::vector<coord_t>();
}
Expand Down
11 changes: 3 additions & 8 deletions src/FffGcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ FffGcodeWriter::ProcessLayerResult FffGcodeWriter::processLayer(const SliceDataS
== mesh->settings.get<ExtruderTrain&>("wall_0_extruder_nr").extruder_nr_ // mesh surface mode should always only be printed with the outer wall extruder!
)
{
addMeshLayerToGCode_meshSurfaceMode(storage, *mesh, mesh_config, gcode_layer);
addMeshLayerToGCode_meshSurfaceMode(*mesh, mesh_config, gcode_layer);
}
else
{
Expand Down Expand Up @@ -1476,8 +1476,7 @@ std::vector<size_t> FffGcodeWriter::calculateMeshOrder(const SliceDataStorage& s
return ret;
}

void FffGcodeWriter::addMeshLayerToGCode_meshSurfaceMode(const SliceDataStorage& storage, const SliceMeshStorage& mesh, const MeshPathConfigs& mesh_config, LayerPlan& gcode_layer)
const
void FffGcodeWriter::addMeshLayerToGCode_meshSurfaceMode(const SliceMeshStorage& mesh, const MeshPathConfigs& mesh_config, LayerPlan& gcode_layer) const
{
if (gcode_layer.getLayerNr() > mesh.layer_nr_max_filled_layer)
{
Expand Down Expand Up @@ -1630,13 +1629,12 @@ bool FffGcodeWriter::processInfill(
{
return false;
}
bool added_something = processMultiLayerInfill(storage, gcode_layer, mesh, extruder_nr, mesh_config, part);
bool added_something = processMultiLayerInfill(gcode_layer, mesh, extruder_nr, mesh_config, part);
added_something = added_something | processSingleLayerInfill(storage, gcode_layer, mesh, extruder_nr, mesh_config, part);
return added_something;
}

bool FffGcodeWriter::processMultiLayerInfill(
const SliceDataStorage& storage,
LayerPlan& gcode_layer,
const SliceMeshStorage& mesh,
const size_t extruder_nr,
Expand Down Expand Up @@ -2698,7 +2696,6 @@ void FffGcodeWriter::processRoofing(
storage,
gcode_layer,
mesh,
mesh_config,
extruder_nr,
skin_part.roofing_fill,
mesh_config.roofing_config,
Expand Down Expand Up @@ -2879,7 +2876,6 @@ void FffGcodeWriter::processTopBottom(
storage,
gcode_layer,
mesh,
mesh_config,
extruder_nr,
skin_part.skin_fill,
*skin_config,
Expand All @@ -2896,7 +2892,6 @@ void FffGcodeWriter::processSkinPrintFeature(
const SliceDataStorage& storage,
LayerPlan& gcode_layer,
const SliceMeshStorage& mesh,
const MeshPathConfigs& mesh_config,
const size_t extruder_nr,
const Polygons& area,
const GCodePathConfig& config,
Expand Down
3 changes: 2 additions & 1 deletion src/FffPolygonGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,8 @@ void FffPolygonGenerator::processFuzzyWalls(SliceMeshStorage& mesh)
= (mesh.settings.get<EPlatformAdhesion>("adhesion_type") == EPlatformAdhesion::BRIM) ? 1 : 0; // don't make fuzzy skin on first layer if there's a brim

auto hole_area = Polygons();
std::function<bool(const bool&, const ExtrusionJunction&)> accumulate_is_in_hole = [](const bool& prev_result, const ExtrusionJunction& junction)
std::function<bool(const bool&, const ExtrusionJunction&)> accumulate_is_in_hole
= []([[maybe_unused]] const bool& prev_result, [[maybe_unused]] const ExtrusionJunction& junction)
{
return false;
};
Expand Down
2 changes: 1 addition & 1 deletion src/InterlockingGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ std::pair<Polygons, Polygons> InterlockingGenerator::growBorderAreasPerpendicula
Polygons from_border_b = b.difference(total_shrunk);

Polygons temp_a, temp_b;
for (auto _ : ranges::views::iota(0, (detect / min_line) + 2))
for (coord_t i = 0; i < (detect / min_line) + 2; ++i)
{
temp_a = from_border_a.offset(min_line);
temp_b = from_border_b.offset(min_line);
Expand Down
8 changes: 3 additions & 5 deletions src/LayerPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ void LayerPlan::addWall(

void LayerPlan::addInfillWall(const ExtrusionLine& wall, const GCodePathConfig& path_config, bool force_retract)
{
assert(("All empty walls should have been filtered at this stage", ! wall.empty()));
assert(! wall.empty() && "All empty walls should have been filtered at this stage");
ExtrusionJunction junction{ *wall.begin() };
addTravel(junction.p_, force_retract);

Expand Down Expand Up @@ -1701,7 +1701,7 @@ TimeMaterialEstimates ExtruderPlan::computeNaiveTimeEstimates(Point2LL starting_
return estimates_;
}

void ExtruderPlan::processFanSpeedForMinimalLayerTime(Point2LL starting_position, Duration minTime, double time_other_extr_plans)
void ExtruderPlan::processFanSpeedForMinimalLayerTime(Duration minTime, double time_other_extr_plans)
{
/*
min layer time
Expand Down Expand Up @@ -1778,7 +1778,6 @@ void LayerPlan::processFanSpeedAndMinimalLayerTime(Point2LL starting_position)
return a.extruder_nr_ < b.extruder_nr_;
})
->extruder_nr_;
Point2LL starting_position_last_extruder;
unsigned int last_extruder_idx;
double other_extr_plan_time = 0.0;
Duration maximum_cool_min_layer_time;
Expand All @@ -1792,7 +1791,6 @@ void LayerPlan::processFanSpeedAndMinimalLayerTime(Point2LL starting_position)
extruder_plan.computeNaiveTimeEstimates(starting_position);
if (extruder_plan.extruder_nr_ == last_extruder_nr)
{
starting_position_last_extruder = starting_position;
last_extruder_idx = extr_plan_idx;
}
else
Expand All @@ -1814,7 +1812,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);
last_extruder_plan.processFanSpeedForMinimalLayerTime(starting_position_last_extruder, maximum_cool_min_layer_time, other_extr_plan_time);
last_extruder_plan.processFanSpeedForMinimalLayerTime(maximum_cool_min_layer_time, other_extr_plan_time);
}


Expand Down
10 changes: 2 additions & 8 deletions src/LayerPlanBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,18 +519,12 @@ void LayerPlanBuffer::insertTempCommands()
size_t extruder = extruder_plan.extruder_nr_;
const Settings& extruder_settings = Application::getInstance().current_slice_->scene.extruders[extruder].settings_;
Duration time = extruder_plan.estimates_.getTotalUnretractedTime();
Ratio avg_flow;
if (time > 0.0)
{
avg_flow = extruder_plan.estimates_.material / time;
}
else
if (time <= 0.0)
{
assert(extruder_plan.estimates_.material == 0.0 && "No extrusion time should mean no material usage!");
avg_flow = 0.0;
}

Temperature print_temp = preheat_config_.getTemp(extruder, avg_flow, extruder_plan.is_initial_layer_);
Temperature print_temp = preheat_config_.getTemp(extruder, extruder_plan.is_initial_layer_);
Temperature initial_print_temp = extruder_settings.get<Temperature>("material_initial_print_temperature");

if (extruder_plan.temperature_factor_ > 0) // force lower printing temperatures due to minimum layer time
Expand Down
2 changes: 1 addition & 1 deletion src/Preheat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Duration Preheat::getTimeToGoFromTempToTemp(const size_t extruder, const Tempera
return std::max(0.0_s, time);
}

Temperature Preheat::getTemp(const size_t extruder, const Ratio& flow, const bool is_initial_layer)
Temperature Preheat::getTemp(const size_t extruder, const bool is_initial_layer)
{
const Settings& extruder_settings = Application::getInstance().current_slice_->scene.extruders[extruder].settings_;
if (is_initial_layer && extruder_settings.get<Temperature>("material_print_temperature_layer_0") != 0)
Expand Down
Loading

0 comments on commit 511971f

Please sign in to comment.