mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
ENH:SD card printing using cloud service
jira:[for sdcard print] Change-Id: I9b3f3cc5db1b5c1c63d4e9e016cdd81db6893b65
This commit is contained in:
parent
0886610160
commit
8e7d1694f9
4 changed files with 36 additions and 13 deletions
|
@ -497,7 +497,12 @@ void PrintJob::process(Ctl &ctl)
|
||||||
|
|
||||||
|
|
||||||
//use ftp only
|
//use ftp only
|
||||||
if (!wxGetApp().app_config->get("lan_mode_only").empty() && wxGetApp().app_config->get("lan_mode_only") == "1") {
|
if (m_print_type == "from_sdcard_view") {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "print_job: try to send with cloud, model is sdcard view";
|
||||||
|
ctl.update_status(curr_percent, _u8L("Sending print job through cloud service"));
|
||||||
|
result = m_agent->start_sdcard_print(params, update_fn, cancel_fn);
|
||||||
|
}
|
||||||
|
else if (!wxGetApp().app_config->get("lan_mode_only").empty() && wxGetApp().app_config->get("lan_mode_only") == "1") {
|
||||||
|
|
||||||
if (params.password.empty() || params.dev_ip.empty()) {
|
if (params.password.empty() || params.dev_ip.empty()) {
|
||||||
error_text = wxString::Format("Access code:%s Ip address:%s", params.password, params.dev_ip);
|
error_text = wxString::Format("Access code:%s Ip address:%s", params.password, params.dev_ip);
|
||||||
|
|
|
@ -1448,7 +1448,8 @@ void SelectMachineDialog::init_bind()
|
||||||
if (obj->dev_id == e.GetString()) {
|
if (obj->dev_id == e.GetString()) {
|
||||||
m_comboBox_printer->SetValue(obj->dev_name + "(LAN)");
|
m_comboBox_printer->SetValue(obj->dev_name + "(LAN)");
|
||||||
}
|
}
|
||||||
}else if(e.GetInt() == 1 && (m_print_type == PrintFromType::FROM_SDCARD_VIEW)){
|
}
|
||||||
|
/*else if (e.GetInt() == 1 && (m_print_type == PrintFromType::FROM_SDCARD_VIEW)) {
|
||||||
on_send_print();
|
on_send_print();
|
||||||
}
|
}
|
||||||
else if (e.GetInt() == -2 && (m_print_type == PrintFromType::FROM_SDCARD_VIEW)) {
|
else if (e.GetInt() == -2 && (m_print_type == PrintFromType::FROM_SDCARD_VIEW)) {
|
||||||
|
@ -1471,7 +1472,7 @@ void SelectMachineDialog::init_bind()
|
||||||
this->connect_printer_mqtt();
|
this->connect_printer_mqtt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
});
|
});
|
||||||
|
|
||||||
m_bitmap_last_plate->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
m_bitmap_last_plate->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
||||||
|
@ -2609,12 +2610,12 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
||||||
|
|
||||||
confirm_dlg.Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, &confirm_dlg](wxCommandEvent& e) {
|
confirm_dlg.Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, &confirm_dlg](wxCommandEvent& e) {
|
||||||
confirm_dlg.on_hide();
|
confirm_dlg.on_hide();
|
||||||
if (m_print_type == PrintFromType::FROM_SDCARD_VIEW) {
|
/* if (m_print_type == PrintFromType::FROM_SDCARD_VIEW) {
|
||||||
this->connect_printer_mqtt();
|
this->connect_printer_mqtt();
|
||||||
}
|
}
|
||||||
else {
|
else {*/
|
||||||
this->on_send_print();
|
this->on_send_print();
|
||||||
}
|
//}
|
||||||
});
|
});
|
||||||
|
|
||||||
//confirm_dlg.Bind(EVT_UPDATE_NOZZLE, [this, obj_, tag_nozzle_type, nozzle_diameter, &confirm_dlg](wxCommandEvent& e) {
|
//confirm_dlg.Bind(EVT_UPDATE_NOZZLE, [this, obj_, tag_nozzle_type, nozzle_diameter, &confirm_dlg](wxCommandEvent& e) {
|
||||||
|
@ -2648,12 +2649,12 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
||||||
confirm_dlg.on_show();
|
confirm_dlg.on_show();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (m_print_type == PrintFromType::FROM_SDCARD_VIEW) {
|
/* if (m_print_type == PrintFromType::FROM_SDCARD_VIEW) {
|
||||||
this->connect_printer_mqtt();
|
this->connect_printer_mqtt();
|
||||||
}
|
}
|
||||||
else {
|
else {*/
|
||||||
this->on_send_print();
|
this->on_send_print();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2824,7 +2825,7 @@ void SelectMachineDialog::on_send_print()
|
||||||
else if(m_print_type == PrintFromType::FROM_SDCARD_VIEW){
|
else if(m_print_type == PrintFromType::FROM_SDCARD_VIEW){
|
||||||
BOOST_LOG_TRIVIAL(info) << "print_job: m_print_type = from_sdcard_view";
|
BOOST_LOG_TRIVIAL(info) << "print_job: m_print_type = from_sdcard_view";
|
||||||
m_print_job->m_print_type = "from_sdcard_view";
|
m_print_job->m_print_type = "from_sdcard_view";
|
||||||
m_print_job->connection_type = "lan";
|
//m_print_job->connection_type = "lan";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
m_print_job->m_print_from_sdc_plate_idx = m_required_data_plate_data_list[m_print_plate_idx]->plate_index + 1;
|
m_print_job->m_print_from_sdc_plate_idx = m_required_data_plate_data_list[m_print_plate_idx]->plate_index + 1;
|
||||||
|
@ -4333,7 +4334,7 @@ bool SelectMachineDialog::Show(bool show)
|
||||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
if (dev) {
|
if (dev) {
|
||||||
MachineObject* obj_ = dev->get_selected_machine();
|
MachineObject* obj_ = dev->get_selected_machine();
|
||||||
if (obj_ && obj_->connection_type() == "cloud" && m_print_type == FROM_SDCARD_VIEW) {
|
if (obj_ && obj_->connection_type() == "cloud" /*&& m_print_type == FROM_SDCARD_VIEW*/) {
|
||||||
if (obj_->is_connected()) {
|
if (obj_->is_connected()) {
|
||||||
obj_->disconnect();
|
obj_->disconnect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ func_start_print NetworkAgent::start_print_ptr = nullptr;
|
||||||
func_start_local_print_with_record NetworkAgent::start_local_print_with_record_ptr = nullptr;
|
func_start_local_print_with_record NetworkAgent::start_local_print_with_record_ptr = nullptr;
|
||||||
func_start_send_gcode_to_sdcard NetworkAgent::start_send_gcode_to_sdcard_ptr = nullptr;
|
func_start_send_gcode_to_sdcard NetworkAgent::start_send_gcode_to_sdcard_ptr = nullptr;
|
||||||
func_start_local_print NetworkAgent::start_local_print_ptr = nullptr;
|
func_start_local_print NetworkAgent::start_local_print_ptr = nullptr;
|
||||||
|
func_start_sdcard_print NetworkAgent::start_sdcard_print_ptr = nullptr;
|
||||||
func_get_user_presets NetworkAgent::get_user_presets_ptr = nullptr;
|
func_get_user_presets NetworkAgent::get_user_presets_ptr = nullptr;
|
||||||
func_request_setting_id NetworkAgent::request_setting_id_ptr = nullptr;
|
func_request_setting_id NetworkAgent::request_setting_id_ptr = nullptr;
|
||||||
func_put_setting NetworkAgent::put_setting_ptr = nullptr;
|
func_put_setting NetworkAgent::put_setting_ptr = nullptr;
|
||||||
|
@ -255,6 +256,7 @@ int NetworkAgent::initialize_network_module(bool using_backup)
|
||||||
start_local_print_with_record_ptr = reinterpret_cast<func_start_local_print_with_record>(get_network_function("bambu_network_start_local_print_with_record"));
|
start_local_print_with_record_ptr = reinterpret_cast<func_start_local_print_with_record>(get_network_function("bambu_network_start_local_print_with_record"));
|
||||||
start_send_gcode_to_sdcard_ptr = reinterpret_cast<func_start_send_gcode_to_sdcard>(get_network_function("bambu_network_start_send_gcode_to_sdcard"));
|
start_send_gcode_to_sdcard_ptr = reinterpret_cast<func_start_send_gcode_to_sdcard>(get_network_function("bambu_network_start_send_gcode_to_sdcard"));
|
||||||
start_local_print_ptr = reinterpret_cast<func_start_local_print>(get_network_function("bambu_network_start_local_print"));
|
start_local_print_ptr = reinterpret_cast<func_start_local_print>(get_network_function("bambu_network_start_local_print"));
|
||||||
|
start_sdcard_print_ptr = reinterpret_cast<func_start_sdcard_print>(get_network_function("bambu_network_start_sdcard_print"));
|
||||||
get_user_presets_ptr = reinterpret_cast<func_get_user_presets>(get_network_function("bambu_network_get_user_presets"));
|
get_user_presets_ptr = reinterpret_cast<func_get_user_presets>(get_network_function("bambu_network_get_user_presets"));
|
||||||
request_setting_id_ptr = reinterpret_cast<func_request_setting_id>(get_network_function("bambu_network_request_setting_id"));
|
request_setting_id_ptr = reinterpret_cast<func_request_setting_id>(get_network_function("bambu_network_request_setting_id"));
|
||||||
put_setting_ptr = reinterpret_cast<func_put_setting>(get_network_function("bambu_network_put_setting"));
|
put_setting_ptr = reinterpret_cast<func_put_setting>(get_network_function("bambu_network_put_setting"));
|
||||||
|
@ -376,6 +378,7 @@ int NetworkAgent::unload_network_module()
|
||||||
start_local_print_with_record_ptr = nullptr;
|
start_local_print_with_record_ptr = nullptr;
|
||||||
start_send_gcode_to_sdcard_ptr = nullptr;
|
start_send_gcode_to_sdcard_ptr = nullptr;
|
||||||
start_local_print_ptr = nullptr;
|
start_local_print_ptr = nullptr;
|
||||||
|
start_sdcard_print_ptr = nullptr;
|
||||||
get_user_presets_ptr = nullptr;
|
get_user_presets_ptr = nullptr;
|
||||||
request_setting_id_ptr = nullptr;
|
request_setting_id_ptr = nullptr;
|
||||||
put_setting_ptr = nullptr;
|
put_setting_ptr = nullptr;
|
||||||
|
@ -1072,6 +1075,17 @@ int NetworkAgent::start_local_print(PrintParams params, OnUpdateStatusFn update_
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int NetworkAgent::start_sdcard_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
if (network_agent && start_sdcard_print_ptr) {
|
||||||
|
ret = start_sdcard_print_ptr(network_agent, params, update_fn, cancel_fn);
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" : network_agent=%1%, ret=%2%, dev_id=%3%, task_name=%4%, project_name=%5%")
|
||||||
|
% network_agent % ret % params.dev_id % params.task_name % params.project_name;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int NetworkAgent::get_user_presets(std::map<std::string, std::map<std::string, std::string>>* user_presets)
|
int NetworkAgent::get_user_presets(std::map<std::string, std::map<std::string, std::string>>* user_presets)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
|
@ -64,6 +64,7 @@ typedef int (*func_start_print)(void *agent, PrintParams params, OnUpdateStatusF
|
||||||
typedef int (*func_start_local_print_with_record)(void *agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
|
typedef int (*func_start_local_print_with_record)(void *agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
|
||||||
typedef int (*func_start_send_gcode_to_sdcard)(void *agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
|
typedef int (*func_start_send_gcode_to_sdcard)(void *agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
|
||||||
typedef int (*func_start_local_print)(void *agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
|
typedef int (*func_start_local_print)(void *agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
|
||||||
|
typedef int (*func_start_sdcard_print)(void *agent, PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
|
||||||
typedef int (*func_get_user_presets)(void *agent, std::map<std::string, std::map<std::string, std::string>>* user_presets);
|
typedef int (*func_get_user_presets)(void *agent, std::map<std::string, std::map<std::string, std::string>>* user_presets);
|
||||||
typedef std::string (*func_request_setting_id)(void *agent, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
|
typedef std::string (*func_request_setting_id)(void *agent, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
|
||||||
typedef int (*func_put_setting)(void *agent, std::string setting_id, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
|
typedef int (*func_put_setting)(void *agent, std::string setting_id, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
|
||||||
|
@ -179,6 +180,7 @@ public:
|
||||||
int start_local_print_with_record(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
|
int start_local_print_with_record(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
|
||||||
int start_send_gcode_to_sdcard(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
|
int start_send_gcode_to_sdcard(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn);
|
||||||
int start_local_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
|
int start_local_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
|
||||||
|
int start_sdcard_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn);
|
||||||
int get_user_presets(std::map<std::string, std::map<std::string, std::string>>* user_presets);
|
int get_user_presets(std::map<std::string, std::map<std::string, std::string>>* user_presets);
|
||||||
std::string request_setting_id(std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
|
std::string request_setting_id(std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
|
||||||
int put_setting(std::string setting_id, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
|
int put_setting(std::string setting_id, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
|
||||||
|
@ -284,6 +286,7 @@ private:
|
||||||
static func_start_local_print_with_record start_local_print_with_record_ptr;
|
static func_start_local_print_with_record start_local_print_with_record_ptr;
|
||||||
static func_start_send_gcode_to_sdcard start_send_gcode_to_sdcard_ptr;
|
static func_start_send_gcode_to_sdcard start_send_gcode_to_sdcard_ptr;
|
||||||
static func_start_local_print start_local_print_ptr;
|
static func_start_local_print start_local_print_ptr;
|
||||||
|
static func_start_sdcard_print start_sdcard_print_ptr;
|
||||||
static func_get_user_presets get_user_presets_ptr;
|
static func_get_user_presets get_user_presets_ptr;
|
||||||
static func_request_setting_id request_setting_id_ptr;
|
static func_request_setting_id request_setting_id_ptr;
|
||||||
static func_put_setting put_setting_ptr;
|
static func_put_setting put_setting_ptr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue