update slic3r

This commit is contained in:
QIDI TECH
2025-08-04 16:30:53 +08:00
parent 8d4d60ec48
commit 661b112a68
287 changed files with 22250 additions and 7322 deletions

View File

@@ -250,6 +250,11 @@ struct AirMode
// If the fan is off, it cannot be controlled and is displayed as off
std::vector<int> off;
// If the fan is not off or ctrl, it will be displayed as auto
public:
bool operator ==(const AirMode& other) const {
return (id == other.id) && (ctrl == other.ctrl) && (off == other.off);
};
};
struct AirParts
@@ -260,6 +265,11 @@ struct AirParts
int state{ 0 };// 100%
int range_start{ 0 };// 100%
int range_end{ 0 };// 100%
public:
bool operator ==(const AirParts& other) const {
return (type == other.type) && (id == other.id) && (func == other.func) && (state == other.state) && (range_start == other.range_start) && (range_end == other.range_end);
};
};
struct AirDuctData
@@ -267,6 +277,22 @@ struct AirDuctData
int curren_mode{ 0 };
std::unordered_map<int, AirMode> modes;
std::vector<AirParts> parts;
int m_sub_mode = -1;// the submode of airduct, for cooling: 0-filter, 1-cooling
bool m_support_cooling_filter = false;// support switch filter on cooling mode or not
public:
bool operator ==(const AirDuctData& other) const {
return (curren_mode == other.curren_mode) && (modes == other.modes) && (parts == other.parts) &&
(m_sub_mode == other.m_sub_mode) && (m_support_cooling_filter == other.m_support_cooling_filter);
};
bool operator !=(const AirDuctData& other) const {
return !(operator==(other));
};
bool IsSupportCoolingFilter() const { return m_support_cooling_filter;}
bool IsCoolingFilerOn() const { return m_sub_mode == 0;}
};
struct RatingInfo {
@@ -484,7 +510,6 @@ enum AIR_DUCT {
AIR_DUCT_HEATING_INTERNAL_FILT,
AIR_DUCT_EXHAUST,
AIR_DUCT_FULL_COOLING,
AIR_DUCT_NUM,
AIR_DUCT_INIT = 0xFF //Initial mode, only used within mc
};
@@ -668,6 +693,7 @@ public:
//PRINTER_TYPE printer_type = PRINTER_3DPrinter_UKNOWN;
std::string printer_type; /* model_id */
std::string get_show_printer_type() const;
PrinterSeries get_printer_series() const;
PrinterArch get_printer_arch() const;
std::string get_printer_ams_type() const;
@@ -771,6 +797,7 @@ public:
AmsTray *get_ams_tray(std::string ams_id, std::string tray_id);
std::string get_filament_id(std::string ams_id, std::string tray_id) const;
std::string get_filament_type(const std::string& ams_id, const std::string& tray_id) const;
// parse amsStatusMain and ams_status_sub
void _parse_ams_status(int ams_status);
@@ -819,6 +846,7 @@ public:
[[nodiscard]] bool is_nozzle_flow_type_supported() const { return is_enable_np; };
[[nodiscard]] NozzleFlowType get_nozzle_flow_type(int extruder_id) const;
[[nodiscard]] Extder get_current_extruder() const;
[[nodiscard]] wxString get_nozzle_replace_url() const;
//new fan data
AirDuctData m_air_duct_data;
@@ -1033,9 +1061,21 @@ public:
int nozzle_setting_hold_count = 0;
//refine printer
bool xcam_ai_monitoring{ false };
bool xcam_disable_ai_detection_display{false};
bool xcam_spaghetti_detection{false};
bool xcam_purgechutepileup_detection{false};
bool xcam_nozzleclumping_detection{false};
bool xcam_airprinting_detection{false};
time_t xcam_ai_monitoring_hold_start = 0;
std::string xcam_ai_monitoring_sensitivity;
std::string xcam_spaghetti_detection_sensitivity;
std::string xcam_purgechutepileup_detection_sensitivity;
std::string xcam_nozzleclumping_detection_sensitivity;
std::string xcam_airprinting_detection_sensitivity;
bool xcam_buildplate_marker_detector{ false };
time_t xcam_buildplate_marker_hold_start = 0;
bool xcam_auto_recovery_step_loss{ false };
@@ -1047,6 +1087,9 @@ public:
int nozzle_selected_count = 0;
bool flag_update_nozzle = {true};
// part skip
std::vector<int> m_partskip_ids;
/*target from Studio-SwitchBoard, default to INVALID_NOZZLE_ID if no switching control from PC*/
int targ_nozzle_id_from_pc = INVALID_NOZZLE_ID;
@@ -1055,7 +1098,7 @@ public:
bool is_support_extrusion_cali{false};
bool is_support_first_layer_inspect{false};
bool is_support_ai_monitoring {false};
bool is_support_lidar_calibration {false};
bool is_support_lidar_calibration {false};// the lidar calibration for 3D Studio
bool is_support_build_plate_marker_detect{false};
PlateMakerDectect m_plate_maker_detect_type{ POS_CHECK };
@@ -1096,6 +1139,14 @@ public:
bool is_support_internal_timelapse { false };// fun[28], support timelapse without SD card
bool is_support_command_homing { false };// fun[32]
bool is_support_brtc{false}; // fun[31], support tcp and upload protocol
bool is_support_ext_change_assist{false};
bool is_support_partskip{false};
// refine printer function options
bool is_support_spaghetti_detection{false};
bool is_support_purgechutepileup_detection{false};
bool is_support_nozzleclumping_detection{false};
bool is_support_airprinting_detection{false};
bool installed_upgrade_kit{false};
int bed_temperature_limit = -1;
@@ -1199,9 +1250,10 @@ public:
int command_go_home2();
int command_control_fan(int fan_type, int val); // Old protocol
int command_control_fan_new(int fan_id, int val, const CommandCallBack &cb); // New protocol
int command_control_air_duct(int mode_id, const CommandCallBack& cb);
int command_control_air_duct(int mode_id, int submode, const CommandCallBack& cb);
int command_task_abort();
/* cancelled the job_id */
int command_task_partskip(std::vector<int> part_ids);
int command_task_cancel(std::string job_id);
int command_task_pause();
int command_task_resume();
@@ -1213,7 +1265,9 @@ public:
int command_stop_buzzer();
/* temp*/
bool m_support_mqtt_bet_ctrl = false;
int command_set_bed(int temp);
int command_set_nozzle(int temp);
int command_set_nozzle_new(int nozzle_id, int temp);
int command_set_chamber(int temp);
@@ -1253,6 +1307,7 @@ public:
int command_nozzle_blob_detect(bool nozzle_blob_detect);
// axis string is X, Y, Z, E
bool m_support_mqtt_axis_control = false;
int command_axis_control(std::string axis, double unit = 1.0f, double input_val = 1.0f, int speed = 3000);
int command_extruder_control(int nozzle_id, double val);
@@ -1281,7 +1336,14 @@ public:
int command_ipcam_timelapse(bool on_off);
int command_ipcam_resolution_set(std::string resolution);
int command_xcam_control(std::string module_name, bool on_off, std::string lvl = "");
//refine printer
int command_xcam_control_ai_monitoring(bool on_off, std::string lvl);
int command_xcam_control_spaghetti_detection(bool on_off, std::string lvl);
int command_xcam_control_purgechutepileup_detection(bool on_off, std::string lvl);
int command_xcam_control_nozzleclumping_detection(bool on_off, std::string lvl);
int command_xcam_control_airprinting_detection(bool on_off, std::string lvl);
int command_xcam_control_first_layer_inspector(bool on_off, bool print_halt);
int command_xcam_control_buildplate_marker_detector(bool on_off);
int command_xcam_control_auto_recovery_step_loss(bool on_off);
@@ -1319,7 +1381,8 @@ public:
/* Msg for display MsgFn */
typedef std::function<void(std::string topic, std::string payload)> MsgFn;
int publish_json(std::string json_str, int qos = 0, int flag = 0);
int publish_json(const json& json_item, int qos = 0, int flag = 0) ;
int publish_json(const std::string& json_str, int qos = 0, int flag = 0) = delete;
int cloud_publish_json(std::string json_str, int qos = 0, int flag = 0);
int local_publish_json(std::string json_str, int qos = 0, int flag = 0);
int parse_json(std::string tunnel, std::string payload, bool key_filed_only = false);
@@ -1452,8 +1515,6 @@ public:
bool set_selected_machine(std::string dev_id, bool need_disconnect = false);
MachineObject* get_selected_machine();
void add_user_subscribe();
void del_user_subscribe();
void subscribe_device_list(std::vector<std::string> dev_list);
@@ -1505,6 +1566,32 @@ public:
return T();
}
static json get_json_from_config(const std::string& type_str, const std::string& key1, const std::string& key2 = std::string()) {
std::string config_file = Slic3r::resources_dir() + "/printers/" + type_str + ".json";
boost::nowide::ifstream json_file(config_file.c_str());
try {
json jj;
if (json_file.is_open()) {
json_file >> jj;
if (jj.contains("00.00.00.00")) {
json const& printer = jj["00.00.00.00"];
if (printer.contains(key1)) {
json const& key1_item = printer[key1];
if (key2.empty()) {
return key1_item;
}
if (key1_item.contains(key2)) {
return key1_item[key2];
}
}
}
}
}
catch (...) {}
return json();
}
static std::string parse_printer_type(std::string type_str);
static std::string get_printer_display_name(std::string type_str);
static std::string get_printer_thumbnail_img(std::string type_str);
@@ -1518,10 +1605,14 @@ public:
static bool get_printer_is_enclosed(std::string type_str);
static bool get_printer_can_set_nozzle(std::string type_str);// can set nozzle from studio
static bool load_filaments_blacklist_config();
static string get_fan_text(const std::string& type_str, const std::string& key);
static std::vector<std::string> get_resolution_supported(std::string type_str);
static std::vector<std::string> get_compatible_machine(std::string type_str);
static std::vector<std::string> get_unsupport_auto_cali_filaments(std::string type_str);
static void check_filaments_in_blacklist(std::string model_id, std::string tag_vendor, std::string tag_type, const std::string& filament_id, int ams_id, int slot_id, std::string tag_name, bool &in_blacklist, std::string &ac, wxString &info);
static void check_filaments_in_blacklist_url(std::string model_id, std::string tag_vendor, std::string tag_type, const std::string& filament_id, int ams_id, int slot_id, std::string tag_name, bool& in_blacklist, std::string& ac, wxString& info, wxString& wiki_url);
static boost::bimaps::bimap<std::string, std::string> get_all_model_id_with_name();
static std::string load_gcode(std::string type_str, std::string gcode_file);
static bool is_virtual_slot(int ams_id);