mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-27 10:51:22 +00:00
init
This commit is contained in:
@@ -66,22 +66,22 @@ void BindJob::process(Ctl &ctl)
|
||||
result_code = code;
|
||||
result_info = info;
|
||||
|
||||
if (stage == BBL::BindJobStage::LoginStageConnect) {
|
||||
if (stage == BindJobStage::LoginStageConnect) {
|
||||
curr_percent = 15;
|
||||
msg = _u8L("Logging in");
|
||||
} else if (stage == BBL::BindJobStage::LoginStageLogin) {
|
||||
} else if (stage == BindJobStage::LoginStageLogin) {
|
||||
curr_percent = 30;
|
||||
msg = _u8L("Logging in");
|
||||
} else if (stage == BBL::BindJobStage::LoginStageWaitForLogin) {
|
||||
} else if (stage == BindJobStage::LoginStageWaitForLogin) {
|
||||
curr_percent = 45;
|
||||
msg = _u8L("Logging in");
|
||||
} else if (stage == BBL::BindJobStage::LoginStageGetIdentify) {
|
||||
} else if (stage == BindJobStage::LoginStageGetIdentify) {
|
||||
curr_percent = 60;
|
||||
msg = _u8L("Logging in");
|
||||
} else if (stage == BBL::BindJobStage::LoginStageWaitAuth) {
|
||||
} else if (stage == BindJobStage::LoginStageWaitAuth) {
|
||||
curr_percent = 80;
|
||||
msg = _u8L("Logging in");
|
||||
} else if (stage == BBL::BindJobStage::LoginStageFinished) {
|
||||
} else if (stage == BindJobStage::LoginStageFinished) {
|
||||
curr_percent = 100;
|
||||
msg = _u8L("Logging in");
|
||||
} else {
|
||||
|
||||
@@ -197,7 +197,7 @@ void PrintJob::process(Ctl &ctl)
|
||||
this->task_bed_type = bed_type_to_gcode_string(plate_data.is_valid ? plate_data.bed_type : curr_plate->get_bed_type(true));
|
||||
}
|
||||
|
||||
BBL::PrintParams params;
|
||||
PrintParams params;
|
||||
|
||||
// local print access
|
||||
params.dev_ip = m_dev_ip;
|
||||
@@ -382,14 +382,14 @@ void PrintJob::process(Ctl &ctl)
|
||||
StagePercentPoint
|
||||
](int stage, int code, std::string info) {
|
||||
|
||||
if (stage == BBL::SendingPrintJobStage::PrintingStageCreate && !is_try_lan_mode_failed) {
|
||||
if (stage == SendingPrintJobStage::PrintingStageCreate && !is_try_lan_mode_failed) {
|
||||
if (this->connection_type == "lan") {
|
||||
msg = _u8L("Sending print job over LAN");
|
||||
} else {
|
||||
msg = _u8L("Sending print job through cloud service");
|
||||
}
|
||||
}
|
||||
else if (stage == BBL::SendingPrintJobStage::PrintingStageUpload && !is_try_lan_mode_failed) {
|
||||
else if (stage == SendingPrintJobStage::PrintingStageUpload && !is_try_lan_mode_failed) {
|
||||
if (code >= 0 && code <= 100 && !info.empty()) {
|
||||
if (this->connection_type == "lan") {
|
||||
msg = _u8L("Sending print job over LAN");
|
||||
@@ -399,24 +399,24 @@ void PrintJob::process(Ctl &ctl)
|
||||
msg += format("(%s)", info);
|
||||
}
|
||||
}
|
||||
else if (stage == BBL::SendingPrintJobStage::PrintingStageWaiting) {
|
||||
else if (stage == SendingPrintJobStage::PrintingStageWaiting) {
|
||||
if (this->connection_type == "lan") {
|
||||
msg = _u8L("Sending print job over LAN");
|
||||
} else {
|
||||
msg = _u8L("Sending print job through cloud service");
|
||||
}
|
||||
}
|
||||
else if (stage == BBL::SendingPrintJobStage::PrintingStageRecord && !is_try_lan_mode) {
|
||||
else if (stage == SendingPrintJobStage::PrintingStageRecord && !is_try_lan_mode) {
|
||||
msg = _u8L("Sending print configuration");
|
||||
}
|
||||
else if (stage == BBL::SendingPrintJobStage::PrintingStageSending && !is_try_lan_mode) {
|
||||
else if (stage == SendingPrintJobStage::PrintingStageSending && !is_try_lan_mode) {
|
||||
if (this->connection_type == "lan") {
|
||||
msg = _u8L("Sending print job over LAN");
|
||||
} else {
|
||||
msg = _u8L("Sending print job through cloud service");
|
||||
}
|
||||
}
|
||||
else if (stage == BBL::SendingPrintJobStage::PrintingStageFinished) {
|
||||
else if (stage == SendingPrintJobStage::PrintingStageFinished) {
|
||||
msg = format(_u8L("Successfully sent. Will automatically jump to the device page in %ss"), info);
|
||||
if (m_print_job_completed_id == wxGetApp().plater()->get_send_calibration_finished_event()) {
|
||||
msg = format(_u8L("Successfully sent. Will automatically jump to the next page in %ss"), info);
|
||||
@@ -433,15 +433,15 @@ void PrintJob::process(Ctl &ctl)
|
||||
// update current percnet
|
||||
if (stage >= 0 && stage <= (int) PrintingStageFinished) {
|
||||
curr_percent = StagePercentPoint[stage];
|
||||
if ((stage == BBL::SendingPrintJobStage::PrintingStageUpload
|
||||
|| stage == BBL::SendingPrintJobStage::PrintingStageRecord)
|
||||
if ((stage == SendingPrintJobStage::PrintingStageUpload
|
||||
|| stage == SendingPrintJobStage::PrintingStageRecord)
|
||||
&& (code > 0 && code <= 100)) {
|
||||
curr_percent = (StagePercentPoint[stage + 1] - StagePercentPoint[stage]) * code / 100 + StagePercentPoint[stage];
|
||||
}
|
||||
}
|
||||
|
||||
//get errors
|
||||
if (code > 100 || code < 0 || stage == BBL::SendingPrintJobStage::PrintingStageERROR) {
|
||||
if (code > 100 || code < 0 || stage == 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, info);
|
||||
}else if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST){
|
||||
|
||||
@@ -100,10 +100,10 @@ inline std::string get_transform_string(int bytes)
|
||||
|
||||
void SendJob::process(Ctl &ctl)
|
||||
{
|
||||
BBL::PrintParams params;
|
||||
PrintParams params;
|
||||
std::string msg;
|
||||
int curr_percent = 10;
|
||||
NetworkAgent* m_agent = wxGetApp().getAgent();
|
||||
NetworkAgent* agent = wxGetApp().getAgent();
|
||||
AppConfig* config = wxGetApp().app_config;
|
||||
int result = -1;
|
||||
std::string http_body;
|
||||
@@ -234,14 +234,14 @@ void SendJob::process(Ctl &ctl)
|
||||
// update current percnet
|
||||
if (stage >= 0 && stage <= (int) PrintingStageFinished) {
|
||||
curr_percent = StagePercentPoint[stage];
|
||||
if ((stage == BBL::SendingPrintJobStage::PrintingStageUpload) &&
|
||||
if ((stage == SendingPrintJobStage::PrintingStageUpload) &&
|
||||
(code > 0 && code <= 100)) {
|
||||
curr_percent = (StagePercentPoint[stage + 1] - StagePercentPoint[stage]) * code / 100 + StagePercentPoint[stage];
|
||||
}
|
||||
}
|
||||
|
||||
//get errors
|
||||
if (code > 100 || code < 0 || stage == BBL::SendingPrintJobStage::PrintingStageERROR) {
|
||||
if (code > 100 || code < 0 || stage == 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, info);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ void SendJob::process(Ctl &ctl)
|
||||
// try to send local with record
|
||||
BOOST_LOG_TRIVIAL(info) << "send_job: try to send gcode to printer";
|
||||
ctl.update_status(curr_percent, _u8L("Sending G-code file over LAN"));
|
||||
result = m_agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn, nullptr);
|
||||
result = agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn, nullptr);
|
||||
if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) {
|
||||
params.comments = "upload_failed";
|
||||
} else {
|
||||
@@ -304,8 +304,8 @@ void SendJob::process(Ctl &ctl)
|
||||
case DevStorage::SdcardState::HAS_SDCARD_ABNORMAL:
|
||||
if(this->has_sdcard) {
|
||||
// means the sdcard is abnormal but can be used option is enabled
|
||||
ctl.update_status(curr_percent, _u8L("Sending G-code file over LAN, but the Storage in the printer is abnormal and print-issues may be caused by this."));
|
||||
result = m_agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn, nullptr);
|
||||
ctl.update_status(curr_percent, _u8L("Sending G-code file over LAN, but the Storage in the printer is abnormal and print-issues may be caused by this."));
|
||||
result = agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn, nullptr);
|
||||
break;
|
||||
}
|
||||
ctl.update_status(curr_percent, _u8L("The Storage in the printer is abnormal. Please replace it with a normal Storage before sending to printer."));
|
||||
@@ -315,7 +315,7 @@ void SendJob::process(Ctl &ctl)
|
||||
return;
|
||||
case DevStorage::SdcardState::HAS_SDCARD_NORMAL:
|
||||
ctl.update_status(curr_percent, _u8L("Sending G-code file over LAN"));
|
||||
result = m_agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn, nullptr);
|
||||
result = agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn, nullptr);
|
||||
break;
|
||||
default:
|
||||
ctl.update_status(curr_percent, _u8L("Encountered an unknown error with the Storage status. Please try again."));
|
||||
|
||||
Reference in New Issue
Block a user