ENH:use new command based on AMS type

jira:[none]

Change-Id: I9411aa5b673b4270fe468a07c38d9966bd31a29a
This commit is contained in:
tao wang 2025-04-01 13:02:04 +08:00 committed by lane.wei
parent 8c3304723e
commit 83de229aa1
3 changed files with 11 additions and 2 deletions

View File

@ -4486,8 +4486,9 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
int type_id = 1; // 0:dummy 1:ams 2:ams-lite 3:n3f 4:n3s
/*ams info*/
std::string info;
if (it->contains("info")) {
std::string info = (*it)["info"].get<std::string>();
info = (*it)["info"].get<std::string>();
type_id = get_flag_bits(info, 0, 4);
nozzle_id = get_flag_bits(info, 8, 4);
}
@ -4503,7 +4504,8 @@ 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);
Ams* new_ams = new Ams(ams_id, nozzle_id, type_id);
new_ams->info = info;
try {
if (!ams_id.empty()) {

View File

@ -374,6 +374,7 @@ public:
type = type_id;
}
std::string id;
std::string info;
int left_dry_time = 0;
int humidity = 5;
int humidity_raw = -1; // the percentage, -1 means invalid. eg. 100 means 100%

View File

@ -4552,6 +4552,12 @@ void StatusPanel::on_ams_refresh_rfid(wxCommandEvent &event)
if (obj->m_extder_data.total_extder_count <= 1 && !obj->is_enable_np) {
has_filament_at_extruder = obj->is_filament_at_extruder();
/*for xp support n3s/n3f*/
if (!ams_it->second->info.empty()) {
use_new_command = true;
}
} else {
use_new_command = true;