Fix the pre-send advisories and port the remaining send-flow checks

This commit is contained in:
SoftFever
2026-07-17 12:10:45 +08:00
parent 7f8baf46d3
commit 37e27a24c4
7 changed files with 109 additions and 29 deletions

View File

@@ -491,7 +491,7 @@ void PrintJob::process(Ctl &ctl)
DeviceManager* dev = wxGetApp().getDeviceManager();
MachineObject* obj = dev->get_selected_machine();
auto wait_fn = [this, curr_percent, &obj](int state, std::string job_info) {
auto wait_fn = [this, &ctl, curr_percent, &obj](int state, std::string job_info) {
BOOST_LOG_TRIVIAL(info) << "print_job: get_job_info = " << job_info;
if (!obj->is_support_wait_sending_finish) {
@@ -523,6 +523,11 @@ void PrintJob::process(Ctl &ctl)
BOOST_LOG_TRIVIAL(info) << "print_job: printer has enter printing status, s = " << obj->print_status;
return true;
}
// Orca: break the wait-for-print-start loop on user cancel (resync).
if (ctl.was_canceled()) {
BOOST_LOG_TRIVIAL(info) << "print_job: user cancel the job " << obj->job_id_;
return true;
}
time_out++;
boost::this_thread::sleep_for(boost::chrono::milliseconds(1000));
}
@@ -639,7 +644,11 @@ void PrintJob::process(Ctl &ctl)
if (result < 0) {
curr_percent = -1;
if (result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) {
// Orca: restore the ENC-flag-not-ready message (resync). The printer is still fetching its
// encryption flag (a transient state), so ask the user to retry rather than showing a generic error.
if (result == BAMBU_NETOWRK_ERR_PRINT_SP_ENC_FLAG_NOT_READY) {
msg_text = _u8L("Retrieving printer information, please try again later.");
} else if (result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) {
msg_text = file_is_not_exists_str;
} else if (result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE || result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE) {
msg_text = file_over_size_str;

View File

@@ -117,6 +117,37 @@ void SendJob::process(Ctl &ctl)
ctl.call_on_main_thread([this] { prepare(); }).wait();
ctl.update_status(0, msg);
// Orca: IP/access-code verification pass (resync), adapted to the Worker/Job model. In check mode
// (InputIpAddressDialog / lan-mode send) verify the connection with a dummy "verify_job" upload and
// fire the caller's success/fail callback; when not continuing, stop here. Non-check-mode (cloud)
// sends skip this. Without it, set_check_mode()/check_and_continue() were dead and the IP-verify
// dialog's callbacks (ReleaseNote InputIpAddressDialog / SendToPrinter lan-mode) could never fire.
if (m_is_check_mode) {
PrintParams verify_params;
verify_params.dev_ip = m_dev_ip;
verify_params.username = "bblp";
verify_params.password = m_access_code;
verify_params.use_ssl_for_ftp = m_local_use_ssl_for_ftp;
verify_params.use_ssl_for_mqtt = m_local_use_ssl;
verify_params.dev_id = m_dev_id;
verify_params.project_name = "verify_job";
verify_params.filename = job_data._temp_path.string();
verify_params.connection_type = this->connection_type;
int verify_result = agent->start_send_gcode_to_sdcard(verify_params, nullptr, nullptr, nullptr);
if (verify_result != 0) {
BOOST_LOG_TRIVIAL(error) << "send_job: access code / ip verification failed, result = " << verify_result;
if (m_enter_ip_address_fun_fail) m_enter_ip_address_fun_fail(verify_result);
m_job_finished = true;
return;
} else if (!m_check_and_continue) {
if (m_enter_ip_address_fun_success) m_enter_ip_address_fun_success();
m_job_finished = true;
return;
}
}
int total_plate_num = m_plater->get_partplate_list().get_plate_count();
PartPlate* plate = m_plater->get_partplate_list().get_plate(job_data.plate_idx);