Merge branch 'lh_fix_warnings' into master_27x

This commit is contained in:
Lukáš Hejl 2024-01-05 22:41:09 +01:00
commit 2eddb80033
7 changed files with 32 additions and 22 deletions

View File

@ -699,13 +699,16 @@ void gcode_spread_points(
}
}
*/
float area_total = 0;
float volume_total = 0;
float volume_excess = 0;
float volume_deficit = 0;
size_t n_cells = 0;
float area_circle_total = 0;
float area_total = 0;
float volume_total = 0;
size_t n_cells = 0;
#if 0
float volume_excess = 0;
float volume_deficit = 0;
float area_circle_total = 0;
// The intermediate lines.
for (int j = row_first; j < row_last; ++ j) {
const std::pair<float, float> &span1 = spans[j];
@ -759,7 +762,11 @@ void gcode_spread_points(
cell.volume = acc[j][i];
cell.area = mask[j][i];
assert(cell.area >= 0.f && cell.area <= 1.000001f);
area_circle_total += area;
#if 0
area_circle_total += area;
#endif
if (cell.area < area)
cell.area = area;
cell.fraction_covered = std::clamp((cell.area > 0) ? (area / cell.area) : 0, 0.f, 1.f);
@ -769,10 +776,15 @@ void gcode_spread_points(
}
float cell_height = cell.volume / cell.area;
cell.excess_height = cell_height - height_target;
#if 0
area_circle_total += area;
if (cell.excess_height > 0.f)
volume_excess += cell.excess_height * cell.area * cell.fraction_covered;
else
volume_deficit -= cell.excess_height * cell.area * cell.fraction_covered;
#endif
volume_total += cell.volume * cell.fraction_covered;
area_total += cell.area * cell.fraction_covered;
}

View File

@ -3142,7 +3142,7 @@ std::string GCodeGenerator::_extrude(
gcode += m_writer.set_speed(F, "", cooling_marker_setspeed_comments);
if (dynamic_speed_and_fan_speed.second >= 0)
gcode += ";_SET_FAN_SPEED" + std::to_string(int(dynamic_speed_and_fan_speed.second)) + "\n";
double path_length = 0.;
std::string comment;
if (m_config.gcode_comments) {
comment = description;
@ -3176,16 +3176,13 @@ std::string GCodeGenerator::_extrude(
}
if (radius == 0) {
// Extrude line segment.
if (const double line_length = (p - prev).norm(); line_length > 0) {
path_length += line_length;
if (const double line_length = (p - prev).norm(); line_length > 0)
gcode += m_writer.extrude_to_xy(p, e_per_mm * line_length, comment);
}
} else {
double angle = Geometry::ArcWelder::arc_angle(prev.cast<double>(), p.cast<double>(), double(radius));
assert(angle > 0);
const double line_length = angle * std::abs(radius);
path_length += line_length;
const double dE = e_per_mm * line_length;
const double dE = e_per_mm * line_length;
assert(dE > 0);
gcode += m_writer.extrude_to_xy_G2G3IJ(p, ij, it->ccw(), dE, comment);
}

View File

@ -2253,7 +2253,6 @@ size_t ExtruderFilaments::update_compatible_internal(const PresetWithVendorProfi
const ConfigOption* opt = active_printer.preset.config.option("nozzle_diameter");
if (opt)
config.set_key_value("num_extruders", new ConfigOptionInt((int)static_cast<const ConfigOptionFloats*>(opt)->values.size()));
bool some_compatible = false;
// Adjust printer preset config to the first extruder from m_extruder_id
Preset printer_preset_adjusted = active_printer.preset;
@ -2281,7 +2280,6 @@ size_t ExtruderFilaments::update_compatible_internal(const PresetWithVendorProfi
const PresetWithVendorProfile this_preset_with_vendor_profile = m_filaments->get_preset_with_vendor_profile(*preset);
bool was_compatible = extr_filament.is_compatible;
extr_filament.is_compatible = is_compatible_with_printer(this_preset_with_vendor_profile, active_printer_adjusted, &config);
some_compatible |= extr_filament.is_compatible;
if (active_print != nullptr)
extr_filament.is_compatible &= is_compatible_with_print(this_preset_with_vendor_profile, *active_print, active_printer_adjusted);
if (!extr_filament.is_compatible && is_selected &&

View File

@ -244,12 +244,16 @@ private:
*/
std::optional<std::reference_wrapper<const Polygons>> getArea(const TreeModelVolumes::RadiusLayerPair &key) const {
std::lock_guard<std::mutex> guard(m_mutex);
if (key.second >= LayerIndex(m_data.size()))
return std::optional<std::reference_wrapper<const Polygons>>{};
const auto &layer = m_data[key.second];
return std::nullopt;
const LayerData &layer = m_data[key.second];
auto it = layer.find(key.first);
return it == layer.end() ?
std::optional<std::reference_wrapper<const Polygons>>{} : std::optional<std::reference_wrapper<const Polygons>>{ it->second };
if (it == layer.end())
return std::nullopt;
return std::optional<std::reference_wrapper<const Polygons>>{it->second};
}
// Get a collision area at a given layer for a radius that is a lower or equial to the key radius.
std::optional<std::pair<coord_t, std::reference_wrapper<const Polygons>>> get_lower_bound_area(const TreeModelVolumes::RadiusLayerPair &key) const {

View File

@ -404,7 +404,6 @@ private:
bool m_datadir_redefined { false };
bool m_wifi_config_dialog_shown { false };
bool m_wifi_config_dialog_was_declined { false };
};
DECLARE_APP(GUI_App)

View File

@ -3310,7 +3310,7 @@ static void check_objects_after_cut(const ModelObjectPtrs& objects)
for (int obj_idx : err_objects_idxs)
model_names.push_back(objects[obj_idx]->name);
auto fix_and_update_progress = [plater, model_names, &objects](const int obj_idx, int model_idx,
auto fix_and_update_progress = [model_names, &objects](const int obj_idx, int model_idx,
wxProgressDialog& progress_dlg,
std::vector<std::string>& succes_models,
std::vector<std::pair<std::string, std::string>>& failed_models) -> bool

View File

@ -192,7 +192,7 @@ void WifiConfigDialog::rescan_networks(bool select)
std::string current = m_wifi_scanner->get_current_ssid();
const auto& map = m_wifi_scanner->get_map();
m_ssid_combo->Clear();
for (const auto pair : map) {
for (const auto &pair : map) {
m_ssid_combo->Append(pair.first);
// select ssid of current network (if connected)
if (current == pair.first)