ENH: refine ams logic

update ams settings
add rfid reading bits

Change-Id: If46d2a3bf896e1279514aba94e5facdaee12014d
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2022-08-31 20:02:57 +08:00 committed by Lane.Wei
parent 0ed5b956ae
commit a688265bfd
7 changed files with 84 additions and 11 deletions

View file

@ -1091,7 +1091,9 @@ wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *par
checkbox->SetToolTip(tooltip);
text->SetToolTip(tooltip);
text->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &) { ams_check->SetValue(ams_check->GetValue() ? false : true); });
text->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &) {
ams_check->SetValue(ams_check->GetValue() ? false : true);
});
return checkbox;
}
@ -1454,6 +1456,10 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
update_print_status_msg(msg_text, true, true);
Enable_Send_Button(false);
Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusDisableAms) {
update_print_status_msg(wxEmptyString, false, false);
Enable_Send_Button(false);
Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusNeedUpgradingAms) {
wxString msg_text;
if (params.size() > 0)
@ -1895,6 +1901,15 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
update_show_status();
}
void SelectMachineDialog::update_ams_check(MachineObject* obj)
{
if (obj && obj->ams_support_use_ams) {
ams_check->Show();
} else {
ams_check->Hide();
}
}
void SelectMachineDialog::update_show_status()
{
// refreshing return
@ -1948,6 +1963,7 @@ void SelectMachineDialog::update_show_status()
}
reset_timeout();
update_ams_check(obj_);
// reading done
if (obj_->is_in_upgrading()) {
@ -1977,6 +1993,14 @@ void SelectMachineDialog::update_show_status()
return;
}
if (obj_->ams_support_use_ams) {
if (!ams_check->GetValue()) {
m_ams_mapping_result.clear();
show_status(PrintDialogStatus::PrintStatusDisableAms);
return;
}
}
// do ams mapping if no ams result
if (m_ams_mapping_result.empty()) {
do_ams_mapping(obj_);