FIX: check sdcard exists for file connect

Change-Id: I69199a29294c04d1fe46ee66682085b1f1d1d049
Jira: none
This commit is contained in:
chunmao.guo 2023-12-29 10:57:25 +08:00 committed by Lane.Wei
parent 657050aa5c
commit 90419e1b39
2 changed files with 8 additions and 0 deletions

View File

@ -207,6 +207,7 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
m_lan_ip = obj->dev_ip;
m_lan_passwd = obj->get_access_code();
m_dev_ver = obj->get_ota_version();
m_sdcard_exist = obj->has_sdcard();
m_local_support = obj->file_local;
m_remote_support = obj->file_remote;
m_model_download_support = obj->file_model_download;
@ -215,6 +216,7 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
m_lan_ip.clear();
m_lan_passwd.clear();
m_dev_ver.clear();
m_sdcard_exist = false;
m_local_support = false;
m_remote_support = false;
m_model_download_support = false;
@ -433,6 +435,11 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
fs->SetUrl("0");
return;
}
if (!m_sdcard_exist) {
m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Storage unavailable, insert SD card.)!"));
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 +

View File

@ -83,6 +83,7 @@ private:
std::string m_lan_passwd;
std::string m_dev_ver;
bool m_lan_mode = false;
bool m_sdcard_exist = false;
bool m_local_support = false;
bool m_remote_support = false;
bool m_model_download_support = false;