ENH:change SD card to external storage

jira:[none ]

Change-Id: Ia8fb38151f75433344a085196728752d2fe6f159
This commit is contained in:
tao wang 2024-12-11 11:46:29 +08:00 committed by lane.wei
parent 23832a823c
commit 6c7b61fcd8
9 changed files with 40 additions and 36 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -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;
}
}

View File

@ -461,12 +461,12 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> 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<PrinterFileSystem> 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;
}

View File

@ -54,7 +54,7 @@ static std::map<int, std::string> 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.")},

View File

@ -1772,7 +1772,12 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
Enable_Send_Button(true);
Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusLanModeNoSdcard) {
wxString msg_text = _L("External storage 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, true);
Enable_Send_Button(true);
Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusLanModeSDcardNotAvailable) {
wxString msg_text = _L("Storage is not available or is in read-only mode.");
update_print_status_msg(msg_text, true, true);
Enable_Send_Button(true);
Enable_Refresh_Button(true);
@ -1787,7 +1792,7 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
Enable_Send_Button(true);
Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusNoSdcard) {
wxString msg_text = _L("External storage needs to be inserted before printing.");
wxString msg_text = _L("Storage needs to be inserted before printing.");
update_print_status_msg(msg_text, true, true);
Enable_Send_Button(false);
Enable_Refresh_Button(true);
@ -1827,7 +1832,7 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
Enable_Send_Button(false);
Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusTimelapseNoSdcard) {
wxString msg_text = _L("External storage needs to be inserted to record timelapse.");
wxString msg_text = _L("Storage needs to be inserted to record timelapse.");
update_print_status_msg(msg_text, true, true);
Enable_Send_Button(true);
Enable_Refresh_Button(true);

View File

@ -174,7 +174,7 @@ void SendToPrinterDialog::on_rename_enter()
}
SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
: DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, _L("Send to Printer SD card"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
: DPIDialog(static_cast<wxWindow *>(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<std::string>& 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::vector<wxSt
Enable_Refresh_Button(true);
}
else if (status == PrintDialogStatus::PrintStatusNoSdcard) {
wxString msg_text = _L("An SD card needs to be inserted before send to printer SD card.");
wxString msg_text = _L("Storage needs to be inserted before send to printer.");
update_print_status_msg(msg_text, true, true);
Enable_Send_Button(false);
Enable_Refresh_Button(true);
@ -1456,7 +1456,7 @@ void SendToPrinterDialog::show_status(PrintDialogStatus status, std::vector<wxSt
Enable_Refresh_Button(true);
}
else if (status == PrintDialogStatus::PrintStatusNotSupportedSendToSDCard) {
wxString msg_text = _L("The printer does not support sending to printer SD card.");
wxString msg_text = _L("The printer does not support sending to printer storage.");
update_print_status_msg(msg_text, true, true);
Enable_Send_Button(false);
Enable_Refresh_Button(true);

View File

@ -2059,7 +2059,6 @@ void StatusPanel::update_camera_state(MachineObject* obj)
{
if (!obj) return;
//m_bitmap_sdcard_abnormal_img->SetToolTip(_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();
});

View File

@ -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;
}
}