mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-29 06:13:16 +08:00
FIX: move the state record to higher coding level
jira: [STUDIO-10050] Change-Id: I1e0721c80492688c66e700979461ac0bdd396ef4
This commit is contained in:
parent
4c9d891700
commit
371ef9c554
@ -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)
|
||||
@ -5991,10 +5996,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);
|
||||
|
@ -948,6 +948,9 @@ public:
|
||||
int nozzle_selected_count = 0;
|
||||
bool flag_update_nozzle = {true};
|
||||
|
||||
/*target from Studio-SwitchBoard, default to INVALID_NOZZLE_ID if no switching control from PC*/
|
||||
int targ_nozzle_id_from_pc = INVALID_NOZZLE_ID;
|
||||
|
||||
//supported features
|
||||
bool is_support_chamber_edit{false};
|
||||
bool is_support_extrusion_cali{false};
|
||||
|
@ -2832,7 +2832,6 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
|
||||
m_nozzle_btn_panel->updateState("left");
|
||||
}
|
||||
|
||||
targ_nozzle_id_from_pc = INVALID_NOZZLE_ID;// the switching is finished
|
||||
obj->flag_update_nozzle = false;
|
||||
}
|
||||
|
||||
@ -2840,7 +2839,7 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
|
||||
/* Can do switch while printing pause STUDIO-9789*/
|
||||
if ((obj->is_in_printing() && !obj->is_in_printing_pause()) ||
|
||||
obj->ams_status_main == AMS_STATUS_MAIN_FILAMENT_CHANGE ||
|
||||
targ_nozzle_id_from_pc != INVALID_NOZZLE_ID)
|
||||
obj->targ_nozzle_id_from_pc != INVALID_NOZZLE_ID)
|
||||
{
|
||||
m_nozzle_btn_panel->Disable();
|
||||
}
|
||||
@ -4691,9 +4690,8 @@ void StatusPanel::on_nozzle_selected(wxCommandEvent &event)
|
||||
}
|
||||
|
||||
auto nozzle_id = event.GetInt();
|
||||
if(obj->command_select_extruder(nozzle_id) == 0)
|
||||
if (obj->command_select_extruder(nozzle_id) == 0)
|
||||
{
|
||||
targ_nozzle_id_from_pc = nozzle_id;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -411,8 +411,6 @@ protected:
|
||||
wxSimplebook* m_extruder_book;
|
||||
std::vector<ExtruderImage *> m_extruderImage;
|
||||
|
||||
/*the target nozzle id from PC-SwitchBoard, default to INVALID_NOZZLE_ID if not switching*/
|
||||
int targ_nozzle_id_from_pc = INVALID_NOZZLE_ID;
|
||||
SwitchBoard * m_nozzle_btn_panel;
|
||||
|
||||
wxStaticText * m_text_tasklist_caption;
|
||||
|
Loading…
x
Reference in New Issue
Block a user