diff --git a/resources/config.json b/resources/config.json index 8cf18193b6..cc1b3eb565 100644 --- a/resources/config.json +++ b/resources/config.json @@ -79,9 +79,9 @@ { "display_name": "Bambu Lab X1", "func": { + "FUNC_CHAMBER_TEMP": false, "FUNC_VIRTUAL_TYAY": true, - "FUNC_EXTRUSION_CALI": false, - "FUNC_LOCAL_TUNNEL": false + "FUNC_EXTRUSION_CALI": false }, "model_id": "BL-P002", "compatible_machine": [ "BL-P001", "C11", "C12"], @@ -92,6 +92,7 @@ { "display_name": "Bambu Lab X1 Carbon", "func": { + "FUNC_CHAMBER_TEMP": false, "FUNC_VIRTUAL_TYAY": true, "FUNC_EXTRUSION_CALI": false, "FUNC_LOCAL_TUNNEL": false diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 637d58edb1..9dd65526e6 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -465,6 +465,7 @@ MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string bed_temp = 0.0f; bed_temp_target = 0.0f; chamber_temp = 0.0f; + chamber_temp_target = 0; frame_temp = 0.0f; /* ams fileds */ @@ -1744,6 +1745,12 @@ int MachineObject::command_set_nozzle(int temp) return this->publish_gcode(gcode_str); } +int MachineObject::command_set_chamber(int temp) +{ + std::string gcode_str = (boost::format("M141 S%1%\n") % temp).str(); + return this->publish_gcode(gcode_str); +} + int MachineObject::command_ams_switch(int tray_index, int old_temp, int new_temp) { BOOST_LOG_TRIVIAL(trace) << "ams_switch to " << tray_index << " with temp: " << old_temp << ", " << new_temp; @@ -3011,6 +3018,11 @@ int MachineObject::parse_json(std::string payload) chamber_temp = jj["chamber_temper"].get(); } } + if (jj.contains("ctt")) { + if (jj["ctt"].is_number()) { + chamber_temp_target = jj["ctt"].get(); + } + } /* signals */ if (jj.contains("link_th_state")) link_th = jj["link_th_state"].get(); @@ -5187,6 +5199,22 @@ bool DeviceManager::get_bed_temperature_limit(std::string type_str, int &limit) return result; } +bool DeviceManager::get_nozzle_max_temperature(std::string type_str, int& limit) +{ + bool result = false; + if (DeviceManager::function_table.contains("printers")) { + for (auto printer : DeviceManager::function_table["printers"]) { + if (printer.contains("model_id") && printer["model_id"].get() == type_str) { + if (printer.contains("nozzle_max_temperature")) { + limit = printer["nozzle_max_temperature"].get(); + return true; + } + } + } + } + return result; +} + bool DeviceManager::load_functional_config(std::string config_file) { std::ifstream json_file(config_file.c_str()); diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index ecb74827ba..7adf6ba2f4 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -556,6 +556,7 @@ public: float bed_temp; float bed_temp_target; float chamber_temp; + int chamber_temp_target; float frame_temp; /* cooling */ @@ -793,6 +794,7 @@ public: int command_task_resume(); int command_set_bed(int temp); int command_set_nozzle(int temp); + int command_set_chamber(int temp); // ams controls int command_ams_switch(int tray_index, int old_temp = 210, int new_temp = 210); int command_ams_change_filament(int tray_id, int old_temp = 210, int new_temp = 210); @@ -958,6 +960,7 @@ public: static std::vector get_resolution_supported(std::string type_str); static bool get_bed_temperature_limit(std::string type_str, int& limit); + static bool get_nozzle_max_temperature(std::string type_str, int& limit); static bool load_functional_config(std::string config_file); static bool load_filaments_blacklist_config(std::string config_file); static void check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, bool& in_blacklist, std::string& ac, std::string& info); diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index a57f3c9c70..42315be947 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -2295,10 +2295,10 @@ void StatusPanel::update_ams(MachineObject *obj) m_ams_control->show_auto_refill(false); } else { - if (obj->printer_type == "N1") { m_ams_control->SetAmsModel(AMSModel::EXTRA_AMS); } - else { m_ams_control->SetAmsModel(AMSModel::GENERIC_AMS); } + if (obj->printer_type == "N1") { ams_mode = AMSModel::EXTRA_AMS; } + m_ams_control->SetAmsModel(ams_mode, ams_mode); - show_ams_group(true, obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY), obj->is_support_filament_edit_virtual_tray); + show_ams_group(true); if (!obj->m_is_support_show_bak || !is_support_filament_backup || !obj->ams_support_auto_switch_filament_flag) { m_ams_control->show_auto_refill(false);