From 4a7ac79637a88b14365325b3cf2e5a79dae1a38d Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Fri, 19 Nov 2021 15:32:33 +0100 Subject: [PATCH] Generalize PrusaLink --- src/slic3r/GUI/PhysicalPrinterDialog.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index 3d528df4b..b2983f97f 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -528,16 +528,21 @@ void PhysicalPrinterDialog::update_host_type(bool printer_change) std::string preset_name = prstft->get_preset_name(); if (Preset* preset = wxGetApp().preset_bundle->printers.find_preset(preset_name)) { std::string model_id = preset->config.opt_string("printer_model"); - if (preset->vendor && preset->vendor->name == "Prusa Research") { - const std::vector& models = preset->vendor->models; - auto it = std::find_if(models.begin(), models.end(), - [model_id](const VendorProfile::PrinterModel& model) { return model.id == model_id; }); - if (it != models.end() && (it->family == "MK3" || it->family == "MINI")) - continue; - } else if (!preset->vendor && (boost::starts_with(model_id, "MK3") || boost::starts_with(model_id, "MINI"))) { + auto model_supports_prusalink = [](const std::string &model) { + return model.size() >= 3 && + ((boost::starts_with(model, "MK") && model[2] > '2' && model[2] <= '9') || + boost::starts_with(model, "MINI")); + }; + if (preset->vendor) { + if (preset->vendor->name == "Prusa Research") { + const std::vector& models = preset->vendor->models; + auto it = std::find_if(models.begin(), models.end(), + [model_id](const VendorProfile::PrinterModel& model) { return model.id == model_id; }); + if (it != models.end() && model_supports_prusalink(it->family)) + continue; + } + } else if (model_supports_prusalink(model_id)) continue; - } - } all_presets_are_from_mk3_family = false; break;