mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-28 17:03:12 +08:00
FIX: fix some issue in sending files to external storage through cloud
JIRA: STUDIO-9372 STUDIO-9374 STUDIO-9368 If the printer version does not support uploading, the original protocol will be used Change-Id: I3d47ac2567c2c6709a5b983ff1ad552d9a8606d4
This commit is contained in:
parent
1ff6e8ef65
commit
b8dde8ae7f
@ -6219,6 +6219,7 @@ void MachineObject::parse_new_info(json print)
|
||||
is_support_upgrade_kit = get_flag_bits(fun, 14);
|
||||
is_support_internal_timelapse = get_flag_bits(fun, 28);
|
||||
is_support_command_homing = get_flag_bits(fun, 32);
|
||||
is_support_brtc = get_flag_bits(fun, 31);
|
||||
}
|
||||
|
||||
/*aux*/
|
||||
|
@ -1081,6 +1081,7 @@ public:
|
||||
bool is_support_filament_setting_inprinting{false};
|
||||
bool is_support_internal_timelapse { false };// fun[28], support timelapse without SD card
|
||||
bool is_support_command_homing { false };// fun[32]
|
||||
bool is_support_brtc { false }; // fun[31], support tcp and upload protocol
|
||||
|
||||
bool installed_upgrade_kit{false};
|
||||
int bed_temperature_limit = -1;
|
||||
|
@ -560,6 +560,7 @@ void PrinterFileSystem::Stop(bool quit)
|
||||
|
||||
void PrinterFileSystem::SetUploadFile(const std::string &path, const std::string &name, const std::string &select_storage)
|
||||
{
|
||||
boost::unique_lock l(m_mutex);
|
||||
if (!m_upload_file) {
|
||||
m_upload_file = std::make_unique<UploadFile>();
|
||||
}
|
||||
|
@ -857,7 +857,7 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
|
||||
file_name = default_output_file_path.filename().string();
|
||||
}*/
|
||||
#if !BBL_RELEASE_TO_PUBLIC
|
||||
if (!obj_->is_lan_mode_printer()) {
|
||||
if (!obj_->is_lan_mode_printer() && obj_->is_support_brtc) {
|
||||
update_print_status_msg(wxEmptyString, false, false);
|
||||
if (m_file_sys) {
|
||||
PrintPrepareData print_data;
|
||||
@ -865,21 +865,16 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
|
||||
std::string project_name = m_current_project_name.utf8_string() + ".3mf";
|
||||
std::string _3mf_path = print_data._3mf_path.string();
|
||||
|
||||
std::string storage;
|
||||
auto it = std::find_if(m_ability_list.begin(), m_ability_list.end(), [](const std::string& s) {
|
||||
return s != EMMC_STORAGE;
|
||||
});
|
||||
|
||||
if (it != m_ability_list.end())
|
||||
if (it != m_ability_list.end()) {
|
||||
m_file_sys->SetUploadFile(_3mf_path, project_name, *it);
|
||||
else {
|
||||
BOOST_LOG_TRIVIAL(info) << "SendToPrinter::send job: The printer media capability set is incorrect.";
|
||||
}
|
||||
m_file_sys->RequestUploadFile();
|
||||
|
||||
// time out
|
||||
if (m_task_timer && m_task_timer->IsRunning())
|
||||
m_task_timer->Stop();
|
||||
if (m_task_timer && m_task_timer->IsRunning()) m_task_timer->Stop();
|
||||
|
||||
m_task_timer.reset(new wxTimer());
|
||||
m_task_timer->SetOwner(this);
|
||||
@ -897,6 +892,12 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
|
||||
m_task_timer->GetId());
|
||||
m_task_timer->StartOnce(timeout_period);
|
||||
}
|
||||
else {
|
||||
BOOST_LOG_TRIVIAL(error) << "SendToPrinter::send job: The printer media capability set is incorrect.";
|
||||
show_status(PrintDialogStatus::PrintStatusPublicUploadFiled);
|
||||
update_print_status_msg(_L("No available external storage was obtained. Please confirm and try again."), true, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
m_send_job = std::make_shared<SendJob>(m_status_bar, m_plater, m_printer_last_select);
|
||||
@ -993,7 +994,10 @@ void SendToPrinterDialog::on_refresh(wxCommandEvent &event)
|
||||
show_status(PrintDialogStatus::PrintStatusRefreshingMachineList);
|
||||
update_user_machine_list();
|
||||
/*todo refresh*/
|
||||
/*if (m_file_sys) { m_file_sys->Retry(); }*/
|
||||
if (m_file_sys) {
|
||||
m_file_sys->Stop(true);
|
||||
m_file_sys.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void SendToPrinterDialog::on_print_job_cancel(wxCommandEvent &evt)
|
||||
@ -1233,11 +1237,16 @@ void SendToPrinterDialog::update_show_status()
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (obj_->connection_type() == "lan") {
|
||||
if (obj_->connection_type() == "lan" || !obj_->is_support_brtc) {
|
||||
if (m_file_sys) {
|
||||
m_device_select.clear();
|
||||
m_file_sys->Stop(true);
|
||||
m_file_sys.reset();
|
||||
}
|
||||
show_status(PrintDialogStatus::PrintStatusReadingFinished);
|
||||
return;
|
||||
} else if (obj_->connection_type() == "cloud") {
|
||||
Enable(obj_ && obj_->is_connected() && obj_->m_push_count > 0);
|
||||
Enable(obj_ && obj_->is_connected());
|
||||
std::string dev_id = obj_->dev_ip;
|
||||
if (m_file_sys) {
|
||||
if (dev_id == m_device_select) {
|
||||
@ -1275,11 +1284,8 @@ void SendToPrinterDialog::update_show_status()
|
||||
m_task_timer->SetOwner(this);
|
||||
|
||||
this->Bind(wxEVT_TIMER, [this, wfs_1 = boost::weak_ptr(fs), seq](auto e) {
|
||||
show_status(PrintDialogStatus::PrintStatusPublicUploadFiled);
|
||||
boost::shared_ptr fs_1(wfs_1.lock());
|
||||
if (!fs_1) return;
|
||||
fs_1->CancelUploadTask(false);
|
||||
update_print_status_msg(_L("Media capability acquisition timeout, please check if the firmware version supports it."), false, true);
|
||||
show_status(PrintDialogStatus::PrintStatusPublicInitFailed);
|
||||
update_print_status_msg(_L("Media capability acquisition timeout, please check if the firmware version supports it."), true, true);
|
||||
}, m_task_timer->GetId());
|
||||
m_task_timer->StartOnce(timeout_period);
|
||||
|
||||
@ -1680,11 +1686,10 @@ bool SendToPrinterDialog::Show(bool show)
|
||||
if (show) { CenterOnParent(); }
|
||||
|
||||
#if !BBL_RELEASE_TO_PUBLIC
|
||||
if (m_file_sys && !show) {
|
||||
m_file_sys->Stop(true);
|
||||
if (m_file_sys) {
|
||||
m_waiting_enable = false;
|
||||
m_waiting_support = false;
|
||||
m_file_sys.reset();
|
||||
show ? m_file_sys->Start() : m_file_sys->Stop();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user