FIX: move the state record to higher coding level

jira: [STUDIO-10050]
Change-Id: I1e0721c80492688c66e700979461ac0bdd396ef4
(cherry picked from commit 371ef9c554dff57e0685519b1c0931c8999c5841)
This commit is contained in:
xin.zhang 2025-01-20 14:25:19 +08:00 committed by Noisyfox
parent 054162a192
commit 4887de8cbe
4 changed files with 13 additions and 7 deletions

View file

@ -1725,8 +1725,13 @@ int MachineObject::command_select_extruder(int id)
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
j["print"]["command"] = "select_extruder";
j["print"]["extruder_index"] = id;
int rtn = this->publish_json(j.dump(), 1);
if (rtn == 0)
{
targ_nozzle_id_from_pc = id;
}
return this->publish_json(j.dump(), 1);
return rtn;
}
int MachineObject::command_get_version(bool with_retry)
@ -6021,10 +6026,12 @@ void MachineObject::parse_new_info(json print)
if (m_extder_data.current_extder_id != extder_data.current_extder_id)
{
flag_update_nozzle = true;
targ_nozzle_id_from_pc = INVALID_NOZZLE_ID;
}
else if (extder_data.switch_extder_state == ES_SWITCHING_FAILED)
{
flag_update_nozzle = true;
targ_nozzle_id_from_pc = INVALID_NOZZLE_ID;
}
extder_data.current_loading_extder_id = get_flag_bits(extruder["state"].get<int>(), 15, 4);