From 623e9d5cb421df97bed4a1d4b4f24a8acb8eccaf Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 16 Oct 2023 16:28:29 +0200 Subject: [PATCH 1/7] Fix issues with OBJ loading on macOS Sonoma --- src/libslic3r/Format/objparser.cpp | 49 +++++++++++++++++++----------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/src/libslic3r/Format/objparser.cpp b/src/libslic3r/Format/objparser.cpp index 76cab505c0..2b80a26721 100644 --- a/src/libslic3r/Format/objparser.cpp +++ b/src/libslic3r/Format/objparser.cpp @@ -11,9 +11,24 @@ #include "objparser.hpp" #include "libslic3r/LocalesUtils.hpp" +#include "fast_float/fast_float.h" namespace ObjParser { +// To fix issues with obj loading on macOS Sonoma, we use the following function instead of strtod that +// was used before. Apparently the locales are not handled as they should. We already saw this before in +// https://github.com/prusa3d/PrusaSlicer/issues/10380. +static double strtod_clocale(const char* str, char const** str_end) +{ + double val = 0.; + auto [pend, ec] = fast_float::from_chars(str, *str_end, val); + if (pend != str && ec != std::errc::result_out_of_range) + *str_end = pend; // success + else + *str_end = str; + return val; +} + static bool obj_parseline(const char *line, ObjData &data) { #define EATWS() while (*line == ' ' || *line == '\t') ++ line @@ -45,15 +60,15 @@ static bool obj_parseline(const char *line, ObjData &data) if (c2 != ' ' && c2 != '\t') return false; EATWS(); - char *endptr = 0; - double u = strtod(line, &endptr); + const char *endptr = 0; + double u = strtod_clocale(line, &endptr); if (endptr == 0 || (*endptr != ' ' && *endptr != '\t')) return false; line = endptr; EATWS(); double v = 0; if (*line != 0) { - v = strtod(line, &endptr); + v = strtod_clocale(line, &endptr); if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0)) return false; line = endptr; @@ -61,7 +76,7 @@ static bool obj_parseline(const char *line, ObjData &data) } double w = 0; if (*line != 0) { - w = strtod(line, &endptr); + w = strtod_clocale(line, &endptr); if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0)) return false; line = endptr; @@ -82,18 +97,18 @@ static bool obj_parseline(const char *line, ObjData &data) if (c2 != ' ' && c2 != '\t') return false; EATWS(); - char *endptr = 0; - double x = strtod(line, &endptr); + const char *endptr = 0; + double x = strtod_clocale(line, &endptr); if (endptr == 0 || (*endptr != ' ' && *endptr != '\t')) return false; line = endptr; EATWS(); - double y = strtod(line, &endptr); + double y = strtod_clocale(line, &endptr); if (endptr == 0 || (*endptr != ' ' && *endptr != '\t')) return false; line = endptr; EATWS(); - double z = strtod(line, &endptr); + double z = strtod_clocale(line, &endptr); if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0)) return false; line = endptr; @@ -112,20 +127,20 @@ static bool obj_parseline(const char *line, ObjData &data) if (c2 != ' ' && c2 != '\t') return false; EATWS(); - char *endptr = 0; - double u = strtod(line, &endptr); + const char *endptr = 0; + double u = strtod_clocale(line, &endptr); if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0)) return false; line = endptr; EATWS(); - double v = strtod(line, &endptr); + double v = strtod_clocale(line, &endptr); if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0)) return false; line = endptr; EATWS(); double w = 0; if (*line != 0) { - w = strtod(line, &endptr); + w = strtod_clocale(line, &endptr); if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0)) return false; line = endptr; @@ -144,25 +159,25 @@ static bool obj_parseline(const char *line, ObjData &data) if (c2 != ' ' && c2 != '\t') return false; EATWS(); - char *endptr = 0; - double x = strtod(line, &endptr); + const char *endptr = 0; + double x = strtod_clocale(line, &endptr); if (endptr == 0 || (*endptr != ' ' && *endptr != '\t')) return false; line = endptr; EATWS(); - double y = strtod(line, &endptr); + double y = strtod_clocale(line, &endptr); if (endptr == 0 || (*endptr != ' ' && *endptr != '\t')) return false; line = endptr; EATWS(); - double z = strtod(line, &endptr); + double z = strtod_clocale(line, &endptr); if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0)) return false; line = endptr; EATWS(); double w = 1.0; if (*line != 0) { - w = strtod(line, &endptr); + w = strtod_clocale(line, &endptr); if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0)) return false; line = endptr; From e6c4522143fabb781dfd21c442075fcb8cd9255b Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 16 Oct 2023 16:54:05 +0200 Subject: [PATCH 2/7] Removed unused parameter 'arc_fitting_tolerance' from the configuration layer, added static_assert for coord_t size --- src/libslic3r/Geometry/ArcWelder.hpp | 1 + src/libslic3r/Preset.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 9 --------- src/libslic3r/PrintConfig.hpp | 1 - src/libslic3r/PrintObject.cpp | 3 +-- src/slic3r/GUI/ConfigManipulation.cpp | 3 --- src/slic3r/GUI/Tab.cpp | 1 - 7 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/libslic3r/Geometry/ArcWelder.hpp b/src/libslic3r/Geometry/ArcWelder.hpp index 660d0ccf2c..dceec568a4 100644 --- a/src/libslic3r/Geometry/ArcWelder.hpp +++ b/src/libslic3r/Geometry/ArcWelder.hpp @@ -375,6 +375,7 @@ double arc_fit_max_deviation(const Point &start_point, const Point &end_point, c const Points::const_iterator begin, const Points::const_iterator end); // 1.2m diameter, maximum given by coord_t +static_assert(sizeof(coord_t) == 4); static constexpr const double default_scaled_max_radius = scaled(600.); // 0.05mm static constexpr const double default_scaled_resolution = scaled(0.05); diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 1cd114d14d..f565995d10 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -465,7 +465,7 @@ static std::vector s_Preset_print_options { "ooze_prevention", "standby_temperature_delta", "interface_shells", "extrusion_width", "first_layer_extrusion_width", "perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width", "top_infill_extrusion_width", "support_material_extrusion_width", "infill_overlap", "infill_anchor", "infill_anchor_max", "bridge_flow_ratio", - "elefant_foot_compensation", "xy_size_compensation", "resolution", "gcode_resolution", "arc_fitting", "arc_fitting_tolerance", + "elefant_foot_compensation", "xy_size_compensation", "resolution", "gcode_resolution", "arc_fitting", "wipe_tower", "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_cone_angle", "wipe_tower_rotation_angle", "wipe_tower_brim_width", "wipe_tower_bridging", "single_extruder_multi_material_priming", "mmu_segmented_region_max_width", "mmu_segmented_region_interlocking_depth", "wipe_tower_extruder", "wipe_tower_no_sparse_layers", "wipe_tower_extra_spacing", "compatible_printers", "compatible_printers_condition", "inherits", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index e9add773a6..c38ae76269 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -447,15 +447,6 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionEnum(ArcFittingType::Disabled)); - def = this->add("arc_fitting_tolerance", coFloatOrPercent); - def->label = L("Arc fitting tolerance"); - def->sidetext = L("mm or %"); - def->tooltip = L("When using the arc_fitting option, allow the curve to deviate certain % from the collection of straight paths.\n" - "Can be either a mm value or a percentage of the current extrusion width."); - def->mode = comAdvanced; - def->min = 0; - def->set_default_value(new ConfigOptionFloatOrPercent(5, true)); - // Maximum extruder temperature, bumped to 1500 to support printing of glass. const int max_temp = 1500; def = this->add("avoid_crossing_curled_overhangs", coBool); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 63ffcde0e3..97c2d89d40 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -701,7 +701,6 @@ PRINT_CONFIG_CLASS_DEFINE( GCodeConfig, ((ConfigOptionEnum, arc_fitting)) - ((ConfigOptionFloatOrPercent, arc_fitting_tolerance)) ((ConfigOptionBool, autoemit_temperature_commands)) ((ConfigOptionString, before_layer_gcode)) ((ConfigOptionString, between_objects_gcode)) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 228cc00672..dc5a86fc3b 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -715,8 +715,7 @@ bool PrintObject::invalidate_state_by_config_options( || opt_key == "perimeter_extrusion_width" || opt_key == "infill_overlap" || opt_key == "external_perimeters_first" - || opt_key == "arc_fitting" - || opt_key == "arc_fitting_tolerance") { + || opt_key == "arc_fitting") { steps.emplace_back(posPerimeters); } else if ( opt_key == "gap_fill_enabled" diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index cd5248d1a1..e6abeda550 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -345,9 +345,6 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config) toggle_field("min_feature_size", have_arachne); toggle_field("min_bead_width", have_arachne); toggle_field("thin_walls", !have_arachne); - - bool has_arc_fitting = config->opt_enum("arc_fitting") != ArcFittingType::Disabled; - toggle_field("arc_fitting_tolerance", has_arc_fitting); } void ConfigManipulation::update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config/* = false*/) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 45ce29468f..4d279ebbeb 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1677,7 +1677,6 @@ void TabPrint::build() optgroup->append_single_option_line("resolution"); optgroup->append_single_option_line("gcode_resolution"); optgroup->append_single_option_line("arc_fitting"); - optgroup->append_single_option_line("arc_fitting_tolerance"); optgroup->append_single_option_line("xy_size_compensation"); optgroup->append_single_option_line("elefant_foot_compensation", "elephant-foot-compensation_114487"); From 30861c81d282459f12e196ef74a6380eb532d476 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 17 Oct 2023 09:31:51 +0200 Subject: [PATCH 3/7] Removed G2/3 R option, it does not work correctly --- src/libslic3r/GCode.cpp | 14 +++--------- src/libslic3r/GCode/GCodeWriter.cpp | 35 ----------------------------- src/libslic3r/GCode/GCodeWriter.hpp | 8 ------- src/libslic3r/GCode/Wipe.cpp | 11 ++++----- src/libslic3r/PrintConfig.cpp | 6 ++--- src/libslic3r/PrintConfig.hpp | 3 +-- 6 files changed, 10 insertions(+), 67 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index a9a7ee2a93..ba6e71b7ea 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -3071,7 +3071,6 @@ std::string GCodeGenerator::_extrude( Vec2d prev = GCodeFormatter::quantize(prev_exact); auto it = path.begin(); auto end = path.end(); - const bool emit_radius = m_config.arc_fitting == ArcFittingType::EmitRadius; for (++ it; it != end; ++ it) { Vec2d p_exact = this->point_to_gcode(it->point); Vec2d p = GCodeFormatter::quantize(p_exact); @@ -3082,14 +3081,9 @@ std::string GCodeGenerator::_extrude( Vec2d ij; if (it->radius != 0) { // Extrude an arc. - assert(m_config.arc_fitting == ArcFittingType::EmitCenter || - m_config.arc_fitting == ArcFittingType::EmitRadius); + assert(m_config.arc_fitting == ArcFittingType::EmitCenter); radius = unscaled(it->radius); - if (emit_radius) { - // Only quantize radius if emitting it directly into G-code. Otherwise use the exact radius for calculating the IJ values. - //FIXME rather re-fit the arc to improve accuracy! - radius = GCodeFormatter::quantize_xyzf(radius); - } else { + { // Calculate quantized IJ circle center offset. ij = GCodeFormatter::quantize(Vec2d( Geometry::ArcWelder::arc_center(prev_exact.cast(), p_exact.cast(), double(radius), it->ccw()) @@ -3112,9 +3106,7 @@ std::string GCodeGenerator::_extrude( path_length += line_length; const double dE = e_per_mm * line_length; assert(dE > 0); - gcode += emit_radius ? - m_writer.extrude_to_xy_G2G3R(p, radius, it->ccw(), dE, comment) : - m_writer.extrude_to_xy_G2G3IJ(p, ij, it->ccw(), dE, comment); + gcode += m_writer.extrude_to_xy_G2G3IJ(p, ij, it->ccw(), dE, comment); } prev = p; prev_exact = p_exact; diff --git a/src/libslic3r/GCode/GCodeWriter.cpp b/src/libslic3r/GCode/GCodeWriter.cpp index 628367e396..4afbaf1e1a 100644 --- a/src/libslic3r/GCode/GCodeWriter.cpp +++ b/src/libslic3r/GCode/GCodeWriter.cpp @@ -302,22 +302,6 @@ std::string GCodeWriter::travel_to_xy_G2G3IJ(const Vec2d &point, const Vec2d &ij return w.string(); } -std::string GCodeWriter::travel_to_xy_G2G3R(const Vec2d &point, const double radius, const bool ccw, const std::string_view comment) -{ - assert(std::abs(point.x()) < 1200.); - assert(std::abs(point.y()) < 1200.); - assert(std::abs(radius) >= 0.001); - assert(std::abs(radius) < 1800.); - - m_pos.head<2>() = point.head<2>(); - - GCodeG2G3Formatter w(ccw); - w.emit_xy(point); - w.emit_radius(radius); - w.emit_comment(this->config.gcode_comments, comment); - return w.string(); -} - std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string_view comment) { // FIXME: This function was not being used when travel_speed_z was separated (bd6badf). @@ -431,25 +415,6 @@ std::string GCodeWriter::extrude_to_xy_G2G3IJ(const Vec2d &point, const Vec2d &i return w.string(); } -std::string GCodeWriter::extrude_to_xy_G2G3R(const Vec2d &point, const double radius, const bool ccw, double dE, const std::string_view comment) -{ - assert(dE != 0); - assert(std::abs(dE) < 1000.0); - assert(std::abs(point.x()) < 1200.); - assert(std::abs(point.y()) < 1200.); - assert(std::abs(radius) >= 0.001); - assert(std::abs(radius) < 1800.); - - m_pos.head<2>() = point.head<2>(); - - GCodeG2G3Formatter w(ccw); - w.emit_xy(point); - w.emit_radius(radius); - w.emit_e(m_extrusion_axis, m_extruder->extrude(dE).second); - w.emit_comment(this->config.gcode_comments, comment); - return w.string(); -} - #if 0 std::string GCodeWriter::extrude_to_xyz(const Vec3d &point, double dE, const std::string_view comment) { diff --git a/src/libslic3r/GCode/GCodeWriter.hpp b/src/libslic3r/GCode/GCodeWriter.hpp index 1f009f0720..72fcfe357a 100644 --- a/src/libslic3r/GCode/GCodeWriter.hpp +++ b/src/libslic3r/GCode/GCodeWriter.hpp @@ -69,13 +69,11 @@ public: std::string set_speed(double F, const std::string_view comment = {}, const std::string_view cooling_marker = {}) const; std::string travel_to_xy(const Vec2d &point, const std::string_view comment = {}); std::string travel_to_xy_G2G3IJ(const Vec2d &point, const Vec2d &ij, const bool ccw, const std::string_view comment = {}); - std::string travel_to_xy_G2G3R(const Vec2d &point, const double radius, const bool ccw, const std::string_view comment = {}); std::string travel_to_xyz(const Vec3d &point, const std::string_view comment = {}); std::string travel_to_z(double z, const std::string_view comment = {}); bool will_move_z(double z) const; std::string extrude_to_xy(const Vec2d &point, double dE, const std::string_view comment = {}); std::string extrude_to_xy_G2G3IJ(const Vec2d &point, const Vec2d &ij, const bool ccw, double dE, const std::string_view comment); - std::string extrude_to_xy_G2G3R(const Vec2d &point, const double radius, const bool ccw, double dE, const std::string_view comment); // std::string extrude_to_xyz(const Vec3d &point, double dE, const std::string_view comment = {}); std::string retract(bool before_wipe = false); std::string retract_for_toolchange(bool before_wipe = false); @@ -195,12 +193,6 @@ public: this->emit_axis('J', point.y(), XYZF_EXPORT_DIGITS); } - // Positive radius means a smaller arc, - // negative radius means a larger arc. - void emit_radius(const double radius) { - this->emit_axis('R', radius, XYZF_EXPORT_DIGITS); - } - void emit_e(const std::string_view axis, double v) { if (! axis.empty()) { // not gcfNoExtrusion diff --git a/src/libslic3r/GCode/Wipe.cpp b/src/libslic3r/GCode/Wipe.cpp index fa726424e9..fd7cacd0bf 100644 --- a/src/libslic3r/GCode/Wipe.cpp +++ b/src/libslic3r/GCode/Wipe.cpp @@ -116,16 +116,15 @@ std::string Wipe::wipe(GCodeGenerator &gcodegen, bool toolchange) retract_length -= dE; return done; }; - const bool emit_radius = gcodegen.config().arc_fitting == ArcFittingType::EmitRadius; - auto wipe_arc = [&gcode, &gcodegen, &retract_length, xy_to_e, emit_radius, &wipe_linear]( + auto wipe_arc = [&gcode, &gcodegen, &retract_length, xy_to_e, &wipe_linear]( const Vec2d &prev_quantized, Vec2d &p, double radius_in, const bool ccw) { Vec2d p_quantized = GCodeFormatter::quantize(p); if (p_quantized == prev_quantized) { p = p_quantized; return false; } - // Only quantize radius if emitting it directly into G-code. Otherwise use the exact radius for calculating the IJ values. - double radius = emit_radius ? GCodeFormatter::quantize_xyzf(radius_in) : radius_in; + // Use the exact radius for calculating the IJ values, no quantization. + double radius = radius_in; if (radius == 0) // Degenerated arc after quantization. Process it as if it was a line segment. return wipe_linear(prev_quantized, p); @@ -151,9 +150,7 @@ std::string Wipe::wipe(GCodeGenerator &gcodegen, bool toolchange) } else p = p_quantized; assert(dE > 0); - if (emit_radius) { - gcode += gcodegen.writer().extrude_to_xy_G2G3R(p, radius, ccw, -dE, wipe_retract_comment); - } else { + { // Calculate quantized IJ circle center offset. Vec2d ij = GCodeFormatter::quantize(Vec2d(center - prev_quantized)); if (ij == Vec2d::Zero()) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index c38ae76269..c03dd58e6e 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -59,8 +59,7 @@ static t_config_enum_names enum_names_from_keys_map(const t_config_enum_values & static const t_config_enum_values s_keys_map_ArcFittingType { { "disabled", int(ArcFittingType::Disabled) }, - { "emit_center", int(ArcFittingType::EmitCenter) }, - { "emit_radius", int(ArcFittingType::EmitRadius) } + { "emit_center", int(ArcFittingType::EmitCenter) } }; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(ArcFittingType) @@ -441,8 +440,7 @@ void PrintConfigDef::init_fff_params() "G-code resolution will be used as the fitting tolerance."); def->set_enum({ { "disabled", "Disabled" }, - { "emit_center", "Enabled: G2/3 I J" }, - { "emit_radius", "Enabled: G2/3 R" } + { "emit_center", "Enabled: G2/3 I J" } }); def->mode = comAdvanced; def->set_default_value(new ConfigOptionEnum(ArcFittingType::Disabled)); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 97c2d89d40..a337ca53f1 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -49,8 +49,7 @@ namespace Slic3r { enum class ArcFittingType { Disabled, - EmitCenter, - EmitRadius, + EmitCenter }; enum GCodeFlavor : unsigned char { From 4db4c0740a6cf45a8a4c9c07e2fca054de50ca16 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Tue, 17 Oct 2023 15:12:34 +0200 Subject: [PATCH 4/7] TRN comments --- src/slic3r/GUI/WifiConfigDialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/WifiConfigDialog.cpp b/src/slic3r/GUI/WifiConfigDialog.cpp index dc11bfdfdd..b2294df8e7 100644 --- a/src/slic3r/GUI/WifiConfigDialog.cpp +++ b/src/slic3r/GUI/WifiConfigDialog.cpp @@ -36,6 +36,7 @@ WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, Rem m_ssid_combo->SetToolTip(_L("On some versions of MacOS, this only loads SSID of connencted network.")); #endif // __APPLE__ rescan_networks(false); + // TRN Text of button to rescan visible networks in Wifi Config dialog. wxButton* ssid_button = new wxButton(panel, wxID_ANY, _(L("Rescan"))); ssid_sizer->Add(m_ssid_combo, 1, wxALIGN_CENTER_VERTICAL, 10); ssid_sizer->Add(ssid_button, 0); @@ -46,6 +47,7 @@ WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, Rem m_pass_textctrl = new wxTextCtrl(panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize); pass_sizer->Add(m_pass_textctrl, 1, wxALIGN_CENTER_VERTICAL, 10); #if __APPLE__ + // TRN Text of button to retrieve password from keychain in Wifi Config dialog. Only on Mac. wxButton* pass_button = new wxButton(panel, wxID_ANY, _(L("Retrieve"))); pass_sizer->Add(pass_button, 0); pass_button->Bind(wxEVT_BUTTON, &WifiConfigDialog::on_retrieve_password, this); @@ -57,11 +59,13 @@ WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, Rem // TRN description of Combo Box with path to USB drive. wxStaticText* drive_label = new wxStaticText(panel, wxID_ANY, GUI::format_wxstr("%1%:", _L("Drive"))); m_drive_combo = new wxComboBox(panel, wxID_ANY); - rescan_drives(); + rescan_drives(preffered_drive); + // TRN Text of button to rescan connect usb drives in Wifi Config dialog. wxButton* drive_button = new wxButton(panel, wxID_ANY, _(L("Rescan"))); drive_sizer->Add(m_drive_combo, 1, wxALIGN_CENTER_VERTICAL, 10); drive_sizer->Add(drive_button, 0); + // TRN Text of button to write config file in Wifi Config dialog. wxButton* ok_button = new wxButton(panel, wxID_OK, _L("Write")); wxButton* cancel_button = new wxButton(panel, wxID_CANCEL); From e2cbc3d4e47374a08a49596a64c9ab334299a8b9 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Wed, 18 Oct 2023 09:06:25 +0200 Subject: [PATCH 5/7] fix of 4db4c0740a6cf45a8a4c9c07e2fca054de50ca16 --- src/slic3r/GUI/WifiConfigDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/WifiConfigDialog.cpp b/src/slic3r/GUI/WifiConfigDialog.cpp index b2294df8e7..70b5009c7d 100644 --- a/src/slic3r/GUI/WifiConfigDialog.cpp +++ b/src/slic3r/GUI/WifiConfigDialog.cpp @@ -59,7 +59,7 @@ WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, Rem // TRN description of Combo Box with path to USB drive. wxStaticText* drive_label = new wxStaticText(panel, wxID_ANY, GUI::format_wxstr("%1%:", _L("Drive"))); m_drive_combo = new wxComboBox(panel, wxID_ANY); - rescan_drives(preffered_drive); + rescan_drives(); // TRN Text of button to rescan connect usb drives in Wifi Config dialog. wxButton* drive_button = new wxButton(panel, wxID_ANY, _(L("Rescan"))); drive_sizer->Add(m_drive_combo, 1, wxALIGN_CENTER_VERTICAL, 10); From e0331d135174c13a98461aba7782f195dcc66b3b Mon Sep 17 00:00:00 2001 From: David Kocik Date: Wed, 18 Oct 2023 09:59:06 +0200 Subject: [PATCH 6/7] Wifi config file explanation text. --- src/slic3r/GUI/GUI_App.cpp | 2 +- src/slic3r/GUI/WifiConfigDialog.cpp | 13 +++++++++++++ src/slic3r/Utils/WifiScanner.cpp | 1 - 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index e8905b2f87..41745e843c 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2448,7 +2448,7 @@ void GUI_App::add_config_menu(wxMenuBar *menu) // TODO: for when we're able to flash dictionaries // local_menu->Append(config_id_base + FirmwareMenuDict, _L("Flash Language File"), _L("Upload a language dictionary file into a Prusa printer")); } - local_menu->Append(config_id_base + ConfigMenuWifiConfigFile, _L("Wi-Fi Configuration File"), _L("Generate a file to be loaded by a Prusa printer to configure a Wi-Fi connection.")); + local_menu->Append(config_id_base + ConfigMenuWifiConfigFile, _L("Wi-Fi Configuration File"), _L("Generate a file to be loaded by a Prusa printer to configure its Wi-Fi connection.")); local_menu->Bind(wxEVT_MENU, [this, config_id_base](wxEvent &event) { switch (event.GetId() - config_id_base) { diff --git a/src/slic3r/GUI/WifiConfigDialog.cpp b/src/slic3r/GUI/WifiConfigDialog.cpp index 70b5009c7d..f26aed45b2 100644 --- a/src/slic3r/GUI/WifiConfigDialog.cpp +++ b/src/slic3r/GUI/WifiConfigDialog.cpp @@ -28,6 +28,15 @@ WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, Rem wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL); panel->SetSizer(vsizer); + // TRN Wifi config dialog explanation line 1. + wxStaticText* explain_label1 = new wxStaticText(panel, wxID_ANY, _L("Generate a file to be loaded by a Prusa printer to configure its Wi-Fi connection.")); + // TRN Wifi config dialog explanation line 2. + wxStaticText* explain_label2 = new wxStaticText(panel, wxID_ANY, _L("Write this file on a USB flash drive. Its name will be prusa_printer_settings.ini.")); + // TRN Wifi config dialog explanation line 3. + wxStaticText* explain_label3 = new wxStaticText(panel, wxID_ANY, _L("Your Prusa Printer should load this file automatically.")); + // TRN Wifi config dialog explanation line 4. + wxStaticText* explain_label4 = new wxStaticText(panel, wxID_ANY, _L("Note: This file will contains SSID and password in plain text.")); + auto* ssid_sizer = new wxBoxSizer(wxHORIZONTAL); // TRN SSID of WiFi network. wxStaticText* ssid_label = new wxStaticText(panel, wxID_ANY, GUI::format_wxstr("%1%:", _L("SSID"))); @@ -81,6 +90,10 @@ WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, Rem grid->Add(drive_label, 0, wxALIGN_CENTER_VERTICAL); grid->Add(drive_sizer, 0, wxEXPAND); + vsizer->Add(explain_label1, 0, wxALIGN_CENTER_VERTICAL); + vsizer->Add(explain_label2, 0, wxALIGN_CENTER_VERTICAL); + vsizer->Add(explain_label3, 0, wxALIGN_CENTER_VERTICAL); + vsizer->Add(explain_label4, 0, wxALIGN_CENTER_VERTICAL); vsizer->Add(grid, 0, wxEXPAND | wxTOP | wxBOTTOM, 15); wxBoxSizer* buttons_sizer = new wxBoxSizer(wxHORIZONTAL); diff --git a/src/slic3r/Utils/WifiScanner.cpp b/src/slic3r/Utils/WifiScanner.cpp index 3282784afb..be5f6d5f33 100644 --- a/src/slic3r/Utils/WifiScanner.cpp +++ b/src/slic3r/Utils/WifiScanner.cpp @@ -144,7 +144,6 @@ void fill_wifi_map(Slic3r::WifiSsidPskMap& wifi_map, std::string& connected_ssid wxString xml(xmlstr); boost::property_tree::ptree pt; std::stringstream ss(boost::nowide::narrow(xml)); - BOOST_LOG_TRIVIAL(error) << ss.str(); boost::property_tree::read_xml(ss, pt); std::string password; std::string psk_protected; From 44376443ea6e7264fbb082ed9b88b96b9a6b7e1f Mon Sep 17 00:00:00 2001 From: David Kocik Date: Wed, 18 Oct 2023 10:21:35 +0200 Subject: [PATCH 7/7] Change dialog headline --- src/slic3r/GUI/WifiConfigDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/WifiConfigDialog.cpp b/src/slic3r/GUI/WifiConfigDialog.cpp index f26aed45b2..63af0ff5c5 100644 --- a/src/slic3r/GUI/WifiConfigDialog.cpp +++ b/src/slic3r/GUI/WifiConfigDialog.cpp @@ -17,7 +17,7 @@ namespace Slic3r { namespace GUI { WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, RemovableDriveManager* removable_manager) - : DPIDialog(parent, wxID_ANY, _L("Physical Printer Instalation"), wxDefaultPosition, wxDefaultSize/*wxSize(25 * wxGetApp().em_unit(), 20 * wxGetApp().em_unit())*/, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) + : DPIDialog(parent, wxID_ANY, _L("Wi-Fi Configuration File Generator"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) , m_wifi_scanner(new WifiScanner()) , out_file_path(file_path) , m_removable_manager(removable_manager)