ENH: add some check job

jira: [STUDIO-11883]
Change-Id: I9a112b10b18d4c4f4bee5c8076b22f46fb63b13f
This commit is contained in:
xin.zhang 2025-04-27 17:22:17 +08:00 committed by lane.wei
parent 564e59bf4f
commit 15c7bb7290
8 changed files with 209 additions and 106 deletions

View File

@ -85,26 +85,26 @@
{
"vendor": "Bambu Lab",
"type": "PET-CF",
"action": "prohibition",
"description": "Bambu CF: not supported"
"action": "warning",
"description": "CF/GF: hard and brittle"
},
{
"vendor": "Bambu Lab",
"type": "PA6-CF",
"action": "prohibition",
"description": "Bambu CF: not supported"
"action": "warning",
"description": "CF/GF: hard and brittle"
},
{
"vendor": "Bambu Lab",
"type": "PPS-CF",
"action": "prohibition",
"description": "Bambu CF: not supported"
"action": "warning",
"description": "CF/GF: hard and brittle"
},
{
"vendor": "Bambu Lab",
"type": "PPA-CF",
"action": "prohibition",
"description": "Bambu CF: not supported"
"action": "warning",
"description": "CF/GF: hard and brittle"
}
]
}

View File

@ -1 +1 @@
02.00.00.17
02.00.00.22

View File

@ -356,6 +356,8 @@ std::optional<FilamentBaseInfo> PresetBundle::get_filament_by_filament_id(const
info.nozzle_temp_range_high = config.option<ConfigOptionInts>("nozzle_temperature_range_high")->values[0];
if (config.has("nozzle_temperature_range_low"))
info.nozzle_temp_range_low = config.option<ConfigOptionInts>("nozzle_temperature_range_low")->values[0];
if(config.has("temperature_vitrification"))
info.temperature_vitrification = config.option<ConfigOptionInts>("temperature_vitrification")->values[0];
if (!printer_name.empty()) {
std::vector<std::string> compatible_printers = config.option<ConfigOptionStrings>("compatible_printers")->values;

View File

@ -57,6 +57,7 @@ struct FilamentBaseInfo
std::string vendor;
int nozzle_temp_range_low{ 220 };
int nozzle_temp_range_high{ 220 };
int temperature_vitrification = INT_MAX;
bool is_support{ false };
bool is_system{ true };
int filament_printable = 3;

View File

@ -7828,6 +7828,120 @@ void DeviceManager::OnSelectedMachineLost() {
GUI::wxGetApp().sidebar().load_ams_list(string(), nullptr);
}
// moved from tao.wang and zhimin.zeng
void check_filaments_for_ams_slot(std::string model_id,
std::string tag_vendor,
std::string tag_type,
int ams_id,
int slot_id,
std::string tag_name,
bool& in_blacklist,
std::string& ac,
std::string& info)
{
if (tag_name.empty())
{
tag_name = DeviceManager::get_filament_name_from_ams(ams_id, slot_id);
}
std::unordered_map<std::string, wxString> blacklist_prompt =
{
{"TPU: not supported", _L("TPU is not supported by AMS.")},
{"Bambu CF: not supported", _L("Bambu PET-CF/PA6-CF/PPA-CF/PPS-CF is not supported by AMS.")},
{"PVA: flexible", _L("Damp PVA will become flexible and get stuck inside AMS,please take care to dry it before use.")},
{"CF/GF: hard and brittle", _L("CF/GF filaments are hard and brittle, It's easy to break or get stuck in AMS, please use with caution.")},
{"PLA-Glow", _L("The rough surface of PLA Glow can accelerate wear on the AMS system, particularly on the internal components of the AMS Lite.")}
};
in_blacklist = false;
if (DeviceManager::filaments_blacklist.contains("blacklist"))
{
for (auto prohibited_filament : DeviceManager::filaments_blacklist["blacklist"])
{
std::string vendor;
std::string type;
std::string action;
std::string description;
std::string name = "undefine";
std::vector<std::string> model_ids;
if (prohibited_filament.contains("vendor") &&
prohibited_filament.contains("type") &&
prohibited_filament.contains("action") &&
prohibited_filament.contains("description"))
{
vendor = prohibited_filament["vendor"].get<std::string>();
type = prohibited_filament["type"].get<std::string>();
action = prohibited_filament["action"].get<std::string>();
description = prohibited_filament["description"].get<std::string>();
}
else
{
return;
}
if (prohibited_filament.contains("name"))
{
name = prohibited_filament["name"].get<std::string>();
}
if (prohibited_filament.contains("model_id"))
{
for (auto res : prohibited_filament["model_id"])
model_ids.emplace_back(res.get<std::string>());
}
std::transform(vendor.begin(), vendor.end(), vendor.begin(), ::tolower);
std::transform(tag_vendor.begin(), tag_vendor.end(), tag_vendor.begin(), ::tolower);
std::transform(tag_type.begin(), tag_type.end(), tag_type.begin(), ::tolower);
std::transform(type.begin(), type.end(), type.begin(), ::tolower);
bool mactch_printer = false;
auto it = std::find(model_ids.begin(), model_ids.end(), model_id);
if (it != model_ids.end()) { mactch_printer = true; }
// third party
if (vendor == "third party")
{
if ("bambu lab" != tag_vendor && tag_type == type)
{
if (name == "undefine" || (tag_name.find(name) != std::string::npos))
{
if (model_ids.empty() || mactch_printer)
{
in_blacklist = true;
ac = action;
info = blacklist_prompt[description].ToStdString();
return;
}
}
}
}
else
{
if (vendor == tag_vendor && tag_type == type)
{
if (name == "undefine" || (tag_name.find(name) != std::string::npos))
{
if (model_ids.empty() || mactch_printer)
{
in_blacklist = true;
ac = action;
info = blacklist_prompt[description].ToStdString();
return;
}
}
}
}
}
}
}
void DeviceManager::check_filaments_in_blacklist(std::string model_id,
@ -7851,94 +7965,8 @@ void DeviceManager::check_filaments_in_blacklist(std::string model_id,
if (DeviceManager::is_virtual_slot(ams_id)) {
check_filaments_for_vt_slot(tag_vendor, tag_type, ams_id, in_blacklist, ac, info);
return;
}
if (tag_name.empty()) {
tag_name = get_filament_name_from_ams(ams_id, slot_id);
}
std::unordered_map<std::string, wxString> blacklist_prompt =
{
{"TPU: not supported", _L("TPU is not supported by AMS.")},
{"Bambu CF: not supported", _L("Bambu PET-CF/PA6-CF/PPA-CF/PPS-CF is not supported by AMS.")},
{"PVA: flexible", _L("Damp PVA will become flexible and get stuck inside AMS,please take care to dry it before use.")},
{"CF/GF: hard and brittle", _L("CF/GF filaments are hard and brittle, It's easy to break or get stuck in AMS, please use with caution.")},
{"PLA-Glow", _L("The rough surface of PLA Glow can accelerate wear on the AMS system, particularly on the internal components of the AMS Lite.")}
};
in_blacklist = false;
if (filaments_blacklist.contains("blacklist")) {
for (auto prohibited_filament : filaments_blacklist["blacklist"]) {
std::string vendor;
std::string type;
std::string action;
std::string description;
std::string name = "undefine";
std::vector<std::string> model_ids;
if (prohibited_filament.contains("vendor") &&
prohibited_filament.contains("type") &&
prohibited_filament.contains("action") &&
prohibited_filament.contains("description"))
{
vendor = prohibited_filament["vendor"].get<std::string>();
type = prohibited_filament["type"].get<std::string>();
action = prohibited_filament["action"].get<std::string>();
description = prohibited_filament["description"].get<std::string>();
}
else {
return;
}
if (prohibited_filament.contains("name")) {
name = prohibited_filament["name"].get<std::string>();
}
if (prohibited_filament.contains("model_id")) {
for (auto res : prohibited_filament["model_id"])
model_ids.emplace_back(res.get<std::string>());
}
std::transform(vendor.begin(), vendor.end(), vendor.begin(), ::tolower);
std::transform(tag_vendor.begin(), tag_vendor.end(), tag_vendor.begin(), ::tolower);
std::transform(tag_type.begin(), tag_type.end(), tag_type.begin(), ::tolower);
std::transform(type.begin(), type.end(), type.begin(), ::tolower);
bool mactch_printer = false;
auto it = std::find(model_ids.begin(), model_ids.end(), model_id);
if (it != model_ids.end()) {mactch_printer = true;}
// third party
if (vendor == "third party") {
if ("bambu lab" != tag_vendor && tag_type == type) {
if (name == "undefine" || (tag_name.find(name) != std::string::npos)) {
if (model_ids.empty() || mactch_printer) {
in_blacklist = true;
ac = action;
info = blacklist_prompt[description].ToUTF8().data();
return;
}
}
}
} else {
if (vendor == tag_vendor && tag_type == type) {
if (name == "undefine" || (tag_name.find(name) != std::string::npos)) {
if (model_ids.empty() || mactch_printer) {
in_blacklist = true;
ac = action;
info = blacklist_prompt[description].ToUTF8().data();
return;
}
}
}
}
}
} else {
check_filaments_for_ams_slot(model_id, tag_vendor, tag_type, ams_id, slot_id, tag_name, in_blacklist, ac, info);
}
}

View File

@ -80,6 +80,9 @@ wxString PrePrintChecker::get_pre_state_msg(PrintDialogStatus status)
case PrintStatusTPUUnsupportAutoCali: return _L("TPU 90A/TPU 85A is too soft and does not support automatic Flow Dynamics calibration.");
case PrintStatusWarningKvalueNotUsed: return _L("Set dynamic flow calibration to 'OFF' to enable custom dynamic flow value.");
case PrintStatusNotSupportedPrintAll: return _L("This printer does not support printing all plates");
case PrintStatusWarningTpuRightColdPulling: return _L("Please cold pull before printing TPU to avoid clogging. You may use cold pull maintenance on the printer.");
case PrintStatusFilamentHighChamberTempCloseDoor: return _L("High chamber temperature is required. Please close the door.");
case PrintStatusFilamentHighChamberTempSoft: return _L("The filament on the extruder may soften. Please unload.");
}
return wxEmptyString;
}

View File

@ -67,7 +67,7 @@ enum PrintDialogStatus : unsigned int {
PrintStatusAmsMappingU0Invalid,
PrintStatusAmsMappingMixInvalid,
PrintStatusTPUUnsupportAutoCali,
PrintStatusHasFilamentInBlackList,
PrintStatusHasFilamentInBlackListError,
PrintStatusFilamentErrorEnd,
PrintStatusErrorEnd,//->end error<-
@ -85,6 +85,10 @@ enum PrintDialogStatus : unsigned int {
// Warnings for filament
PrintStatusFilamentWarningBegin,
PrintStatusWarningKvalueNotUsed,
PrintStatusWarningTpuRightColdPulling,
PrintStatusHasFilamentInBlackListWarning,
PrintStatusFilamentHighChamberTempCloseDoor,
PrintStatusFilamentHighChamberTempSoft,
PrintStatusFilamentWarningEnd,
PrintStatusWarningEnd,//->end error<-

View File

@ -1731,12 +1731,24 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
} else if (status == PrintStatusTPUUnsupportAutoCali) {
Enable_Refresh_Button(true);
Enable_Send_Button(false);
} else if (status == PrintStatusHasFilamentInBlackList) {
} else if (status == PrintStatusHasFilamentInBlackListError) {
Enable_Refresh_Button(true);
Enable_Send_Button(false);
} else if (status == PrintStatusWarningKvalueNotUsed) {
Enable_Refresh_Button(true);
Enable_Send_Button(true);
} else if (status == PrintStatusHasFilamentInBlackListWarning) {
Enable_Refresh_Button(true);
Enable_Send_Button(true);
} else if (status == PrintStatusWarningTpuRightColdPulling) {
Enable_Refresh_Button(true);
Enable_Send_Button(true);
} else if (status == PrintStatusFilamentHighChamberTempCloseDoor) {
Enable_Refresh_Button(true);
Enable_Send_Button(true);
} else if (status == PrintDialogStatus::PrintStatusFilamentHighChamberTempSoft) {
Enable_Refresh_Button(true);
Enable_Send_Button(true);
}
/*enter perpare mode*/
@ -3229,8 +3241,6 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
}
}
/** error check **/
/* check cloud machine connections */
if (!obj_->is_lan_mode_printer() && !agent->is_server_connected()) {
@ -3439,12 +3449,17 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
DeviceManager::check_filaments_in_blacklist(obj_->printer_type, filament_brand, filament_type, m_ams_mapping_result[i].filament_id, ams_id, slot_id, "", in_blacklist,
action, info);
if (in_blacklist) {
if (in_blacklist && action == "prohibition") {
std::vector<wxString> error_msg;
error_msg.emplace_back(info);
show_status(PrintDialogStatus::PrintStatusHasFilamentInBlackList, error_msg);
return;
std::vector<wxString> error_msg { info };
if (action == "prohibition") {
show_status(PrintDialogStatus::PrintStatusHasFilamentInBlackListError, error_msg);
return;
}
else if (action == "warning") {
show_status(PrintDialogStatus::PrintStatusHasFilamentInBlackListWarning, error_msg);/** warning check **/
return;
}
}
}
@ -3497,6 +3512,56 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
}
}
/*Check the tpu at right*/
if (obj_->m_extder_data.total_extder_count == 2) {
for (const FilamentInfo& item : m_ams_mapping_result) {
if (item.ams_id.empty()) continue;
if (item.type.compare("TPU") != 0 && item.type.compare("TPU-AMS") != 0) { continue; }
int extruder_id = obj_->get_extruder_id_by_ams_id(item.ams_id);
if (extruder_id == MAIN_NOZZLE_ID)
{
show_status(PrintDialogStatus::PrintStatusWarningTpuRightColdPulling);
break;
}
}
}
/*Check high temperture slicing*/
auto preset_full_config = wxGetApp().preset_bundle->full_config();
auto chamber_temperatures = preset_full_config.option<ConfigOptionInts>("chamber_temperatures");
for (const FilamentInfo& item : m_ams_mapping_result)
{
try
{
int fila_id = atoi(item.filament_id.c_str());
int chamber_temp = chamber_temperatures->values[fila_id];
// check close door
if (obj_->is_support_chamber_edit && chamber_temp >= obj_->chamber_temp_switch_heat)
{
show_status(PrintDialogStatus::PrintStatusFilamentHighChamberTempCloseDoor);
return;
}
// check vitrification
if (obj_->is_filament_at_extruder())
{
AmsTray* tray = obj_->get_curr_tray();
if (tray)
{
auto filament_info = wxGetApp().preset_bundle->get_filament_by_filament_id(tray->setting_id);
if (filament_info && (filament_info->temperature_vitrification - chamber_temp <= 5))
{
show_status(PrintDialogStatus::PrintStatusFilamentHighChamberTempSoft);
return;
}
}
}
}
catch (std::exception&) { assert(0); }
}
/** normal check **/
show_status(PrintDialogStatus::PrintStatusReadyToGo);
}