mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 10:02:12 +00:00
FIX: Parse virtual slot info
jira: STUDIO-7724, STUDIO-7725 Change-Id: Id9181511b7503787fe06403be6ecb782d78cb21e (cherry picked from commit 286eca79c2c0824522f0917123c9315f8df65dee)
This commit is contained in:
@@ -1993,7 +1993,7 @@ void CalibrationPresetPage::sync_ams_info(MachineObject* obj)
|
||||
for (const AmsTray& vt_tray : obj->vt_slot) {
|
||||
if (vt_tray.id == std::to_string(VIRTUAL_TRAY_MAIN_ID)) {
|
||||
AMSinfo info;
|
||||
info.ReadExtInfo(vt_tray);
|
||||
info.parse_ext_info(obj, vt_tray);
|
||||
info.ams_type = AMSModel::EXT_AMS;
|
||||
|
||||
assert(m_main_ams_preview_list.size() == 4);
|
||||
@@ -2003,7 +2003,7 @@ void CalibrationPresetPage::sync_ams_info(MachineObject* obj)
|
||||
}
|
||||
else if (vt_tray.id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
|
||||
AMSinfo info;
|
||||
info.ReadExtInfo(vt_tray);
|
||||
info.parse_ext_info(obj, vt_tray);
|
||||
info.ams_type = AMSModel::EXT_AMS;
|
||||
|
||||
assert(m_deputy_ams_preview_list.size() == 4);
|
||||
|
||||
@@ -2643,6 +2643,16 @@ void StatusPanel::update_ams(MachineObject *obj)
|
||||
ams_info.push_back(info);
|
||||
}
|
||||
}
|
||||
std::vector<AMSinfo> ext_info;
|
||||
ext_info.clear();
|
||||
for (auto slot : obj->vt_slot) {
|
||||
AMSinfo info;
|
||||
info.parse_ext_info(obj, slot);
|
||||
if (ams_mode == AMSModel::AMS_LITE) info.ext_type = AMSModelOriginType::LITE_EXT;
|
||||
ext_info.push_back(info);
|
||||
}
|
||||
std::string dev_id = obj->dev_id;
|
||||
NozzleData data = obj->m_nozzle_data;
|
||||
//if (obj->ams_exist_bits != last_ams_exist_bits || obj->tray_exist_bits != last_tray_exist_bits || obj->tray_is_bbl_bits != last_tray_is_bbl_bits ||
|
||||
// obj->tray_read_done_bits != last_read_done_bits || obj->ams_version != last_ams_version) {
|
||||
// m_ams_control->UpdateAms(ams_info, false);
|
||||
|
||||
@@ -120,23 +120,50 @@ bool AMSinfo::parse_ams_info(MachineObject *obj, Ams *ams, bool remain_flag, boo
|
||||
return true;
|
||||
}
|
||||
|
||||
void AMSinfo::ReadExtInfo(AmsTray tray) {
|
||||
void AMSinfo::parse_ext_info(MachineObject* obj, AmsTray tray) {
|
||||
|
||||
this->ams_id = tray.id;
|
||||
this->ams_type = AMSModel::EXT_AMS;
|
||||
Caninfo can;
|
||||
can.can_id = std::to_string(0);
|
||||
can.material_name = tray.filament_setting_id;
|
||||
this->cans.push_back(can);
|
||||
if (tray.id == std::to_string(VIRTUAL_TRAY_MAIN_ID)) {
|
||||
Caninfo info;
|
||||
info.can_id = std::to_string(0);
|
||||
this->cans.clear();
|
||||
|
||||
if (tray.id == std::to_string(VIRTUAL_TRAY_MAIN_ID))
|
||||
this->nozzle_id = 0;
|
||||
else if (tray.id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID))
|
||||
this->nozzle_id = 1;
|
||||
|
||||
if (tray.is_tray_info_ready()) {
|
||||
info.ctype = tray.ctype;
|
||||
info.material_name = tray.get_display_filament_type();
|
||||
if (!tray.color.empty()) {
|
||||
info.material_colour = AmsTray::decode_color(tray.color);
|
||||
}
|
||||
else {
|
||||
// set to white by default
|
||||
info.material_colour = AMS_TRAY_DEFAULT_COL;
|
||||
}
|
||||
|
||||
for (std::string cols : tray.cols) {
|
||||
info.material_cols.push_back(AmsTray::decode_color(cols));
|
||||
}
|
||||
info.material_remain = 100;
|
||||
}
|
||||
else {
|
||||
this->nozzle_id = 1;
|
||||
info.material_name = "";
|
||||
info.ctype = 0;
|
||||
info.material_colour = AMS_TRAY_DEFAULT_COL;
|
||||
wxColour(255, 255, 255);
|
||||
}
|
||||
this->cans[0].material_state = AMSCanType::AMS_CAN_TYPE_VIRTUAL;
|
||||
this->cans[0].material_colour = tray.decode_color(tray.color);
|
||||
this->cans[0].material_remain = tray.remain;
|
||||
this->cans[0].material_name = tray.type;
|
||||
info.material_state = AMSCanType::AMS_CAN_TYPE_VIRTUAL;
|
||||
if (tray.is_tray_info_ready() && obj->cali_version >= 0) {
|
||||
CalibUtils::get_pa_k_n_value_by_cali_idx(obj, tray.cali_idx, info.k, info.n);
|
||||
}
|
||||
else {
|
||||
info.k = tray.k;
|
||||
info.n = tray.n;
|
||||
}
|
||||
this->cans.push_back(info);
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
|
||||
@@ -219,7 +219,7 @@ public:
|
||||
};
|
||||
|
||||
bool parse_ams_info(MachineObject* obj, Ams *ams, bool remain_flag = false, bool humidity_flag = false);
|
||||
void ReadExtInfo(AmsTray tray);
|
||||
void parse_ext_info(MachineObject* obj, AmsTray tray);
|
||||
bool support_drying() const { return (ams_type == AMSModel::N3S_AMS) || (ams_type == AMSModel::N3F_AMS); };
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user