mirror of
https://github.com/QIDITECH/QIDIStudio.git
synced 2026-02-02 18:08:51 +03:00
update slic3r
This commit is contained in:
@@ -274,6 +274,8 @@ std::string AmsTray::get_display_filament_type()
|
||||
return "Sup.PLA";
|
||||
else if (type == "PA-S")
|
||||
return "Sup.PA";
|
||||
else if (type == "ABS-S")
|
||||
return "Sup.ABS";
|
||||
else
|
||||
return type;
|
||||
return type;
|
||||
@@ -285,6 +287,8 @@ std::string AmsTray::get_filament_type()
|
||||
return "PLA-S";
|
||||
} else if (type == "Sup.PA") {
|
||||
return "PA-S";
|
||||
} else if (type == "Sup.ABS") {
|
||||
return "ABS-S";
|
||||
} else if (type == "Support W") {
|
||||
return "PLA-S";
|
||||
} else if (type == "Support G") {
|
||||
@@ -917,7 +921,6 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
|
||||
val.tray_id = tray->second.id;
|
||||
wxColour c = wxColour(filaments[i].color);
|
||||
wxColour tray_c = AmsTray::decode_color(tray->second.color);
|
||||
//1.9.5
|
||||
val.distance = GUI::calc_color_distance(c, tray_c);
|
||||
if (filaments[i].type != tray->second.type) {
|
||||
val.distance = 999999;
|
||||
@@ -1435,6 +1438,10 @@ void MachineObject::parse_status(int flag)
|
||||
}
|
||||
|
||||
sdcard_state = MachineObject::SdcardState((flag >> 8) & 0x11);
|
||||
|
||||
is_support_agora = ((flag >> 30) & 0x1) != 0;
|
||||
if (is_support_agora)
|
||||
is_support_tunnel_mqtt = false;
|
||||
}
|
||||
|
||||
PrintingSpeedLevel MachineObject::_parse_printing_speed_lvl(int lvl)
|
||||
@@ -1887,7 +1894,8 @@ int MachineObject::command_ams_calibrate(int ams_id)
|
||||
int MachineObject::command_ams_filament_settings(int ams_id, int tray_id, std::string filament_id, std::string setting_id, std::string tray_color, std::string tray_type, int nozzle_temp_min, int nozzle_temp_max)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << "command_ams_filament_settings, ams_id = " << ams_id << ", tray_id = " << tray_id << ", tray_color = " << tray_color
|
||||
<< ", tray_type = " << tray_type << ", setting_id = " << setting_id << ", temp_min: = " << nozzle_temp_min << ", temp_max: = " << nozzle_temp_max;
|
||||
<< ", tray_type = " << tray_type << ", filament_id = " << filament_id
|
||||
<< ", setting_id = " << setting_id << ", temp_min: = " << nozzle_temp_min << ", temp_max: = " << nozzle_temp_max;
|
||||
json j;
|
||||
j["print"]["command"] = "ams_filament_setting";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
@@ -2960,7 +2968,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
}
|
||||
|
||||
if (!key_field_only) {
|
||||
if (!DeviceManager::EnableMultiMachine) {
|
||||
if (!DeviceManager::EnableMultiMachine && !is_support_agora) {
|
||||
if (jj.contains("support_tunnel_mqtt")) {
|
||||
if (jj["support_tunnel_mqtt"].is_boolean()) {
|
||||
is_support_tunnel_mqtt = jj["support_tunnel_mqtt"].get<bool>();
|
||||
@@ -3221,7 +3229,12 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
mc_print_line_number = atoi(jj["mc_print_line_number"].get<std::string>().c_str());
|
||||
}
|
||||
}
|
||||
//1.9.5
|
||||
if (!key_field_only) {
|
||||
if (jj.contains("flag3")) {
|
||||
int flag3 = jj["flag3"].get<int>();
|
||||
is_support_filament_setting_inprinting = get_flag_bits(flag3, 3);
|
||||
}
|
||||
}
|
||||
if (!key_field_only) {
|
||||
if (jj.contains("net")) {
|
||||
if (jj["net"].contains("conf")) {
|
||||
@@ -3750,11 +3763,18 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
if (ipcam.contains("liveview")) {
|
||||
char const *local_protos[] = {"none", "disabled", "local", "rtsps", "rtsp"};
|
||||
liveview_local = enum_index_of(ipcam["liveview"].value<std::string>("local", "none").c_str(), local_protos, 5, LiveviewLocal::LVL_None);
|
||||
liveview_remote = ipcam["liveview"].value<std::string>("remote", "disabled") == "enabled";
|
||||
char const *remote_protos[] = {"none", "tutk", "agora", "tutk_agaro"};
|
||||
liveview_remote = enum_index_of(ipcam["liveview"].value<std::string>("remote", "none").c_str(), remote_protos, 4, LiveviewRemote::LVR_None);
|
||||
if (is_support_agora)
|
||||
liveview_remote = liveview_remote == LVR_None ? LVR_Agora : liveview_remote == LVR_Tutk ? LVR_TutkAgora : liveview_remote;
|
||||
}
|
||||
if (ipcam.contains("file")) {
|
||||
file_local = ipcam["file"].value<std::string>("local", "disabled") == "enabled";
|
||||
file_remote = ipcam["file"].value<std::string>("remote", "disabled") == "enabled";
|
||||
char const *local_protos[] = {"none", "local"};
|
||||
file_local = enum_index_of(ipcam["file"].value<std::string>("local", "none").c_str(), local_protos, 2, FileLocal::FL_None);
|
||||
char const *remote_protos[] = {"none", "tutk", "agora", "tutk_agaro"};
|
||||
file_remote = enum_index_of(ipcam["file"].value<std::string>("remote", "none").c_str(), remote_protos, 4, FileRemote::FR_None);
|
||||
if (is_support_agora)
|
||||
file_remote = file_remote == FR_None ? FR_Agora : file_remote == FR_Tutk ? FR_TutkAgora : file_remote;
|
||||
file_model_download = ipcam["file"].value<std::string>("model_download", "disabled") == "enabled";
|
||||
}
|
||||
virtual_camera = ipcam.value<std::string>("virtual_camera", "disabled") == "enabled";
|
||||
@@ -3867,10 +3887,13 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
;
|
||||
}
|
||||
PresetBundle *preset_bundle = Slic3r::GUI::wxGetApp().preset_bundle;
|
||||
std::map<std::string, std::vector<Preset const *>> filament_list = preset_bundle->filaments.get_filament_presets();
|
||||
std::ostringstream stream;
|
||||
stream << std::fixed << std::setprecision(1) << nozzle_diameter;
|
||||
std::string nozzle_diameter_str = stream.str();
|
||||
if (m_printer_preset_name.find(nozzle_diameter_str + " nozzle") == std::string::npos)
|
||||
update_printer_preset_name(nozzle_diameter_str);
|
||||
update_filament_list();
|
||||
std::set<std::string> need_checked_filament_id;
|
||||
if (jj.contains("ams")) {
|
||||
if (jj["ams"].contains("ams")) {
|
||||
long int last_ams_exist_bits = ams_exist_bits;
|
||||
@@ -4032,15 +4055,24 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
} else {
|
||||
curr_tray->type = type;
|
||||
}
|
||||
if (filament_list.find(curr_tray->setting_id) == filament_list.end()) {
|
||||
wxColour color = *wxWHITE;
|
||||
char col_buf[10];
|
||||
sprintf(col_buf, "%02X%02X%02XFF", (int) color.Red(), (int) color.Green(), (int) color.Blue());
|
||||
try {
|
||||
this->command_ams_filament_settings(std::stoi(ams_id), std::stoi(tray_id), "", "", std::string(col_buf), "", 0, 0);
|
||||
continue;
|
||||
} catch (...) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << " stoi error and ams_id: " << ams_id << " tray_id" << tray_id;
|
||||
// settings_id is not exist in filament_list
|
||||
if (curr_tray->setting_id.size() == 8 && curr_tray->setting_id[0] == 'P' &&
|
||||
m_filament_list.find(curr_tray->setting_id) == m_filament_list.end()) {
|
||||
if (m_checked_filament.find(curr_tray->setting_id) == m_checked_filament.end()) {
|
||||
need_checked_filament_id.insert(curr_tray->setting_id);
|
||||
wxColour color = *wxWHITE;
|
||||
char col_buf[10];
|
||||
sprintf(col_buf, "%02X%02X%02XFF", (int) color.Red(), (int) color.Green(), (int) color.Blue());
|
||||
try {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__
|
||||
<< " ams settings_id is not exist in filament_list and reset, ams_id: " << ams_id
|
||||
<< " tray_id" << tray_id << "filament_id: " << curr_tray->setting_id;
|
||||
this->command_ams_filament_settings(std::stoi(ams_id), std::stoi(tray_id), "", "", std::string(col_buf), "", 0, 0);
|
||||
continue;
|
||||
} catch (...) {
|
||||
BOOST_LOG_TRIVIAL(info)
|
||||
<< __FUNCTION__ << " " << __LINE__ << " stoi error and ams_id: " << ams_id << " tray_id" << tray_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -4090,20 +4122,27 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
curr_tray->nozzle_temp_min = (*tray_it)["nozzle_temp_min"].get<std::string>();
|
||||
else
|
||||
curr_tray->nozzle_temp_min = "";
|
||||
if (curr_tray->nozzle_temp_min != "" && curr_tray->nozzle_temp_max != "") {
|
||||
try {
|
||||
std::string preset_setting_id;
|
||||
bool is_equation = preset_bundle->check_filament_temp_equation_by_printer_type_and_nozzle_for_mas_tray(
|
||||
MachineObject::get_preset_printer_model_name(this->printer_type), nozzle_diameter_str, curr_tray->setting_id,
|
||||
curr_tray->tag_uid, curr_tray->nozzle_temp_min, curr_tray->nozzle_temp_max, preset_setting_id);
|
||||
if (!is_equation) {
|
||||
command_ams_filament_settings(std::stoi(ams_id), std::stoi(tray_id), curr_tray->setting_id, preset_setting_id,
|
||||
curr_tray->color, curr_tray->type,
|
||||
std::stoi(curr_tray->nozzle_temp_min),
|
||||
std::stoi(curr_tray->nozzle_temp_max));
|
||||
if (curr_tray->setting_id.size() == 8 && curr_tray->setting_id[0] == 'P' && curr_tray->nozzle_temp_min != "" && curr_tray->nozzle_temp_max != "") {
|
||||
if (m_checked_filament.find(vt_tray.setting_id) == m_checked_filament.end()) {
|
||||
need_checked_filament_id.insert(vt_tray.setting_id);
|
||||
try {
|
||||
std::string preset_setting_id;
|
||||
bool is_equation = preset_bundle->check_filament_temp_equation_by_printer_type_and_nozzle_for_mas_tray(
|
||||
MachineObject::get_preset_printer_model_name(this->printer_type), nozzle_diameter_str, curr_tray->setting_id,
|
||||
curr_tray->tag_uid, curr_tray->nozzle_temp_min, curr_tray->nozzle_temp_max, preset_setting_id);
|
||||
if (!is_equation) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__
|
||||
<< " ams filament is not match min max temp and reset, ams_id: " << ams_id
|
||||
<< " tray_id" << tray_id << "filament_id: " << curr_tray->setting_id;
|
||||
command_ams_filament_settings(std::stoi(ams_id), std::stoi(tray_id), curr_tray->setting_id, preset_setting_id,
|
||||
curr_tray->color, curr_tray->type,
|
||||
std::stoi(curr_tray->nozzle_temp_min),
|
||||
std::stoi(curr_tray->nozzle_temp_max));
|
||||
}
|
||||
continue;
|
||||
} catch (...) {
|
||||
BOOST_LOG_TRIVIAL(info) << "check fail and curr_tray ams_id" << ams_id << " curr_tray tray_id"<<tray_id;
|
||||
}
|
||||
} catch (...) {
|
||||
BOOST_LOG_TRIVIAL(info) << "check fail and curr_tray ams_id" << ams_id << " curr_tray tray_id"<<tray_id;
|
||||
}
|
||||
}
|
||||
if (tray_it->contains("xcam_info"))
|
||||
@@ -4227,15 +4266,19 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
else {
|
||||
vt_tray.type = type;
|
||||
}
|
||||
if (filament_list.find(vt_tray.setting_id) == filament_list.end()) {
|
||||
wxColour color = *wxWHITE;
|
||||
char col_buf[10];
|
||||
sprintf(col_buf, "%02X%02X%02XFF", (int) color.Red(), (int) color.Green(), (int) color.Blue());
|
||||
try {
|
||||
BOOST_LOG_TRIVIAL(info) << "no filament_id in filament_list and reset vt_tray and the filament_id is: " << vt_tray.setting_id;
|
||||
this->command_ams_filament_settings(255, std::stoi(vt_tray.id), "", "", std::string(col_buf), "", 0, 0);
|
||||
} catch (...) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << " stoi error and tray_id" << vt_tray.id;
|
||||
if (vt_tray.setting_id.size() == 8 && vt_tray.setting_id[0] == 'P' &&
|
||||
m_filament_list.find(vt_tray.setting_id) == m_filament_list.end()) {
|
||||
if (m_checked_filament.find(vt_tray.setting_id) == m_checked_filament.end()) {
|
||||
need_checked_filament_id.insert(vt_tray.setting_id);
|
||||
wxColour color = *wxWHITE;
|
||||
char col_buf[10];
|
||||
sprintf(col_buf, "%02X%02X%02XFF", (int) color.Red(), (int) color.Green(), (int) color.Blue());
|
||||
try {
|
||||
BOOST_LOG_TRIVIAL(info) << "vt_tray.setting_id is not exist in filament_list and reset vt_tray and the filament_id is: " << vt_tray.setting_id;
|
||||
this->command_ams_filament_settings(255, std::stoi(vt_tray.id), "", "", std::string(col_buf), "", 0, 0);
|
||||
} catch (...) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << " stoi error and tray_id" << vt_tray.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4285,21 +4328,23 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
vt_tray.nozzle_temp_min = jj["vt_tray"]["nozzle_temp_min"].get<std::string>();
|
||||
else
|
||||
vt_tray.nozzle_temp_min = "";
|
||||
if (vt_tray.nozzle_temp_min != "" && vt_tray.nozzle_temp_max != "") {
|
||||
try {
|
||||
std::string preset_setting_id;
|
||||
bool is_equation = preset_bundle->check_filament_temp_equation_by_printer_type_and_nozzle_for_mas_tray(
|
||||
MachineObject::get_preset_printer_model_name(this->printer_type), nozzle_diameter_str, vt_tray.setting_id, vt_tray.tag_uid,
|
||||
vt_tray.nozzle_temp_min, vt_tray.nozzle_temp_max, preset_setting_id);
|
||||
if (!is_equation) {
|
||||
command_ams_filament_settings(255, std::stoi(vt_tray.id), vt_tray.setting_id, preset_setting_id, vt_tray.color, vt_tray.type,
|
||||
std::stoi(vt_tray.nozzle_temp_min), std::stoi(vt_tray.nozzle_temp_max));
|
||||
if (vt_tray.setting_id.size() == 8 && vt_tray.setting_id[0] == 'P' && vt_tray.nozzle_temp_min != "" && vt_tray.nozzle_temp_max != "") {
|
||||
if (m_checked_filament.find(vt_tray.setting_id) == m_checked_filament.end()) {
|
||||
need_checked_filament_id.insert(vt_tray.setting_id);
|
||||
try {
|
||||
std::string preset_setting_id;
|
||||
bool is_equation = preset_bundle->check_filament_temp_equation_by_printer_type_and_nozzle_for_mas_tray(
|
||||
MachineObject::get_preset_printer_model_name(this->printer_type), nozzle_diameter_str, vt_tray.setting_id, vt_tray.tag_uid,
|
||||
vt_tray.nozzle_temp_min, vt_tray.nozzle_temp_max, preset_setting_id);
|
||||
if (!is_equation) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << " vt_tray filament is not match min max temp and reset, filament_id: " << vt_tray.setting_id;
|
||||
command_ams_filament_settings(255, std::stoi(vt_tray.id), vt_tray.setting_id, preset_setting_id, vt_tray.color, vt_tray.type,
|
||||
std::stoi(vt_tray.nozzle_temp_min), std::stoi(vt_tray.nozzle_temp_max));
|
||||
}
|
||||
} catch (...) {
|
||||
BOOST_LOG_TRIVIAL(info) << "check fail and vt_tray.id" << vt_tray.id;
|
||||
}
|
||||
}
|
||||
catch(...) {
|
||||
BOOST_LOG_TRIVIAL(info) << "check fail and vt_tray.id" << vt_tray.id;
|
||||
}
|
||||
|
||||
}
|
||||
if (jj["vt_tray"].contains("xcam_info"))
|
||||
vt_tray.xcam_info = jj["vt_tray"]["xcam_info"].get<std::string>();
|
||||
@@ -4339,6 +4384,8 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
;
|
||||
}
|
||||
}
|
||||
for (auto &filament_id : need_checked_filament_id)
|
||||
m_checked_filament.insert(filament_id);
|
||||
#pragma endregion
|
||||
} else if (jj["command"].get<std::string>() == "gcode_line") {
|
||||
//ack of gcode_line
|
||||
@@ -4377,6 +4424,14 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
}
|
||||
}
|
||||
} else if (jj["command"].get<std::string>() == "ams_filament_setting" && !key_field_only) {
|
||||
if (jj.contains("result") && jj.contains("reason")) {
|
||||
if (jj["result"].get<std::string>() == "fail") {
|
||||
auto err_code = jj["err_code"].get<int>();
|
||||
print_error = err_code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// QDS trigger ams UI update
|
||||
ams_version = -1;
|
||||
|
||||
@@ -4510,6 +4565,12 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
}
|
||||
}
|
||||
} else if (jj["command"].get<std::string>() == "extrusion_cali_set") {
|
||||
if (jj.contains("result") && jj.contains("reason")) {
|
||||
if (jj["result"].get<std::string>() == "fail") {
|
||||
auto err_code = jj["err_code"].get<int>();
|
||||
print_error = err_code;
|
||||
}
|
||||
}
|
||||
#ifdef CALI_DEBUG
|
||||
std::string str = jj.dump();
|
||||
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_set: " << str;
|
||||
@@ -4554,6 +4615,13 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
extrusion_cali_set_hold_start = std::chrono::system_clock::now();
|
||||
}
|
||||
else if (jj["command"].get<std::string>() == "extrusion_cali_sel") {
|
||||
if (jj.contains("result") && jj.contains("reason")) {
|
||||
if (jj["result"].get<std::string>() == "fail") {
|
||||
auto err_code = jj["err_code"].get<int>();
|
||||
print_error = err_code;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CALI_DEBUG
|
||||
std::string str = jj.dump();
|
||||
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_sel: " << str;
|
||||
@@ -4595,6 +4663,13 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
}
|
||||
}
|
||||
else if (jj["command"].get<std::string>() == "extrusion_cali_get") {
|
||||
if (jj.contains("result") && jj.contains("reason")) {
|
||||
if (jj["result"].get<std::string>() == "fail") {
|
||||
auto err_code = jj["err_code"].get<int>();
|
||||
print_error = err_code;
|
||||
}
|
||||
}
|
||||
|
||||
reset_pa_cali_history_result();
|
||||
has_get_pa_calib_tab = true;
|
||||
|
||||
@@ -4658,6 +4733,13 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
// notify cali history to update
|
||||
}
|
||||
else if (jj["command"].get<std::string>() == "extrusion_cali_get_result") {
|
||||
if (jj.contains("result") && jj.contains("reason")) {
|
||||
if (jj["result"].get<std::string>() == "fail") {
|
||||
auto err_code = jj["err_code"].get<int>();
|
||||
print_error = err_code;
|
||||
}
|
||||
}
|
||||
|
||||
reset_pa_cali_result();
|
||||
get_pa_calib_result = true;
|
||||
|
||||
@@ -5173,6 +5255,93 @@ std::string MachineObject::get_string_from_fantype(FanType type)
|
||||
return "";
|
||||
}
|
||||
|
||||
void MachineObject::update_filament_list()
|
||||
{
|
||||
PresetBundle *preset_bundle = Slic3r::GUI::wxGetApp().preset_bundle;
|
||||
|
||||
// custom filament
|
||||
std::map<std::string, std::pair<int, int>> filament_list;
|
||||
for (auto &preset : preset_bundle->filaments()) {
|
||||
if (preset.is_user() && preset.inherits() == "") {
|
||||
ConfigOption * printer_opt = const_cast<Preset&>(preset).config.option("compatible_printers");
|
||||
ConfigOptionStrings *printer_strs = dynamic_cast<ConfigOptionStrings *>(printer_opt);
|
||||
for (const std::string &printer_str : printer_strs->values) {
|
||||
if (printer_str == m_printer_preset_name) {
|
||||
ConfigOption *opt_min = const_cast<Preset &>(preset).config.option("nozzle_temperature_range_low");
|
||||
int min_temp = -1;
|
||||
if (opt_min) {
|
||||
ConfigOptionInts *opt_min_ints = dynamic_cast<ConfigOptionInts *>(opt_min);
|
||||
min_temp = opt_min_ints->get_at(0);
|
||||
}
|
||||
ConfigOption *opt_max = const_cast<Preset &>(preset).config.option("nozzle_temperature_range_high");
|
||||
int max_temp = -1;
|
||||
if (opt_max) {
|
||||
ConfigOptionInts *opt_max_ints = dynamic_cast<ConfigOptionInts *>(opt_max);
|
||||
max_temp = opt_max_ints->get_at(0);
|
||||
}
|
||||
filament_list[preset.filament_id] = std::make_pair(min_temp, max_temp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto it = filament_list.begin(); it != filament_list.end(); it++) {
|
||||
if (m_filament_list.find(it->first) != m_filament_list.end()) {
|
||||
assert(it->first.size() == 8 && it->first[0] == 'P');
|
||||
|
||||
if (it->second.first != m_filament_list[it->first].first) {
|
||||
BOOST_LOG_TRIVIAL(info) << "old min temp is not equal to new min temp and filament id: " << it->first;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (it->second.second != m_filament_list[it->first].second) {
|
||||
BOOST_LOG_TRIVIAL(info) << "old max temp is not equal to new max temp and filament id: " << it->first;
|
||||
continue;
|
||||
}
|
||||
|
||||
m_filament_list.erase(it->first);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto it = m_filament_list.begin(); it != m_filament_list.end(); it++) {
|
||||
m_checked_filament.erase(it->first);
|
||||
}
|
||||
|
||||
m_filament_list = filament_list;
|
||||
}
|
||||
|
||||
int MachineObject::get_flag_bits(std::string str, int start, int count)
|
||||
{
|
||||
int decimal_value = std::stoi(str, nullptr, 16);
|
||||
int mask = 0;
|
||||
for (int i = 0; i < count; i++) { mask += 1 << (start + i); }
|
||||
|
||||
int flag = (decimal_value & (mask)) >> start;
|
||||
return flag;
|
||||
}
|
||||
|
||||
int MachineObject::get_flag_bits(int num, int start, int count)
|
||||
{
|
||||
int decimal_value = num;
|
||||
int mask = 0;
|
||||
for (int i = 0; i < count; i++) { mask += 1 << (start + i); }
|
||||
|
||||
int flag = (decimal_value & (mask)) >> start;
|
||||
return flag;
|
||||
}
|
||||
|
||||
void MachineObject::update_printer_preset_name(const std::string &nozzle_diameter_str)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << "start update preset_name";
|
||||
auto preset_boundle = Slic3r::GUI::wxGetApp().preset_bundle;
|
||||
auto printer_set = preset_boundle->get_printer_names_by_printer_type_and_nozzle(MachineObject::get_preset_printer_model_name(this->printer_type), nozzle_diameter_str);
|
||||
if (printer_set.size() > 0)
|
||||
m_printer_preset_name = *printer_set.begin();
|
||||
else
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << " update printer preset name failed ";
|
||||
}
|
||||
|
||||
bool DeviceManager::EnableMultiMachine = false;
|
||||
bool DeviceManager::key_field_only = false;
|
||||
|
||||
@@ -5256,6 +5425,12 @@ void DeviceManager::on_machine_alive(std::string json_str)
|
||||
std::string printer_signal = j["dev_signal"].get<std::string>();
|
||||
std::string connect_type = j["connect_type"].get<std::string>();
|
||||
std::string bind_state = j["bind_state"].get<std::string>();
|
||||
|
||||
if (connect_type == "farm") {
|
||||
connect_type ="lan";
|
||||
bind_state = "free";
|
||||
}
|
||||
|
||||
std::string sec_link = "";
|
||||
std::string ssdp_version = "";
|
||||
if (j.contains("sec_link")) {
|
||||
@@ -5359,6 +5534,21 @@ void DeviceManager::on_machine_alive(std::string json_str)
|
||||
}
|
||||
}
|
||||
|
||||
MachineObject* DeviceManager::insert_local_device(std::string dev_name, std::string dev_id, std::string dev_ip, std::string connection_type, std::string bind_state, std::string version, std::string access_code)
|
||||
{
|
||||
MachineObject* obj;
|
||||
obj = new MachineObject(m_agent, dev_name, dev_id, dev_ip);
|
||||
obj->printer_type = MachineObject::parse_printer_type("C11");
|
||||
obj->dev_connection_type = connection_type;
|
||||
obj->bind_state = bind_state;
|
||||
obj->bind_sec_link = "secure";
|
||||
obj->bind_ssdp_version = version;
|
||||
obj->m_is_online = true;
|
||||
obj->set_access_code(access_code, false);
|
||||
obj->set_user_access_code(access_code, false);
|
||||
return obj;
|
||||
}
|
||||
|
||||
void DeviceManager::disconnect_all()
|
||||
{
|
||||
|
||||
@@ -5553,6 +5743,7 @@ bool DeviceManager::set_selected_machine(std::string dev_id, bool need_disconnec
|
||||
}
|
||||
}
|
||||
}
|
||||
it->second->m_checked_filament.clear();
|
||||
}
|
||||
selected_machine = dev_id;
|
||||
return true;
|
||||
@@ -5845,6 +6036,7 @@ std::string DeviceManager::get_printer_ams_img(std::string type_str)
|
||||
bool DeviceManager::get_printer_is_enclosed(std::string type_str) {
|
||||
return get_value_from_config<bool>(type_str, "printer_is_enclosed");
|
||||
}
|
||||
|
||||
std::vector<std::string> DeviceManager::get_resolution_supported(std::string type_str)
|
||||
{
|
||||
std::vector<std::string> resolution_supported;
|
||||
@@ -5890,6 +6082,49 @@ std::vector<std::string> DeviceManager::get_compatible_machine(std::string type_
|
||||
return compatible_machine;
|
||||
}
|
||||
|
||||
boost::bimaps::bimap<std::string, std::string> DeviceManager::get_all_model_id_with_name()
|
||||
{
|
||||
boost::bimaps::bimap<std::string, std::string> models;
|
||||
std::vector<wxString> m_files;
|
||||
|
||||
wxDir dir(Slic3r::resources_dir() + "/printers/");
|
||||
if (!dir.IsOpened()) {
|
||||
return models;
|
||||
}
|
||||
|
||||
wxString filename;
|
||||
bool hasFile = dir.GetFirst(&filename, wxEmptyString, wxDIR_FILES);
|
||||
while (hasFile) {
|
||||
m_files.push_back(filename);
|
||||
hasFile = dir.GetNext(&filename);
|
||||
}
|
||||
|
||||
for (wxString file : m_files) {
|
||||
std::string config_file = Slic3r::resources_dir() + "/printers/" + file.ToStdString();
|
||||
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"];
|
||||
|
||||
std::string model_id;
|
||||
std::string display_name;
|
||||
if (printer.contains("model_id")) {model_id = printer["model_id"].get<std::string>();}
|
||||
if (printer.contains("display_name")) {display_name = printer["display_name"].get<std::string>();}
|
||||
|
||||
if (!model_id.empty() && !display_name.empty()) {
|
||||
models.left.insert(make_pair(model_id, display_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (...) {}
|
||||
}
|
||||
|
||||
return models;
|
||||
}
|
||||
|
||||
bool DeviceManager::load_filaments_blacklist_config()
|
||||
{
|
||||
@@ -5957,7 +6192,7 @@ void DeviceManager::check_filaments_in_blacklist(std::string tag_vendor, std::st
|
||||
|
||||
//third party
|
||||
if (vendor == "third party") {
|
||||
if ("qidilab" != vendor && tag_type == type) {
|
||||
if ("qidi3d" != vendor && tag_type == type) {
|
||||
in_blacklist = true;
|
||||
ac = action;
|
||||
info = description;
|
||||
|
||||
Reference in New Issue
Block a user