mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 00:01:09 -06:00
merge upstream changes
Signed-off-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
This commit is contained in:
parent
1bdedb1c47
commit
2492e5d39c
156 changed files with 33597 additions and 65667 deletions
|
@ -104,11 +104,43 @@ inline std::string get_transform_string(int bytes)
|
|||
|
||||
void SendJob::process()
|
||||
{
|
||||
/* display info */
|
||||
BBL::PrintParams params;
|
||||
wxString msg;
|
||||
int curr_percent = 10;
|
||||
NetworkAgent* m_agent = wxGetApp().getAgent();
|
||||
AppConfig* config = wxGetApp().app_config;
|
||||
int result = -1;
|
||||
unsigned int http_code;
|
||||
std::string http_body;
|
||||
|
||||
|
||||
|
||||
|
||||
// local print access
|
||||
params.dev_ip = m_dev_ip;
|
||||
params.username = "bblp";
|
||||
params.password = m_access_code;
|
||||
params.use_ssl = m_local_use_ssl;
|
||||
|
||||
// check access code and ip address
|
||||
if (m_is_check_mode) {
|
||||
params.dev_id = m_dev_id;
|
||||
params.project_name = "verify_job";
|
||||
params.filename = job_data._temp_path.string();
|
||||
params.connection_type = this->connection_type;
|
||||
|
||||
result = m_agent->start_send_gcode_to_sdcard(params, nullptr, nullptr);
|
||||
if (result != 0) {
|
||||
BOOST_LOG_TRIVIAL(error) << "access code is invalid";
|
||||
m_enter_ip_address_fun_fail();
|
||||
}
|
||||
else {
|
||||
m_enter_ip_address_fun_success();
|
||||
}
|
||||
m_job_finished = true;
|
||||
return;
|
||||
}
|
||||
/* display info */
|
||||
|
||||
if (this->connection_type == "lan") {
|
||||
msg = _L("Sending gcode file over LAN");
|
||||
|
@ -117,10 +149,6 @@ void SendJob::process()
|
|||
msg = _L("Sending gcode file through cloud service");
|
||||
}
|
||||
|
||||
int result = -1;
|
||||
unsigned int http_code;
|
||||
std::string http_body;
|
||||
|
||||
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);
|
||||
|
@ -148,7 +176,6 @@ void SendJob::process()
|
|||
else if (job_data.plate_idx == PLATE_CURRENT_IDX)
|
||||
curr_plate_idx = m_plater->get_partplate_list().get_curr_plate_index() + 1;
|
||||
|
||||
BBL::PrintParams params;
|
||||
params.dev_id = m_dev_id;
|
||||
params.project_name = m_project_name + ".gcode.3mf";
|
||||
params.preset_name = wxGetApp().preset_bundle->prints.get_selected_preset_name();
|
||||
|
@ -163,6 +190,7 @@ void SendJob::process()
|
|||
params.dev_ip = m_dev_ip;
|
||||
params.username = "bblp";
|
||||
params.password = m_access_code;
|
||||
params.use_ssl = m_local_use_ssl;
|
||||
wxString error_text;
|
||||
wxString msg_text;
|
||||
|
||||
|
@ -309,12 +337,15 @@ void SendJob::process()
|
|||
msg_text += wxString::Format("[%s]", error_text);
|
||||
}
|
||||
}
|
||||
|
||||
if (result == BAMBU_NETWORK_ERR_WRONG_IP_ADDRESS) {
|
||||
msg_text = _L("Failed uploading print file. Please enter ip address again.");
|
||||
}
|
||||
|
||||
update_status(curr_percent, msg_text);
|
||||
BOOST_LOG_TRIVIAL(error) << "send_job: failed, result = " << result;
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(error) << "send_job: send ok.";
|
||||
//m_success_fun();
|
||||
wxCommandEvent* evt = new wxCommandEvent(m_print_job_completed_id);
|
||||
evt->SetString(from_u8(params.project_name));
|
||||
wxQueueEvent(m_plater, evt);
|
||||
|
@ -327,6 +358,16 @@ void SendJob::on_success(std::function<void()> success)
|
|||
m_success_fun = success;
|
||||
}
|
||||
|
||||
void SendJob::on_check_ip_address_fail(std::function<void()> func)
|
||||
{
|
||||
m_enter_ip_address_fun_fail = func;
|
||||
}
|
||||
|
||||
void SendJob::on_check_ip_address_success(std::function<void()> func)
|
||||
{
|
||||
m_enter_ip_address_fun_success = func;
|
||||
}
|
||||
|
||||
|
||||
void SendJob::finalize() {
|
||||
if (was_canceled()) return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue