mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-18 00:12:09 +00:00
Fix the pre-send advisories and port the remaining send-flow checks
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -66,6 +66,7 @@ std::string PrePrintChecker::get_print_status_info(PrintDialogStatus status)
|
||||
case PrintStatusWarningExtFilamentNotMatch: return "PrintStatusWarningExtFilamentNotMatch";
|
||||
case PrintStatusFilamentWarningNozzleHRC: return "PrintStatusFilamentWarningNozzleHRC";
|
||||
case PrintStatusTPUUnsupportCaliOn: return "PrintStatusTPUUnsupportCaliOn";
|
||||
case PrintStatusTPUUnsuggestCali: return "PrintStatusTPUUnsuggestCali";
|
||||
case PrintStatusSmartNozzleBlobNeedAuto: return "PrintStatusSmartNozzleBlobNeedAuto";
|
||||
case PrintStatusFilamentWarningRemainNotEnough: return "PrintStatusFilamentWarningRemainNotEnough";
|
||||
case PrintStatusPrintTimeEstimateWarning: return "PrintStatusPrintTimeEstimateWarning";
|
||||
@@ -111,10 +112,12 @@ wxString PrePrintChecker::get_pre_state_msg(PrintDialogStatus status)
|
||||
// (SelectMachine formats it via get_pre_state_msg before add()); default templates keep the wording.
|
||||
case PrintStatusColorQuantityExceed: return _L("The current firmware supports a maximum of %s materials. You can either reduce the number of materials to %s or fewer on the Preparation Page, or try updating the firmware. If you are still restricted after the update, please wait for subsequent firmware support.");
|
||||
case PrintStatusWarningExtFilamentNotMatch: return _L("The type of external filament is unknown or does not match with the filament type in the slicing file. Please make sure you have installed the correct filament in the external spool.");
|
||||
case PrintStatusTPUUnsupportCaliOn: return _L("TPU 90A/TPU 85A is too soft. It is recommended to perform manual flow calibration on the 'Calibration' page. If 'Dynamic Flow Calibration' is set to on, the system will use the previous calibration value and skip the flow calibration process.");
|
||||
case PrintStatusSmartNozzleBlobNeedAuto: return _L("There is stringing-prone filament in this file. For best print quality, we recommend switching nozzle clumping detection to Auto mode.");
|
||||
// Orca: reuses REF's exact AutoCali/CaliOn text (same string for both). CaliOn is a non-blocking
|
||||
// advisory (Send stays enabled); the "auto" case is the blocking one (PrintStatusTPUUnsupportAutoCali).
|
||||
case PrintStatusTPUUnsupportCaliOn: return _L("TPU 90A/TPU 85A are too soft. It is recommended to perform manual flow calibration on the 'Calibration' page. If 'Dynamic Flow Calibration' is set to auto/on, the system will use the previous calibration value and skip the flow calibration process.");
|
||||
case PrintStatusFilamentWarningRemainNotEnough: return _L("The filament in the AMS may be insufficient for this print. Please refill or replace it.");
|
||||
case PrintStatusPrintTimeEstimateWarning: return _L("The print time estimate may be inaccurate for the current AMS configuration.");
|
||||
// SmartNozzleBlobNeedAuto text is passed via add_with_link (clickable "Switch"), not here.
|
||||
// PrintTimeEstimateWarning is dead in REF (no call site); enum kept for parity, no message string.
|
||||
}
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
||||
@@ -119,10 +119,12 @@ enum PrintDialogStatus : unsigned int {
|
||||
PrintStatusWarningExtFilamentNotMatch,
|
||||
PrintStatusFilamentWarningNozzleHRC,
|
||||
PrintStatusFilamentCrossExtruderWarning,
|
||||
// Orca: resynced pre-send-check statuses. SmartNozzleBlobNeedAuto + TPUUnsupportCaliOn are wired
|
||||
// (see SelectMachine); FilamentWarningRemainNotEnough + PrintTimeEstimateWarning are declared for
|
||||
// forward-compat but their feature wiring stays deferred (missing device-model surface).
|
||||
// Orca: resynced pre-send-check statuses (all non-blocking advisories). Wired: TPUUnsupportCaliOn,
|
||||
// TPUUnsuggestCali, SmartNozzleBlobNeedAuto. FilamentWarningRemainNotEnough is declared for
|
||||
// forward-compat (feature deferred — missing device-model surface). PrintTimeEstimateWarning is
|
||||
// kept for table parity only (dead in REF; no call site, no message).
|
||||
PrintStatusTPUUnsupportCaliOn,
|
||||
PrintStatusTPUUnsuggestCali,
|
||||
PrintStatusSmartNozzleBlobNeedAuto,
|
||||
PrintStatusFilamentWarningRemainNotEnough,
|
||||
PrintStatusPrintTimeEstimateWarning,
|
||||
|
||||
@@ -1958,13 +1958,6 @@ bool SelectMachineDialog::CheckWarningSmartNozzleBlobAuto(MachineObject* obj_)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<FilamentInfo> SelectMachineDialog::get_slicing_filament_info(int fila_logic_id) const
|
||||
{
|
||||
for (const auto& fila : m_filaments)
|
||||
if (fila.id == fila_logic_id) return fila;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<FilamentInfo> SelectMachineDialog::get_mapped_filament_info(int fila_logic_id) const
|
||||
{
|
||||
for (const auto& fila : m_ams_mapping_result)
|
||||
@@ -2400,9 +2393,15 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
|
||||
} else if (status == PrintStatusTPUUnsupportAutoCali) {
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(false);
|
||||
} else if (status == PrintStatusTPUUnsupportCaliOn) { // Orca: TPU manual-cali-on gate (resync)
|
||||
} else if (status == PrintStatusTPUUnsupportCaliOn) { // Orca: TPU manual-cali-on ADVISORY (resync) — Send stays enabled
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(false);
|
||||
Enable_Send_Button(true);
|
||||
} else if (status == PrintStatusTPUUnsuggestCali) { // Orca: TPU flow-cali advisory (resync) — non-blocking
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(true);
|
||||
} else if (status == PrintStatusSmartNozzleBlobNeedAuto) { // Orca: blob switch-to-Auto advisory (resync) — non-blocking
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(true);
|
||||
} else if (status == PrintStatusHasFilamentInBlackListError) {
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(false);
|
||||
@@ -2948,6 +2947,10 @@ void SelectMachineDialog::EnableEditing(bool enable)
|
||||
{
|
||||
iter.second->enable(enable);
|
||||
}
|
||||
|
||||
// Orca: grey the best-position "saves X" tip when editing is disabled so an error transition
|
||||
// doesn't leave a stale clickable tip (resync).
|
||||
if (m_saveTimeText) enable ? m_saveTimeText->Enable() : m_saveTimeText->Disable();
|
||||
}
|
||||
|
||||
/*content height > FromDIP(650), make the area scrollable*/
|
||||
@@ -4087,6 +4090,11 @@ void SelectMachineDialog::on_timer(wxTimerEvent &event)
|
||||
update_show_status(obj_);
|
||||
update_print_status_msg();
|
||||
//update_scroll_area_size();/*STUDIO-12867 the page maybe blank in some platform. FIXME*/
|
||||
|
||||
// Orca: refresh the best-position "saves X" tip after the status update (resync). Placed here (not
|
||||
// inside update_show_status) so it still runs when update_show_status returns early on an error.
|
||||
// No-op for printers without a filament switcher.
|
||||
refresh_save_time(obj_);
|
||||
}
|
||||
|
||||
void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
|
||||
@@ -4760,17 +4768,17 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
|
||||
}
|
||||
}
|
||||
|
||||
// Orca: gate both flow-cali cases for TPU/Aero on printers that don't support PA auto-cali (REF
|
||||
// parity). "auto" -> AutoCali, "on" -> CaliOn, matching REF's distinct messages now that the
|
||||
// CaliOn status exists in PrePrintChecker (this cluster). Both block Send.
|
||||
// Orca: TPU/Aero flow-cali gate on printers that don't support PA auto-cali (REF parity). Only the
|
||||
// "auto" case BLOCKS (AutoCali). The "on" case is a non-blocking ADVISORY (CaliOn): the printer uses
|
||||
// the previous cali value and skips, so Send stays enabled and we do NOT return (matches REF, which
|
||||
// puts CaliOn in the warning band and only returns on is_error).
|
||||
if (!can_support_pa_auto_cali() && m_checkbox_list["flow_cali"]->IsShown()) {
|
||||
if (m_checkbox_list["flow_cali"]->getValue() == "auto") {
|
||||
show_status(PrintDialogStatus::PrintStatusTPUUnsupportAutoCali);
|
||||
return;
|
||||
}
|
||||
if (m_checkbox_list["flow_cali"]->getValue() == "on") {
|
||||
show_status(PrintDialogStatus::PrintStatusTPUUnsupportCaliOn);
|
||||
return;
|
||||
show_status(PrintDialogStatus::PrintStatusTPUUnsupportCaliOn); // advisory: no return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4986,12 +4994,14 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
|
||||
|
||||
// Orca: smart-nozzle-blob pre-send suggestion (resync). When the file has stringing-prone filament
|
||||
// and the printer's clumping detection isn't already Auto, offer a clickable "Switch" that sets the
|
||||
// detection to Auto (mode 2). Rendered via the Orca callback-link path (add_with_link).
|
||||
// detection to Auto (mode 2). Rendered via the Orca callback-link path (add_with_link) with the
|
||||
// message passed as a literal (no get_pre_state_msg entry) so the tail add() doesn't also push a
|
||||
// second, linkless copy — mirrors the TimelapseStorageLow convention.
|
||||
if (!CheckWarningSmartNozzleBlobAuto(obj_)) {
|
||||
show_status(PrintDialogStatus::PrintStatusSmartNozzleBlobNeedAuto);
|
||||
m_pre_print_checker.add_with_link(
|
||||
PrintDialogStatus::PrintStatusSmartNozzleBlobNeedAuto,
|
||||
m_pre_print_checker.get_pre_state_msg(PrintDialogStatus::PrintStatusSmartNozzleBlobNeedAuto),
|
||||
_L("There is stringing-prone filament in this file. For best print quality, we recommend switching nozzle clumping detection to Auto mode."),
|
||||
_L("Switch"),
|
||||
[] {
|
||||
DeviceManager* dev = wxGetApp().getDeviceManager();
|
||||
@@ -5001,8 +5011,23 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
|
||||
});
|
||||
}
|
||||
|
||||
// Orca: refresh the best-position "saves X" tip (resync); no-op for printers without a switcher.
|
||||
refresh_save_time(obj_);
|
||||
// Orca: TPU flow-cali advisory (resync, non-blocking). When Flow Dynamics Calibration is Auto/On and
|
||||
// a mapped filament is in the printer's auto_on_cali_warning_tpu_filaments list, warn that the system
|
||||
// will use the manual/default value and skip flow calibration. Send stays enabled.
|
||||
if (obj_ && m_checkbox_list.count("flow_cali") && m_checkbox_list["flow_cali"]->IsShown()
|
||||
&& m_checkbox_list["flow_cali"]->getValue() != "off") {
|
||||
const auto& warning_tpu_filaments =
|
||||
DevPrinterConfigUtil::get_value_from_config<std::vector<std::string>>(obj_->printer_type, "auto_on_cali_warning_tpu_filaments");
|
||||
if (!warning_tpu_filaments.empty()) {
|
||||
for (const auto& fila : m_ams_mapping_result) {
|
||||
if (std::find(warning_tpu_filaments.begin(), warning_tpu_filaments.end(), fila.filament_id) != warning_tpu_filaments.end()) {
|
||||
show_status(PrintDialogStatus::PrintStatusTPUUnsuggestCali,
|
||||
{ _L("If 'Dynamic Flow Calibration' is set to Auto/On, the system will use the manual calibration value or the default value and skip the flow calibration process. You can perform a manual flow calibration for TPU filament on the 'Calibration' page.") });
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_ams_mapping_res) {
|
||||
if (has_timelapse_warning()) {
|
||||
@@ -6131,6 +6156,7 @@ void SelectMachineDialog::set_default_from_sdcard()
|
||||
::sprintf(weight, "%.2f g", float_weight); // ORCA remove spacing before text
|
||||
m_stext_time->SetLabel(time);
|
||||
m_stext_weight->SetLabel(weight);
|
||||
refresh_save_time(obj_); // Orca: mirrors REF; no-op for FROM_SDCARD_VIEW (refresh_save_time early-returns)
|
||||
}
|
||||
catch (...) {}
|
||||
}
|
||||
|
||||
@@ -566,7 +566,6 @@ public:
|
||||
std::optional<DevFilaSwitch::SwitchPos> get_filament_suggest_pos(MachineObject* obj_, int fila_logic_id) const;
|
||||
bool is_at_suggested_pos(MachineObject* obj_, int fila_logic_id) const;
|
||||
wxString FormatTime(float totalSeconds);
|
||||
std::optional<FilamentInfo> get_slicing_filament_info(int fila_logic_id) const;
|
||||
std::optional<FilamentInfo> get_mapped_filament_info(int fila_logic_id) const;
|
||||
bool is_used_filament(int fila_logic_id) const;
|
||||
|
||||
|
||||
@@ -1896,7 +1896,12 @@ void SendToPrinterDialog::CreateMediaAbilityJob()
|
||||
}
|
||||
});
|
||||
});
|
||||
m_filetransfer_mediability_job->start_on(*m_filetransfer_tunnel);
|
||||
// Orca: guard against a null transfer tunnel before dereferencing (resync).
|
||||
if (m_filetransfer_tunnel) {
|
||||
m_filetransfer_mediability_job->start_on(*m_filetransfer_tunnel);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << "CreateMediaAbilityJob: file transfer tunnel is null";
|
||||
}
|
||||
}
|
||||
|
||||
void SendToPrinterDialog::CreateUploadFileJob(const std::string &path, const std::string &name)
|
||||
@@ -1936,7 +1941,12 @@ void SendToPrinterDialog::CreateUploadFileJob(const std::string &path, const std
|
||||
}
|
||||
});
|
||||
});
|
||||
m_filetransfer_uploadfile_job->start_on(*m_filetransfer_tunnel);
|
||||
// Orca: guard against a null transfer tunnel before dereferencing (resync).
|
||||
if (m_filetransfer_tunnel) {
|
||||
m_filetransfer_uploadfile_job->start_on(*m_filetransfer_tunnel);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": file transfer tunnel is null";
|
||||
}
|
||||
}
|
||||
|
||||
void SendToPrinterDialog::UploadFileProgressCallback(int progress)
|
||||
|
||||
Reference in New Issue
Block a user