mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-27 09:59:48 -07:00
Fix AMS HT display if it's the only AMS
(cherry picked from commit bambulab/BambuStudio@a182fa1aa4) --------- Co-authored-by: tao wang <tao.wang@bambulab.com>
This commit is contained in:
parent
4339bd308e
commit
b88b1e4819
1 changed files with 20 additions and 11 deletions
|
|
@ -4059,17 +4059,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
Ams* curr_ams = nullptr;
|
||||
auto ams_it = amsList.find(ams_id);
|
||||
if (ams_it == amsList.end()) {
|
||||
Ams* new_ams = new Ams(ams_id, nozzle_id, type_id);
|
||||
|
||||
try {
|
||||
if (!ams_id.empty()) {
|
||||
int ams_id_int = atoi(ams_id.c_str());
|
||||
new_ams->is_exists = (ams_exist_bits & (1 << ams_id_int)) != 0 ? true : false;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
;
|
||||
}
|
||||
Ams* new_ams = new Ams(ams_id, nozzle_id, type_id);
|
||||
amsList.insert(std::make_pair(ams_id, new_ams));
|
||||
// new ams added event
|
||||
curr_ams = new_ams;
|
||||
|
|
@ -4078,6 +4068,25 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
}
|
||||
if (!curr_ams) continue;
|
||||
|
||||
/*set ams type flag*/
|
||||
curr_ams->type = type_id;
|
||||
|
||||
|
||||
/*set ams exist flag*/
|
||||
try {
|
||||
if (!ams_id.empty()) {
|
||||
int ams_id_int = atoi(ams_id.c_str());
|
||||
|
||||
if (type_id < 4) {
|
||||
curr_ams->is_exists = (ams_exist_bits & (1 << ams_id_int)) != 0 ? true : false;
|
||||
} else {
|
||||
curr_ams->is_exists = get_flag_bits(ams_exist_bits, 4 + (ams_id_int - 128));
|
||||
}
|
||||
}
|
||||
} catch (...) {
|
||||
;
|
||||
}
|
||||
|
||||
if (it->contains("dry_time") && (*it)["dry_time"].is_number())
|
||||
{
|
||||
curr_ams->left_dry_time = (*it)["dry_time"].get<int>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue