From efedf8b3198c6f1ae47ab182f9d60f59c1e0c62c Mon Sep 17 00:00:00 2001 From: "hu.wang" Date: Wed, 8 Nov 2023 15:04:46 +0800 Subject: [PATCH] FIX:User preset material settings dependent on firmware JIRA: 5167 Change-Id: I82cf26848594b01155883ad0aa2e9ee77d371fb2 --- resources/printers/BL-P001.json | 8 +++++++- resources/printers/BL-P002.json | 8 +++++++- resources/printers/C11.json | 1 + resources/printers/C12.json | 1 + resources/printers/C13.json | 1 + resources/printers/N1.json | 1 + resources/printers/version.txt | 2 +- src/slic3r/GUI/AMSMaterialsSetting.cpp | 8 ++++++-- src/slic3r/GUI/DeviceManager.cpp | 6 ++++++ src/slic3r/GUI/DeviceManager.hpp | 1 + 10 files changed, 32 insertions(+), 5 deletions(-) diff --git a/resources/printers/BL-P001.json b/resources/printers/BL-P001.json index 8584d6618..fbdea5d75 100644 --- a/resources/printers/BL-P001.json +++ b/resources/printers/BL-P001.json @@ -37,7 +37,8 @@ "support_ai_monitoring":false, "support_first_layer_inspect":true, "support_chamber_temp_edit":false, - "support_extrusion_cali":false + "support_extrusion_cali":false, + "support_user_preset":false }, "model_id":"BL-P001", "compatible_machine":["BL-P002", "C11", "C12", "C13"], @@ -78,5 +79,10 @@ "print": { "support_tunnel_mqtt":true } + }, + "01.06.06.00": { + "print": { + "support_user_preset":true + } } } \ No newline at end of file diff --git a/resources/printers/BL-P002.json b/resources/printers/BL-P002.json index 4955fe450..286e55271 100644 --- a/resources/printers/BL-P002.json +++ b/resources/printers/BL-P002.json @@ -37,7 +37,8 @@ "support_ai_monitoring":false, "support_first_layer_inspect":true, "support_chamber_temp_edit":false, - "support_extrusion_cali":false + "support_extrusion_cali":false, + "support_user_preset":false }, "model_id": "BL-P002", "compatible_machine":["BL-P001", "C11", "C12", "C13"], @@ -78,5 +79,10 @@ "print": { "support_tunnel_mqtt":true } + }, + "01.06.06.00": { + "print": { + "support_user_preset":true + } } } \ No newline at end of file diff --git a/resources/printers/C11.json b/resources/printers/C11.json index f7d6411be..241c50347 100644 --- a/resources/printers/C11.json +++ b/resources/printers/C11.json @@ -33,6 +33,7 @@ "support_first_layer_inspect":false, "support_chamber_temp_edit":false, "support_extrusion_cali":true, + "support_user_preset":false, "bed_temperature_limit": 100 }, "model_id": "C11", diff --git a/resources/printers/C12.json b/resources/printers/C12.json index eec74ff90..18d1bd5f9 100644 --- a/resources/printers/C12.json +++ b/resources/printers/C12.json @@ -33,6 +33,7 @@ "support_first_layer_inspect":false, "support_chamber_temp_edit":false, "support_extrusion_cali":true, + "support_user_preset":false, "bed_temperature_limit": 100 }, "model_id": "C12", diff --git a/resources/printers/C13.json b/resources/printers/C13.json index 02957cadd..c8bce2ad6 100644 --- a/resources/printers/C13.json +++ b/resources/printers/C13.json @@ -39,6 +39,7 @@ "support_first_layer_inspect":true, "support_chamber_temp_edit":true, "support_extrusion_cali":false, + "support_user_preset":false, "bed_temperature_limit": 110, "nozzle_max_temperature": 320 }, diff --git a/resources/printers/N1.json b/resources/printers/N1.json index 0fd1c6fdc..dea9edfa0 100644 --- a/resources/printers/N1.json +++ b/resources/printers/N1.json @@ -34,6 +34,7 @@ "support_first_layer_inspect":false, "support_chamber_temp_edit":false, "support_extrusion_cali":true, + "support_user_preset":false, "bed_temperature_limit": 100 }, "model_id": "N1", diff --git a/resources/printers/version.txt b/resources/printers/version.txt index c30aa24cd..8e3f706a5 100644 --- a/resources/printers/version.txt +++ b/resources/printers/version.txt @@ -1 +1 @@ -01.08.00.01 +01.08.00.02 \ No newline at end of file diff --git a/src/slic3r/GUI/AMSMaterialsSetting.cpp b/src/slic3r/GUI/AMSMaterialsSetting.cpp index cfbec086b..331ee254d 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.cpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.cpp @@ -762,6 +762,7 @@ bool AMSMaterialsSetting::Show(bool show) void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_min, wxString temp_max, wxString k, wxString n) { + if (!obj) return; update_widgets(); // set default value if (k.IsEmpty()) @@ -784,7 +785,10 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi for (auto filament_it = preset_bundle->filaments.begin(); filament_it != preset_bundle->filaments.end(); filament_it++) { //filter by system preset Preset& preset = *filament_it; - if (preset_bundle->filaments.get_preset_base(*filament_it) != &preset) { + /*The situation where the user preset is not displayed is as follows: + 1. Not a root preset + 2. Not system preset and the printer firmware does not support user preset */ + if (preset_bundle->filaments.get_preset_base(*filament_it) != &preset || (!filament_it->is_system && !obj->is_support_user_preset)) { continue; } @@ -794,7 +798,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi // get printer_model ConfigOption* printer_model_opt = printer_it->config.option("printer_model"); ConfigOptionString* printer_model_str = dynamic_cast(printer_model_opt); - if (!printer_model_str || !obj) + if (!printer_model_str ) continue; // use printer_model as printer type diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 6b5495c63..c35b570bd 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -2961,6 +2961,12 @@ int MachineObject::parse_json(std::string payload) } } + if (jj.contains("support_user_preset")) { + if (jj["support_user_preset"].is_boolean()) { + is_support_user_preset = jj["support_user_preset"].get(); + } + } + if (jj.contains("nozzle_max_temperature")) { if (jj["nozzle_max_temperature"].is_number_integer()) { nozzle_max_temperature = jj["nozzle_max_temperature"].get(); diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index bf2387d14..95d389adc 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -736,6 +736,7 @@ public: bool is_support_tunnel_mqtt{false}; bool is_support_motor_noise_cali{false}; bool is_support_wait_sending_finish{false}; + bool is_support_user_preset{false}; int nozzle_max_temperature = -1; int bed_temperature_limit = -1;