mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 03:13:39 +00: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:
@@ -4059,17 +4059,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||||||
Ams* curr_ams = nullptr;
|
Ams* curr_ams = nullptr;
|
||||||
auto ams_it = amsList.find(ams_id);
|
auto ams_it = amsList.find(ams_id);
|
||||||
if (ams_it == amsList.end()) {
|
if (ams_it == amsList.end()) {
|
||||||
Ams* new_ams = new Ams(ams_id, nozzle_id, type_id);
|
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 (...) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
amsList.insert(std::make_pair(ams_id, new_ams));
|
amsList.insert(std::make_pair(ams_id, new_ams));
|
||||||
// new ams added event
|
// new ams added event
|
||||||
curr_ams = new_ams;
|
curr_ams = new_ams;
|
||||||
@@ -4078,6 +4068,25 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||||||
}
|
}
|
||||||
if (!curr_ams) continue;
|
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())
|
if (it->contains("dry_time") && (*it)["dry_time"].is_number())
|
||||||
{
|
{
|
||||||
curr_ams->left_dry_time = (*it)["dry_time"].get<int>();
|
curr_ams->left_dry_time = (*it)["dry_time"].get<int>();
|
||||||
|
|||||||
Reference in New Issue
Block a user