FIX: do not clear access code when connection lost

Change-Id: I540f26def8946b85c7cf9d2bff78c57287c911d8
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2022-09-09 11:42:11 +08:00 committed by Lane.Wei
parent 70030768a1
commit d20656b869
1 changed files with 4 additions and 1 deletions

View File

@ -1588,7 +1588,7 @@ void GUI_App::init_networking_callbacks()
if (state == ConnectStatus::ConnectStatusOk) { if (state == ConnectStatus::ConnectStatusOk) {
obj->command_request_push_all(); obj->command_request_push_all();
obj->command_get_version(); obj->command_get_version();
} else if (state == ConnectStatus::ConnectStatusFailed || ConnectStatus::ConnectStatusLost) { } else if (state == ConnectStatus::ConnectStatusFailed) {
obj->set_access_code(""); obj->set_access_code("");
wxString text; wxString text;
if (msg == "5") { if (msg == "5") {
@ -1598,6 +1598,9 @@ void GUI_App::init_networking_callbacks()
text = wxString::Format(_L("Connect %s failed! [SN:%s, code=%s]"), from_u8(obj->dev_name), obj->dev_id, msg); text = wxString::Format(_L("Connect %s failed! [SN:%s, code=%s]"), from_u8(obj->dev_name), obj->dev_id, msg);
wxGetApp().show_dialog(text); wxGetApp().show_dialog(text);
} }
} else if (state == ConnectStatus::ConnectStatusLost) {
m_device_manager->set_selected_machine("");
BOOST_LOG_TRIVIAL(info) << "set_on_local_connect_fn: state = lost";
} else { } else {
BOOST_LOG_TRIVIAL(info) << "set_on_local_connect_fn: state = " << state; BOOST_LOG_TRIVIAL(info) << "set_on_local_connect_fn: state = " << state;
} }