ENH: move on_device_connected to CalibrationPanel
Change-Id: I856103e9e2cd623919e35a595a436cd67435ec86 Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
d3b9d5dcdc
commit
270acd4685
4 changed files with 21 additions and 9 deletions
|
@ -531,6 +531,15 @@ void CalibrationPanel::update_all() {
|
|||
m_cali_panels[curr_selected]->update(obj);
|
||||
}
|
||||
|
||||
if (obj) {
|
||||
if (last_obj != obj && obj->is_info_ready()) {
|
||||
for (int i = 0; i < CALI_MODE_COUNT; i++) {
|
||||
m_cali_panels[i]->on_device_connected(obj);
|
||||
}
|
||||
last_obj = obj;
|
||||
}
|
||||
}
|
||||
|
||||
// check valid machine
|
||||
if (obj && dev->get_my_machine(obj->dev_id) == nullptr) {
|
||||
dev->set_selected_machine("");
|
||||
|
|
|
@ -121,6 +121,7 @@ protected:
|
|||
bool m_initialized { false };
|
||||
std::string last_conn_type = "undedefined";
|
||||
MachineObject* obj{ nullptr };
|
||||
MachineObject* last_obj { nullptr };
|
||||
SideTools* m_side_tools{ nullptr };
|
||||
Tabbook* m_tabpanel{ nullptr };
|
||||
SelectMObjectPopup m_mobjectlist_popup;
|
||||
|
|
|
@ -88,12 +88,6 @@ void CalibrationWizard::update(MachineObject* obj)
|
|||
m_page_steps[i]->page->on_reset_page();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (last_obj != obj && obj->is_info_ready()) {
|
||||
this->on_device_connected(obj);
|
||||
last_obj = obj;
|
||||
}
|
||||
}
|
||||
|
||||
// update all page steps
|
||||
for (int i = 0; i < m_page_steps.size(); i++) {
|
||||
|
|
|
@ -978,6 +978,8 @@ bool CalibrationPresetPage::is_filaments_compatiable(const std::vector<Preset*>
|
|||
|
||||
void CalibrationPresetPage::update_combobox_filaments(MachineObject* obj)
|
||||
{
|
||||
if (!obj) return;
|
||||
|
||||
//step 1: update combobox filament list
|
||||
float nozzle_value = get_nozzle_value();
|
||||
obj->cali_selected_nozzle_dia = nozzle_value;
|
||||
|
@ -1104,6 +1106,8 @@ void CalibrationPresetPage::update_show_status()
|
|||
|
||||
bool CalibrationPresetPage::need_check_sdcard(MachineObject* obj)
|
||||
{
|
||||
if (!obj) return false;
|
||||
|
||||
bool need_check = false;
|
||||
if (obj->printer_type == "BL-P001" || obj->printer_type == "BL-P002") {
|
||||
if (m_cali_mode == CalibMode::Calib_Flow_Rate && m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) {
|
||||
|
@ -1122,6 +1126,10 @@ bool CalibrationPresetPage::need_check_sdcard(MachineObject* obj)
|
|||
need_check = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
assert(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
return need_check;
|
||||
}
|
||||
|
@ -1382,10 +1390,10 @@ void CalibrationPresetPage::init_with_machine(MachineObject* obj)
|
|||
|
||||
void CalibrationPresetPage::sync_ams_info(MachineObject* obj)
|
||||
{
|
||||
std::map<int, DynamicPrintConfig> full_filament_ams_list = wxGetApp().sidebar().build_filament_ams_list(obj);
|
||||
|
||||
if (!obj) return;
|
||||
|
||||
std::map<int, DynamicPrintConfig> full_filament_ams_list = wxGetApp().sidebar().build_filament_ams_list(obj);
|
||||
|
||||
// sync filament_ams_list from obj ams list
|
||||
filament_ams_list.clear();
|
||||
for (auto& ams_item : obj->amsList) {
|
||||
|
@ -1672,7 +1680,7 @@ Preset* CalibrationPresetPage::get_print_preset()
|
|||
{
|
||||
Preset* printer_preset = get_printer_preset(curr_obj, get_nozzle_value());
|
||||
|
||||
Preset* print_preset;
|
||||
Preset* print_preset = nullptr;
|
||||
wxArrayString print_items;
|
||||
|
||||
// get default print profile
|
||||
|
|
Loading…
Reference in a new issue