ENH:select the first tray when switching AMS
Change-Id: I74487f9bda81df199685b31e6fb7f5dbcaeef607 Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
8a3b39345e
commit
23fb4dba2e
|
@ -3084,6 +3084,9 @@ int MachineObject::parse_json(std::string payload)
|
|||
vt_tray.k = jj["vt_tray"]["k"].get<float>();
|
||||
if (jj["vt_tray"].contains("n"))
|
||||
vt_tray.n = jj["vt_tray"]["n"].get<float>();
|
||||
ams_support_virtual_tray = true;
|
||||
} else {
|
||||
ams_support_virtual_tray = false;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
|
|
|
@ -757,6 +757,7 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent)
|
|||
m_switch_speed = new ImageSwitchButton(parent, m_bitmap_speed_active, m_bitmap_speed);
|
||||
m_switch_speed->SetLabels(_L("100%"), _L("100%"));
|
||||
m_switch_speed->SetMinSize(MISC_BUTTON_SIZE);
|
||||
m_switch_speed->SetMaxSize(MISC_BUTTON_SIZE);
|
||||
m_switch_speed->SetPadding(FromDIP(3));
|
||||
m_switch_speed->SetBorderWidth(FromDIP(2));
|
||||
m_switch_speed->SetFont(Label::Head_13);
|
||||
|
@ -773,6 +774,7 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent)
|
|||
m_switch_lamp = new ImageSwitchButton(parent, m_bitmap_lamp_on, m_bitmap_lamp_off);
|
||||
m_switch_lamp->SetLabels(_L("Lamp"), _L("Lamp"));
|
||||
m_switch_lamp->SetMinSize(MISC_BUTTON_SIZE);
|
||||
m_switch_lamp->SetMaxSize(MISC_BUTTON_SIZE);
|
||||
m_switch_lamp->SetPadding(FromDIP(3));
|
||||
m_switch_lamp->SetBorderWidth(FromDIP(2));
|
||||
m_switch_lamp->SetFont(Label::Head_13);
|
||||
|
@ -2531,13 +2533,21 @@ void StatusPanel::on_ams_setting_click(SimpleEvent &event)
|
|||
m_ams_setting_dlg->update_insert_material_read_mode(obj->ams_insert_flag);
|
||||
m_ams_setting_dlg->update_starting_read_mode(obj->ams_power_on_flag);
|
||||
std::string ams_id = m_ams_control->GetCurentAms();
|
||||
try {
|
||||
int ams_id_int = atoi(ams_id.c_str());
|
||||
m_ams_setting_dlg->ams_id = ams_id_int;
|
||||
m_ams_setting_dlg->ams_support_remain = obj->ams_support_remain;
|
||||
m_ams_setting_dlg->Show();
|
||||
} catch (...) {
|
||||
;
|
||||
if (ams_id.compare(std::to_string(VIRTUAL_TRAY_ID)) == 0) {
|
||||
wxString txt = _L("AMS settings are not supported for external spool");
|
||||
MessageDialog msg_dlg(nullptr, txt, wxEmptyString, wxICON_WARNING | wxOK);
|
||||
msg_dlg.ShowModal();
|
||||
return;
|
||||
} else {
|
||||
try {
|
||||
int ams_id_int = atoi(ams_id.c_str());
|
||||
m_ams_setting_dlg->ams_id = ams_id_int;
|
||||
m_ams_setting_dlg->ams_support_remain = obj->ams_support_remain;
|
||||
m_ams_setting_dlg->Show();
|
||||
}
|
||||
catch (...) {
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2586,7 +2596,7 @@ void StatusPanel::on_filament_extrusion_cali(wxCommandEvent &event)
|
|||
try {
|
||||
m_extrusion_cali_dlg->ams_id = ams_id_int;
|
||||
m_extrusion_cali_dlg->tray_id = tray_id_int;
|
||||
m_extrusion_cali_dlg->SetPosition(m_ams_control->GetScreenPosition());
|
||||
m_extrusion_cali_dlg->SetPosition(m_staticText_control->GetScreenPosition());
|
||||
m_extrusion_cali_dlg->Popup();
|
||||
} catch(...) {
|
||||
;
|
||||
|
|
|
@ -559,7 +559,7 @@ void AMSLib::render(wxDC &dc)
|
|||
if (m_info.material_state == AMSCanType::AMS_CAN_TYPE_THIRDBRAND
|
||||
|| m_info.material_state == AMSCanType::AMS_CAN_TYPE_BRAND
|
||||
|| m_info.material_state == AMSCanType::AMS_CAN_TYPE_VIRTUAL) {
|
||||
if (m_info.material_name.empty()) {
|
||||
if (m_info.material_name.empty() && m_info.material_state != AMSCanType::AMS_CAN_TYPE_VIRTUAL) {
|
||||
auto tsize = dc.GetMultiLineTextExtent("?");
|
||||
auto pot = wxPoint(0, 0);
|
||||
if (m_show_kn) {
|
||||
|
@ -1337,6 +1337,18 @@ void AmsCans::AddCan(Caninfo caninfo, int canindex, int maxcan)
|
|||
m_can_road_list.Add(canroad);
|
||||
}
|
||||
|
||||
|
||||
void AmsCans::SetDefSelectCan()
|
||||
{
|
||||
if (m_can_lib_list.GetCount() > 0) {
|
||||
CanLibs* lib = m_can_lib_list[0];
|
||||
m_canlib_selection =lib->canLib->m_can_index;
|
||||
m_canlib_id = lib->canLib->m_info.can_id;
|
||||
SelectCan(m_canlib_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AmsCans::SelectCan(std::string canid)
|
||||
{
|
||||
for (auto i = 0; i < m_can_lib_list.GetCount(); i++) {
|
||||
|
@ -1699,9 +1711,10 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
|
|||
|
||||
Bind(EVT_AMS_UNSELETED_VAMS, [this](wxCommandEvent& e) {
|
||||
m_current_ams = e.GetString().ToStdString();
|
||||
SwitchAms(m_current_ams);
|
||||
m_vams_lib->UnSelected();
|
||||
e.Skip();
|
||||
});
|
||||
});
|
||||
|
||||
wxBoxSizer* m_sizer_vams = new wxBoxSizer(wxVERTICAL);
|
||||
m_sizer_vams->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(14));
|
||||
|
@ -1908,18 +1921,21 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons
|
|||
m_button_extrusion_cali->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AMSControl::on_extrusion_cali), NULL, this);
|
||||
m_button_extruder_feed->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AMSControl::on_filament_load), NULL, this);
|
||||
m_button_extruder_back->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(AMSControl::on_filament_unload), NULL, this);
|
||||
|
||||
m_button_ams_setting->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent& e) {
|
||||
m_button_ams_setting->SetBitmap(m_button_ams_setting_hover.bmp());
|
||||
e.Skip();
|
||||
});
|
||||
});
|
||||
m_button_ams_setting->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
|
||||
m_button_ams_setting->SetBitmap(m_button_ams_setting_press.bmp());
|
||||
on_ams_setting_click(e);
|
||||
e.Skip();
|
||||
});
|
||||
});
|
||||
|
||||
m_button_ams_setting->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) {
|
||||
m_button_ams_setting->SetBitmap(m_button_ams_setting_normal.bmp());
|
||||
e.Skip();
|
||||
});
|
||||
});
|
||||
|
||||
Bind(EVT_AMS_SHOW_HUMIDITY_TIPS, [this](wxCommandEvent& evt) {
|
||||
wxPoint img_pos = ClientToScreen(wxPoint(0, 0));
|
||||
|
@ -2308,6 +2324,16 @@ void AMSControl::SwitchAms(std::string ams_id)
|
|||
if (item->amsItem->m_amsinfo.ams_id == ams_id) {
|
||||
item->amsItem->OnSelected();
|
||||
//item->amsItem->ShowHumidity();
|
||||
|
||||
if (m_current_ams == std::to_string(VIRTUAL_TRAY_ID)) {
|
||||
for (auto i = 0; i < m_ams_cans_list.GetCount(); i++) {
|
||||
AmsCansWindow* ams = m_ams_cans_list[i];
|
||||
if (ams->amsCans->m_info.ams_id == ams_id) {
|
||||
ams->amsCans->SetDefSelectCan();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_current_senect = ams_id;
|
||||
} else {
|
||||
item->amsItem->UnSelected();
|
||||
|
|
|
@ -392,6 +392,7 @@ public:
|
|||
void Update(AMSinfo info);
|
||||
void create(wxWindow *parent, wxWindowID id, AMSinfo info, const wxPoint &pos, const wxSize &size);
|
||||
void AddCan(Caninfo caninfo, int canindex, int maxcan);
|
||||
void SetDefSelectCan();
|
||||
void SelectCan(std::string canid);
|
||||
void SetAmsStep(wxString canid, AMSPassRoadType type, AMSPassRoadSTEP step);
|
||||
//wxColour GetCanColour(wxString canid);
|
||||
|
|
Loading…
Reference in New Issue