ENH: support filament soften check

jira: [STUDIO-11922]
Change-Id: I819c47e847ca30120c9fffeab3e9e1955b7f6beb
This commit is contained in:
xin.zhang 2025-05-09 19:48:26 +08:00 committed by lane.wei
parent 9cd55e9bc7
commit 5b5489cc95
5 changed files with 70 additions and 14 deletions

View File

@ -921,6 +921,10 @@ AmsTray *MachineObject::get_ams_tray(std::string ams_id, std::string tray_id)
return nullptr; return nullptr;
} }
std::string MachineObject::get_filament_id(std::string ams_id, std::string tray_id) const {
return this->get_tray(ams_id, tray_id).setting_id;
}
void MachineObject::_parse_ams_status(int ams_status) void MachineObject::_parse_ams_status(int ams_status)
{ {
ams_status_sub = ams_status & 0xFF; ams_status_sub = ams_status & 0xFF;
@ -6137,7 +6141,7 @@ bool MachineObject::contains_tray(const std::string &ams_id, const std::string &
} }
} else { } else {
for (const auto& tray : vt_slot) { for (const auto& tray : vt_slot) {
if (tray.id == tray_id) { return true; } if (tray.id == ams_id) { return true; }
} }
} }
@ -6155,7 +6159,7 @@ AmsTray MachineObject::get_tray(const std::string &ams_id, const std::string &tr
} }
else { else {
for (const auto &tray : vt_slot) { for (const auto &tray : vt_slot) {
if (tray.id == tray_id) { return tray; } if (tray.id == ams_id) { return tray; }
} }
} }

View File

@ -764,6 +764,9 @@ public:
Ams* get_curr_Ams(); Ams* get_curr_Ams();
AmsTray* get_curr_tray(); AmsTray* get_curr_tray();
AmsTray *get_ams_tray(std::string ams_id, std::string tray_id); 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;
// parse amsStatusMain and ams_status_sub // parse amsStatusMain and ams_status_sub
void _parse_ams_status(int ams_status); void _parse_ams_status(int ams_status);
bool has_ams() { return ams_exist_bits != 0; } bool has_ams() { return ams_exist_bits != 0; }

View File

@ -82,7 +82,6 @@ wxString PrePrintChecker::get_pre_state_msg(PrintDialogStatus status)
case PrintStatusNotSupportedPrintAll: return _L("This printer does not support printing all plates"); 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 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 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; return wxEmptyString;
} }

View File

@ -89,6 +89,7 @@ enum PrintDialogStatus : unsigned int {
PrintStatusHasFilamentInBlackListWarning, PrintStatusHasFilamentInBlackListWarning,
PrintStatusFilamentHighChamberTempCloseDoor, PrintStatusFilamentHighChamberTempCloseDoor,
PrintStatusFilamentHighChamberTempSoft, PrintStatusFilamentHighChamberTempSoft,
PrintStatusUnknownFilamentHighChamberTempSoft,
PrintStatusFilamentWarningEnd, PrintStatusFilamentWarningEnd,
PrintStatusWarningEnd,//->end error<- PrintStatusWarningEnd,//->end error<-

View File

@ -1732,7 +1732,7 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
} else if (status == PrintStatusFilamentHighChamberTempCloseDoor) { } else if (status == PrintStatusFilamentHighChamberTempCloseDoor) {
Enable_Refresh_Button(true); Enable_Refresh_Button(true);
Enable_Send_Button(true); Enable_Send_Button(true);
} else if (status == PrintDialogStatus::PrintStatusFilamentHighChamberTempSoft) { } else if (status == PrintDialogStatus::PrintStatusFilamentHighChamberTempSoft || status == PrintDialogStatus::PrintStatusUnknownFilamentHighChamberTempSoft) {
Enable_Refresh_Button(true); Enable_Refresh_Button(true);
Enable_Send_Button(true); Enable_Send_Button(true);
} }
@ -3170,6 +3170,36 @@ static wxString _get_nozzle_name(int total_ext_count, int ext_id)
return _L("nozzle"); return _L("nozzle");
} }
static wxString _get_ext_loc_str(const std::unordered_set<int>& extruders, int total_ext_num)
{
assert(!extruders.empty());
if (total_ext_num == 1)
{
return _L("extruder");
}
else if (total_ext_num == 2)
{
if (extruders.size() == 2)
{
return _L("both extruders");
}
else if (extruders.size() == 1)
{
auto iter = extruders.begin();
if (*iter == MAIN_NOZZLE_ID)
{
return _L("right extruder");
}
else
{
return _L("left extruder");
}
}
}
return wxEmptyString;
}
void SelectMachineDialog::update_show_status(MachineObject* obj_) void SelectMachineDialog::update_show_status(MachineObject* obj_)
{ {
m_pre_print_checker.clear(); m_pre_print_checker.clear();
@ -3496,6 +3526,8 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
} }
/*Check high temperture slicing*/ /*Check high temperture slicing*/
std::unordered_set<int> known_fila_soften_extruders;
std::unordered_set<int> unknown_fila_soften_extruders;
auto preset_full_config = wxGetApp().preset_bundle->full_config(); auto preset_full_config = wxGetApp().preset_bundle->full_config();
auto chamber_temperatures = preset_full_config.option<ConfigOptionInts>("chamber_temperatures"); auto chamber_temperatures = preset_full_config.option<ConfigOptionInts>("chamber_temperatures");
for (const FilamentInfo& item : m_ams_mapping_result) for (const FilamentInfo& item : m_ams_mapping_result)
@ -3513,16 +3545,19 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
} }
// check vitrification // check vitrification
if (obj_->is_filament_at_extruder()) for (const auto& extder : obj_->m_extder_data.extders) {
{ if (extder.ext_has_filament) {
AmsTray* tray = obj_->get_curr_tray(); const auto& fila_id = obj_->get_filament_id(extder.snow.ams_id, extder.snow.slot_id);
if (tray) auto filament_info = wxGetApp().preset_bundle->get_filament_by_filament_id(fila_id);
{ if (filament_info ) {
auto filament_info = wxGetApp().preset_bundle->get_filament_by_filament_id(tray->setting_id); if (filament_info->temperature_vitrification - chamber_temp <= 5) {
if (filament_info && (filament_info->temperature_vitrification - chamber_temp <= 5)) known_fila_soften_extruders.insert(extder.id);
{ }
show_status(PrintDialogStatus::PrintStatusFilamentHighChamberTempSoft); } else {
return; // the minimum temperature_vitrification of the known filaments is 43 degrees
if (43 - chamber_temp <= 5) {
unknown_fila_soften_extruders.insert(extder.id);
}
} }
} }
} }
@ -3530,6 +3565,20 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
catch (std::exception&) { assert(0); } catch (std::exception&) { assert(0); }
} }
if (!known_fila_soften_extruders.empty()) {
const wxString& msg = wxString::Format(_L("The filament on %s may soften. Please unload."),
_get_ext_loc_str(known_fila_soften_extruders, obj_->m_extder_data.total_extder_count));
show_status(PrintDialogStatus::PrintStatusFilamentHighChamberTempSoft, std::vector<wxString> {msg});
return;
}
if (!unknown_fila_soften_extruders.empty()) {
const wxString& msg = wxString::Format(_L("The filament on %s is unknown and may soften. Please set filament."),
_get_ext_loc_str(unknown_fila_soften_extruders, obj_->m_extder_data.total_extder_count));
show_status(PrintDialogStatus::PrintStatusUnknownFilamentHighChamberTempSoft, std::vector<wxString> {msg});
return;
}
/** normal check **/ /** normal check **/
show_status(PrintDialogStatus::PrintStatusReadyToGo); show_status(PrintDialogStatus::PrintStatusReadyToGo);
} }