mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-03 10:00:41 +08:00
Changed filtering of Prusa models to support all new future models.
This commit is contained in:
parent
de32b37a84
commit
2d65803057
@ -703,6 +703,7 @@ void PhysicalPrinterDialog::update_host_type(bool printer_change)
|
|||||||
bool supported { true };
|
bool supported { true };
|
||||||
wxString label;
|
wxString label;
|
||||||
} link, connect;
|
} link, connect;
|
||||||
|
#if 0 // Functions replaced with model_supports_prusa_service as all new printers will support both services.
|
||||||
// allowed models are: all MINI, all MK3 and newer, MK2.5 and MK2.5S
|
// allowed models are: all MINI, all MK3 and newer, MK2.5 and MK2.5S
|
||||||
auto model_supports_prusalink = [](const std::string& model) {
|
auto model_supports_prusalink = [](const std::string& model) {
|
||||||
return model.size() >= 2 &&
|
return model.size() >= 2 &&
|
||||||
@ -725,24 +726,32 @@ void PhysicalPrinterDialog::update_host_type(bool printer_change)
|
|||||||
|| boost::starts_with(model, "CORE")
|
|| boost::starts_with(model, "CORE")
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
#endif // 0
|
||||||
|
auto model_supports_prusa_service = [](const std::string& model) {
|
||||||
|
// We used to name all supported services, which causes headache with each now model line
|
||||||
|
// The only unsupported models are MK2 variants (MK2.5 is supported)
|
||||||
|
if (boost::starts_with(model, "MK2") && !boost::starts_with(model, "MK2.5")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
// set all_presets_are_prusalink_supported
|
// set all_presets_are_prusalink_supported
|
||||||
for (PresetForPrinter* prstft : m_presets) {
|
for (PresetForPrinter* prstft : m_presets) {
|
||||||
std::string preset_name = prstft->get_preset_name();
|
std::string preset_name = prstft->get_preset_name();
|
||||||
if (Preset* preset = wxGetApp().preset_bundle->printers.find_preset(preset_name)) {
|
if (Preset* preset = wxGetApp().preset_bundle->printers.find_preset(preset_name)) {
|
||||||
std::string model_id = preset->config.opt_string("printer_model");
|
std::string model_id = preset->config.opt_string("printer_model");
|
||||||
if (preset->vendor) {
|
const PresetWithVendorProfile& printer_with_vendor = wxGetApp().preset_bundle->printers.get_preset_with_vendor_profile(*preset);
|
||||||
std::string model_id_no_pref = preset->trim_vendor_repo_prefix(model_id);
|
std::string model_id_no_pref = preset->trim_vendor_repo_prefix(model_id, printer_with_vendor.vendor);
|
||||||
if (preset->vendor->name.find("Prusa Research") != std::string::npos) {
|
if (printer_with_vendor.vendor) {
|
||||||
const std::vector<VendorProfile::PrinterModel>& models = preset->vendor->models;
|
if (printer_with_vendor.vendor->name.find("Prusa Research") != std::string::npos) {
|
||||||
|
const std::vector<VendorProfile::PrinterModel>& models = printer_with_vendor.vendor->models;
|
||||||
auto it = std::find_if(models.begin(), models.end(),
|
auto it = std::find_if(models.begin(), models.end(),
|
||||||
[model_id](const VendorProfile::PrinterModel& model) { return model.id == model_id; });
|
[model_id](const VendorProfile::PrinterModel& model) { return model.id == model_id; });
|
||||||
if (it != models.end() && model_supports_prusalink(model_id_no_pref))
|
if (it != models.end() && model_supports_prusa_service(model_id_no_pref))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (model_supports_prusalink(model_id))
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
link.supported = false;
|
link.supported = false;
|
||||||
break;
|
break;
|
||||||
@ -757,13 +766,14 @@ void PhysicalPrinterDialog::update_host_type(bool printer_change)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
std::string model_id = preset->config.opt_string("printer_model");
|
std::string model_id = preset->config.opt_string("printer_model");
|
||||||
model_id = preset->trim_vendor_repo_prefix(model_id);
|
const PresetWithVendorProfile& printer_with_vendor = wxGetApp().preset_bundle->printers.get_preset_with_vendor_profile(*preset);
|
||||||
if (preset->vendor && preset->vendor->name.find("Prusa Research") == std::string::npos) {
|
model_id = preset->trim_vendor_repo_prefix(model_id, printer_with_vendor.vendor);
|
||||||
|
if (!printer_with_vendor.vendor || printer_with_vendor.vendor->name.find("Prusa Research") == std::string::npos) {
|
||||||
connect.supported = false;
|
connect.supported = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// model id should be enough for this case
|
// model id should be enough for this case
|
||||||
if (!model_supports_prusaconnect(model_id)) {
|
if (!model_supports_prusa_service(model_id)) {
|
||||||
connect.supported = false;
|
connect.supported = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user