From 6c7b61fcd8aefd9ad9da56da8b55e0c06865a677 Mon Sep 17 00:00:00 2001 From: tao wang Date: Wed, 11 Dec 2024 11:46:29 +0800 Subject: [PATCH] ENH:change SD card to external storage jira:[none ] Change-Id: Ia8fb38151f75433344a085196728752d2fe6f159 --- .../GUI/CalibrationWizardPresetPage.cpp | 4 +-- src/slic3r/GUI/Jobs/PrintJob.cpp | 26 +++++++++---------- src/slic3r/GUI/Jobs/SendJob.cpp | 12 ++++----- src/slic3r/GUI/MediaFilePanel.cpp | 6 ++--- src/slic3r/GUI/Printer/PrinterFileSystem.cpp | 2 +- src/slic3r/GUI/SelectMachine.cpp | 11 +++++--- src/slic3r/GUI/SendToPrinter.cpp | 8 +++--- src/slic3r/GUI/StatusPanel.cpp | 3 +-- src/slic3r/Utils/CalibUtils.cpp | 4 +-- 9 files changed, 40 insertions(+), 36 deletions(-) diff --git a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp index e27bffcde..113f7cf07 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp @@ -1656,12 +1656,12 @@ void CalibrationPresetPage::show_status(CaliPresetPageStatus status) Enable_Send_Button(false); } else if (status == CaliPresetPageStatus::CaliPresetStatusLanModeNoSdcard) { - wxString msg_text = _L("An SD card needs to be inserted before printing via LAN."); + wxString msg_text = _L("Storage needs to be inserted before printing via LAN."); update_print_status_msg(msg_text, true); Enable_Send_Button(true); } else if (status == CaliPresetPageStatus::CaliPresetStatusNoSdcard) { - wxString msg_text = _L("An SD card needs to be inserted before printing."); + wxString msg_text = _L("Storage needs to be inserted before printing."); update_print_status_msg(msg_text, true); Enable_Send_Button(false); } diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp index 223f087a2..73aac02aa 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.cpp +++ b/src/slic3r/GUI/Jobs/PrintJob.cpp @@ -138,7 +138,7 @@ wxString PrintJob::get_http_error_msg(unsigned int status, std::string body) ; } return wxEmptyString; -} +} void PrintJob::process() { @@ -282,8 +282,8 @@ void PrintJob::process() params.preset_name = profile_name->second; } catch (...) {} - } - + } + auto model_name = model_info->metadata_items.find(BBL_DESIGNER_MODEL_TITLE_TAG); if (model_name != model_info->metadata_items.end()) { try { @@ -352,7 +352,7 @@ void PrintJob::process() } } - + if (params.preset_name.empty() && m_print_type == "from_normal") { params.preset_name = wxString::Format("%s_plate_%d", m_project_name, curr_plate_idx).ToStdString(); } if (params.project_name.empty()) {params.project_name = m_project_name;} @@ -379,12 +379,12 @@ void PrintJob::process() bool is_try_lan_mode = false; bool is_try_lan_mode_failed = false; - auto update_fn = [this, + auto update_fn = [this, &is_try_lan_mode, &is_try_lan_mode_failed, - &msg, - &error_str, - &curr_percent, + &msg, + &error_str, + &curr_percent, &error_text, StagePercentPoint ](int stage, int code, std::string info) { @@ -447,7 +447,7 @@ void PrintJob::process() } } - //get errors + //get errors if (code > 100 || code < 0 || stage == BBL::SendingPrintJobStage::PrintingStageERROR) { if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE) { m_plater->update_print_error_info(code, desc_file_too_large.ToStdString(), info); @@ -468,7 +468,7 @@ void PrintJob::process() return was_canceled(); }; - + DeviceManager* dev = wxGetApp().getDeviceManager(); MachineObject* obj = dev->get_selected_machine(); @@ -586,13 +586,13 @@ void PrintJob::process() this->update_status(curr_percent, _L("Sending print job through cloud service")); result = m_agent->start_print(params, update_fn, cancel_fn, wait_fn); } - } + } } else { if (this->has_sdcard) { this->update_status(curr_percent, _L("Sending print job over LAN")); result = m_agent->start_local_print(params, update_fn, cancel_fn); } else { - this->update_status(curr_percent, _L("An SD card needs to be inserted before printing via LAN.")); + this->update_status(curr_percent, _L("Storage needs to be inserted before printing via LAN.")); return; } } @@ -624,7 +624,7 @@ void PrintJob::process() if (result != BAMBU_NETWORK_ERR_CANCELED) { this->show_error_info(msg_text, 0, "", ""); } - + BOOST_LOG_TRIVIAL(error) << "print_job: failed, result = " << result; } else { // wait for printer mqtt ready the same job id diff --git a/src/slic3r/GUI/Jobs/SendJob.cpp b/src/slic3r/GUI/Jobs/SendJob.cpp index 602abfb14..a8ee0f6ed 100644 --- a/src/slic3r/GUI/Jobs/SendJob.cpp +++ b/src/slic3r/GUI/Jobs/SendJob.cpp @@ -124,8 +124,8 @@ void SendJob::process() std::string http_body; - - + + // local print access params.dev_ip = m_dev_ip; params.username = "bblp"; @@ -151,7 +151,7 @@ void SendJob::process() m_job_finished = true; return; } - + /* display info */ msg = _L("Sending gcode file over LAN"); @@ -277,7 +277,7 @@ void SendJob::process() } } - //get errors + //get errors if (code > 100 || code < 0 || stage == BBL::SendingPrintJobStage::PrintingStageERROR) { if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE) { m_plater->update_print_error_info(code, desc_file_too_large.ToStdString(), info); @@ -312,7 +312,7 @@ void SendJob::process() else if (params.password.empty()) params.comments = "no_password"; - if (!params.password.empty() + if (!params.password.empty() && !params.dev_ip.empty() && this->has_sdcard) { // try to send local with record @@ -338,7 +338,7 @@ void SendJob::process() this->update_status(curr_percent, _L("Sending gcode file over LAN")); result = m_agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn, nullptr); } else { - this->update_status(curr_percent, _L("An SD card needs to be inserted before sending to printer.")); + this->update_status(curr_percent, _L("Storage needs to be inserted before sending to printer.")); return; } } diff --git a/src/slic3r/GUI/MediaFilePanel.cpp b/src/slic3r/GUI/MediaFilePanel.cpp index 52fb0d821..286ac56e1 100644 --- a/src/slic3r/GUI/MediaFilePanel.cpp +++ b/src/slic3r/GUI/MediaFilePanel.cpp @@ -461,12 +461,12 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr wfs) m_waiting_enable = false; if (!m_local_proto && !m_remote_proto) { m_waiting_support = true; - m_image_grid->SetStatus(m_bmp_failed, _L("Browsing file in SD card is not supported in current firmware. Please update the printer firmware.")); + m_image_grid->SetStatus(m_bmp_failed, _L("Browsing file in storage is not supported in current firmware. Please update the printer firmware.")); fs->SetUrl("0"); return; } if (!m_sdcard_exist) { - m_image_grid->SetStatus(m_bmp_failed, _L("Please check if the SD card is inserted into the printer.\nIf it still cannot be read, you can try formatting the SD card.")); + m_image_grid->SetStatus(m_bmp_failed, _L("Please check if the storage is inserted into the printer.\nIf it still cannot be read, you can try formatting the storage.")); fs->SetUrl("0"); return; } @@ -499,7 +499,7 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr wfs) return; } if (m_lan_mode) { - m_image_grid->SetStatus(m_bmp_failed, _L("Browsing file in SD card is not supported in LAN Only Mode.")); + m_image_grid->SetStatus(m_bmp_failed, _L("Browsing file in storage is not supported in LAN Only Mode.")); fs->SetUrl("0"); return; } diff --git a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp index 7e4eb2caa..bbe8d264f 100644 --- a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp +++ b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp @@ -54,7 +54,7 @@ static std::map error_messages = { {PrinterFileSystem::FILE_NO_EXIST, L("File does not exist.")}, {PrinterFileSystem::FILE_CHECK_ERR, L("File checksum error. Please retry.")}, {PrinterFileSystem::FILE_TYPE_ERR, L("Not supported on the current printer version.")}, - {PrinterFileSystem::STORAGE_UNAVAILABLE, L("Please check if the SD card is inserted into the printer.\nIf it still cannot be read, you can try formatting the SD card.")}, + {PrinterFileSystem::STORAGE_UNAVAILABLE, L("Please check if the storage is inserted into the printer.\nIf it still cannot be read, you can try formatting the storage.")}, {PrinterFileSystem::API_VERSION_UNSUPPORT, L("The firmware version of the printer is too low. Please update the firmware and try again.")}, {PrinterFileSystem::FILE_EXIST, L("The file already exists, do you want to replace it?")}, {PrinterFileSystem::STORAGE_SPACE_NOT_ENOUGH, L("Insufficient storage space, please clear the space and try again.")}, diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index f31ab635c..99ee55e1e 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -1772,7 +1772,12 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector(wxGetApp().mainframe), wxID_ANY, _L("Send to Printer SD card"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) + : DPIDialog(static_cast(wxGetApp().mainframe), wxID_ANY, _L("Send to Printer storage"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) , m_plater(plater), m_export_3mf_cancel(false) { #ifdef __WINDOWS__ @@ -580,7 +580,7 @@ void SendToPrinterDialog::update_storage_list(const std::vector& st m_storage_sizer->Add(radiobox, 0, wxALIGN_CENTER, 0); m_storage_sizer->Add(0, 0, 0, wxEXPAND|wxLEFT, FromDIP(6)); m_storage_sizer->Add(storage_text, 0, wxALIGN_CENTER,0); - m_storage_radioBox.push_back(radiobox); + m_storage_radioBox.push_back(radiobox); } if (m_storage_radioBox.size() > 0) { @@ -1444,7 +1444,7 @@ void SendToPrinterDialog::show_status(PrintDialogStatus status, std::vectorSetToolTip(_L("SD Card Abnormal")); //sdcard if (m_last_sdcard != (int)obj->get_sdcard_state()) { if (obj->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD) { @@ -4746,7 +4745,7 @@ void StatusPanel::on_camera_enter(wxMouseEvent& event) m_camera_popup->Bind(EVT_SDCARD_ABSENT_HINT, [this](wxCommandEvent &e) { if (sdcard_hint_dlg == nullptr) { sdcard_hint_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Warning"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM); - sdcard_hint_dlg->update_text(_L("Can't start this without SD card.")); + sdcard_hint_dlg->update_text(_L("Can't start this without storage.")); } sdcard_hint_dlg->on_show(); }); diff --git a/src/slic3r/Utils/CalibUtils.cpp b/src/slic3r/Utils/CalibUtils.cpp index fb4892266..09483e05c 100644 --- a/src/slic3r/Utils/CalibUtils.cpp +++ b/src/slic3r/Utils/CalibUtils.cpp @@ -1414,12 +1414,12 @@ void CalibUtils::send_to_print(const CalibInfo &calib_info, wxString &error_mess } else if (!obj_->is_support_print_without_sd && (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD)) { - error_message = _L("An SD card needs to be inserted before printing."); + error_message = _L("Storage needs to be inserted before printing."); return; } if (obj_->is_lan_mode_printer()) { if (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD) { - error_message = _L("An SD card needs to be inserted before printing via LAN."); + error_message = _L("Storage needs to be inserted before printing via LAN."); return; } }