Do not connect to default BBL device during app startup (#10214)

* Do not connect to default device during app startup

* Connect to last selected machine automatically even if it's lan machine
Simplify default machine connection logic

* Select last machine automatically when available

* Check for LAN connection state after updating combobox selection.
This matches the logic of `SendPrint.cpp`.

* Avoid showing same error message multiple times until next connection attempt.

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Noisyfox
2025-07-26 00:18:56 +08:00
committed by GitHub
parent 68110eeecc
commit 85e66de431
4 changed files with 43 additions and 38 deletions

View File

@@ -2373,6 +2373,10 @@ void SelectMachineDialog::update_user_printer()
m_comboBox_printer->Set(machine_list_name);
MachineObject* obj = dev->get_selected_machine();
if (!obj) {
dev->load_last_machine();
obj = dev->get_selected_machine();
}
if (obj) {
if (obj->is_lan_mode_printer() && !obj->has_access_right()) {
@@ -2410,13 +2414,10 @@ void SelectMachineDialog::update_user_printer()
for (auto i = 0; i < m_list.size(); i++) {
if (m_list[i]->dev_id == m_printer_last_select) {
if (obj && !obj->get_lan_mode_connection_state()) {
m_comboBox_printer->SetSelection(i);
wxCommandEvent event(wxEVT_COMBOBOX);
event.SetEventObject(m_comboBox_printer);
wxPostEvent(m_comboBox_printer, event);
}
m_comboBox_printer->SetSelection(i);
wxCommandEvent event(wxEVT_COMBOBOX);
event.SetEventObject(m_comboBox_printer);
wxPostEvent(m_comboBox_printer, event);
}
}
}
@@ -2594,7 +2595,7 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
}
}
if (obj) {
if (obj && !obj->get_lan_mode_connection_state()) {
obj->command_get_version();
obj->command_request_push_all();
if (!dev->get_selected_machine()) {