diff --git a/src/slic3r/GUI/MediaFilePanel.cpp b/src/slic3r/GUI/MediaFilePanel.cpp index dd3eb9dcb..69b3fdd74 100644 --- a/src/slic3r/GUI/MediaFilePanel.cpp +++ b/src/slic3r/GUI/MediaFilePanel.cpp @@ -27,6 +27,7 @@ MediaFilePanel::MediaFilePanel(wxWindow * parent) , m_bmp_loading(this, "media_loading", 0) , m_bmp_failed(this, "media_failed", 0) , m_bmp_empty(this, "media_empty", 0) + , m_machine("") { SetBackgroundColour(0xEEEEEE); Hide(); @@ -219,14 +220,14 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj) m_model_download_support = false; } Enable(obj && obj->is_connected() && obj->m_push_count > 0); - if (machine == m_machine && (m_image_grid->GetFileSystem() || (!m_local_support && !m_remote_support))) { - if (m_waiting_enable && IsEnabled()) { + if (machine == m_machine) { + if ((m_waiting_enable && IsEnabled()) || (m_waiting_support && (m_local_support || m_remote_support))) { auto fs = m_image_grid->GetFileSystem(); if (fs) fs->Retry(); } return; } - m_machine = machine; + m_machine.swap(machine); m_last_errors.clear(); auto fs = m_image_grid->GetFileSystem(); if (fs) { @@ -238,10 +239,6 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj) SetSelecting(false); if (m_machine.empty()) { m_image_grid->SetStatus(m_bmp_failed, _L("No printers.")); - } else if (!IsEnabled()) { - m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Device connection not ready)!")); - } else if (!m_local_support && !m_remote_support) { - m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Not supported on the current printer version)!")); } else { boost::shared_ptr fs(new PrinterFileSystem); fs->Attached(); @@ -431,10 +428,12 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr wfs) } m_waiting_enable = false; if (!m_local_support && !m_remote_support) { + m_waiting_support = true; m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Not supported on the current printer version)!")); fs->SetUrl("0"); return; } + m_waiting_support = false; if ((m_lan_mode || !m_remote_support) && m_local_support && !m_lan_ip.empty()) { std::string url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd + "&device=" + m_machine + "&dev_ver=" + m_dev_ver; diff --git a/src/slic3r/GUI/MediaFilePanel.h b/src/slic3r/GUI/MediaFilePanel.h index a9f926a42..5f7273a58 100644 --- a/src/slic3r/GUI/MediaFilePanel.h +++ b/src/slic3r/GUI/MediaFilePanel.h @@ -87,6 +87,7 @@ private: bool m_remote_support = false; bool m_model_download_support = false; bool m_waiting_enable = false; + bool m_waiting_support = false; int m_last_mode = 0; int m_last_type = 0; diff --git a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp index 6702319d7..87916be93 100644 --- a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp +++ b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp @@ -1281,6 +1281,8 @@ void PrinterFileSystem::Reconnect(boost::unique_lock &l, int resul if (url.size() < 2) { wxLogMessage("PrinterFileSystem::Reconnect Initialize failed: %s", wxString::FromUTF8(url)); m_last_error = atoi(url.c_str()); + if (m_last_error == 0) + m_stopped = true; } else { wxLogMessage("PrinterFileSystem::Reconnect Initialized: %s", Slic3r::GUI::hide_passwd(wxString::FromUTF8(url), {"authkey=", "passwd="})); l.unlock();