Fixed couple of compiler warnings

This commit is contained in:
Lukas Matena 2024-05-22 11:02:33 +02:00
parent 9f95a25040
commit f35f34376c
4 changed files with 14 additions and 45 deletions

View File

@ -685,8 +685,8 @@ std::string SLAPrint::validate(std::vector<std::string>*) const
}
}
if (!m_material_config.use_tilt.get_at(0) && m_material_config.tower_hop_height.get_at(0) == 0
|| !m_material_config.use_tilt.get_at(1) && m_material_config.tower_hop_height.get_at(1) == 0)
if ((!m_material_config.use_tilt.get_at(0) && m_material_config.tower_hop_height.get_at(0) == 0)
|| (!m_material_config.use_tilt.get_at(1) && m_material_config.tower_hop_height.get_at(1) == 0))
return _u8L("Disabling the 'Use tilt' function causes the object to separate away from the film in the "
"vertical direction only. Therefore, it is necessary to set the 'Tower hop height' parameter "
"to reasonable value. The recommended value is 5 mm.");

View File

@ -1127,9 +1127,6 @@ void SLAPrint::Steps::merge_slices_and_eval_stats() {
const auto height = scaled<double>(printer_config.display_height.getFloat());
const double display_area = width*height;
double supports_volume(0.0);
double models_volume(0.0);
std::vector<std::tuple<double, double, bool, double, double>> layers_info; // time, area, is_fast, models_volume, supports_volume
layers_info.resize(printer_input.size());
@ -1220,7 +1217,7 @@ void SLAPrint::Steps::merge_slices_and_eval_stats() {
bool is_fast_layer = false;
if (is_prusa_print) {
is_fast_layer = sliced_layer_cnt < first_slow_layers || layer_area <= display_area * area_fill;
is_fast_layer = int(sliced_layer_cnt) < first_slow_layers || layer_area <= display_area * area_fill;
const int l_height_nm = 1000000 * l_height;
layer_times = layer_peel_move_time(l_height_nm, is_fast_layer ? below : above) +

View File

@ -6529,7 +6529,7 @@ static void render_sla_layer_legend(const SLAPrint& print, int layer_idx, int cn
const std::vector<double>& areas = print.print_statistics().layers_areas;
const std::vector<double>& times = print.print_statistics().layers_times_running_total;
const double display_area = print.printer_config().display_height * print.printer_config().display_width;
if (layer_idx >= 0 && layer_idx < areas.size()) {
if (layer_idx >= 0 && layer_idx < int(areas.size())) {
const double area = areas[layer_idx];
const double time = times[layer_idx] - (layer_idx == 0 ? 0. : times[layer_idx-1]);
const double time_until_layer = times[layer_idx];
@ -6539,13 +6539,18 @@ static void render_sla_layer_legend(const SLAPrint& print, int layer_idx, int cn
ImGui::SetNextWindowBgAlpha(0.6f);
imgui.begin(_u8L("Layer statistics"), ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoFocusOnAppearing);
ImGui::Text(_u8L("Layer area: %.0f mm²").c_str(), area);
// FIXME: The snprintf would better be replaced by GUI::format, but I don't want to
// touch translated strings before the release.
char text[50];
snprintf(text, 50, _u8L("Layer area: %.0f mm²").c_str(), area);
ImGui::Text("%s", text);
int area_percent_int = int(std::round(100. * area/display_area));
ImGui::Text(GUI::format(_u8L("Area fill: %1% %%%%"), area_percent_int == 0 ? "<1" : std::to_string(area_percent_int)).c_str());
snprintf(text, 50, GUI::format(_u8L("Area fill: %1% %%%%"), area_percent_int == 0 ? "<1" : std::to_string(area_percent_int)).c_str());
ImGui::Text("%s", text);
ImGui::Separator();
ImGui::Text(GUI::format(_u8L("Layer time: %1%"), get_time_dhms(time)).c_str());
ImGui::Text("%s", GUI::format(_u8L("Layer time: %1%"), get_time_dhms(time)).c_str());
std::string buffer_str = _u8L("Time since start: %1%");
ImGui::Text(GUI::format(buffer_str, get_time_dhms(time_until_layer)).c_str());
ImGui::Text("%s", GUI::format(buffer_str, get_time_dhms(time_until_layer)).c_str());
// The dummy control below uses the assumption that the total time string will be the longest
// and forces the width of the window large enough so it does not resize depending on the current value.
@ -6567,10 +6572,8 @@ void GLCanvas3D::_render_sla_slices()
// nothing to render, return
return;
if (print->finished()) {
double slider_width = 0.;
if (print->finished())
render_sla_layer_legend(*print, m_layer_slider_index, get_canvas_size().get_width());
}
double clip_min_z = -m_clipping_planes[0].get_data()[3];
double clip_max_z = m_clipping_planes[1].get_data()[3];

View File

@ -5472,7 +5472,6 @@ void TabSLAMaterial::build_tilt_group(Slic3r::GUI::PageShp page)
{
if (key.find_first_of("use_tilt") == 0)
toggle_tilt_options(key == "use_tilt#0");
update_dirty();
update();
};
@ -5481,36 +5480,6 @@ void TabSLAMaterial::build_tilt_group(Slic3r::GUI::PageShp page)
append_tilt_options_line(optgroup, opt_key);
}
static boost::any get_def_config_value(const DynamicPrintConfig& config, const std::string& opt_key, int idx)
{
boost::any ret;
const ConfigOptionDef* opt = config.def()->get(opt_key);
auto def_values = opt->default_value;
if (def_values) {
switch (def_values->type()) {
case coFloats: {
double val = static_cast<const ConfigOptionFloats*>(def_values.get())->get_at(idx);
ret = double_to_string(val);
}
break;
case coInts:
ret = static_cast<const ConfigOptionInts*>(def_values.get())->get_at(idx);
break;
case coBools:
ret = static_cast<const ConfigOptionBools*>(def_values.get())->get_at(idx);
break;
case coEnums:
ret = static_cast<const ConfigOptionEnumsGeneric*>(def_values.get())->get_at(idx);
break;
case coNone:
default:
break;
}
}
return ret;
}
std::vector<std::string> disable_tilt_options = {
"tilt_down_initial_speed"
,"tilt_down_offset_steps"