diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp index 83a59672c6..990053622e 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.cpp +++ b/src/slic3r/GUI/Jobs/PrintJob.cpp @@ -233,10 +233,14 @@ void PrintJob::process(Ctl &ctl) params.ams_mapping = this->task_ams_mapping; params.ams_mapping2 = this->task_ams_mapping2; params.ams_mapping_info = this->task_ams_mapping_info; + params.nozzles_info = this->task_nozzles_info; params.connection_type = this->connection_type; params.task_use_ams = this->task_use_ams; params.task_bed_type = this->task_bed_type; params.print_type = this->m_print_type; + params.auto_bed_leveling = this->auto_bed_leveling; + params.auto_flow_cali = this->auto_flow_cali; + params.auto_offset_cali = this->auto_offset_cali; if (m_print_type == "from_sdcard_view") { params.dst_file = m_dst_path; diff --git a/src/slic3r/GUI/Jobs/PrintJob.hpp b/src/slic3r/GUI/Jobs/PrintJob.hpp index 9d7639aeb4..3d7421898c 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.hpp +++ b/src/slic3r/GUI/Jobs/PrintJob.hpp @@ -63,6 +63,7 @@ public: std::string task_ams_mapping; std::string task_ams_mapping2; std::string task_ams_mapping_info; + std::string task_nozzles_info; std::string connection_type; std::string m_print_type; std::string m_dst_path; @@ -70,7 +71,7 @@ public: bool m_is_calibration_task = false; int m_print_from_sdc_plate_idx = 0; - + bool m_local_use_ssl_for_mqtt { true }; bool m_local_use_ssl_for_ftp { true }; bool task_bed_leveling; @@ -82,7 +83,14 @@ public: bool has_sdcard { false }; bool task_use_ams { true }; - void set_print_config(std::string bed_type, bool bed_leveling, bool flow_cali, bool vabration_cali, bool record_timelapse, bool layer_inspect) + int auto_bed_leveling{0}; + int auto_flow_cali{0}; + int auto_offset_cali{0}; + + void set_print_config(std::string bed_type, bool bed_leveling, bool flow_cali, bool vabration_cali, bool record_timelapse, bool layer_inspect, + int auto_bed_levelingt, + int auto_flow_calit, + int auto_offset_calit) { task_bed_type = bed_type; task_bed_leveling = bed_leveling; @@ -90,6 +98,10 @@ public: task_vibration_cali = vabration_cali; task_record_timelapse = record_timelapse; task_layer_inspect = layer_inspect; + + auto_bed_leveling = auto_bed_levelingt; + auto_flow_cali = auto_flow_calit; + auto_offset_cali = auto_offset_calit; } int status_range() const diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index ebcf23cf0a..87743bbca7 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -1962,6 +1962,8 @@ bool SelectMachineDialog::do_ams_mapping(MachineObject *obj_) } else { sync_ams_mapping_result(m_ams_mapping_result); BOOST_LOG_TRIVIAL(info) << "ams_mapping_array=" << ams_array; + BOOST_LOG_TRIVIAL(info) << "ams_mapping_array2=" << ams_array2; + BOOST_LOG_TRIVIAL(info) << "ams_mapping_info=" << mapping_info; } return obj_->is_valid_mapping_result(m_ams_mapping_result); } else { @@ -2039,8 +2041,8 @@ bool SelectMachineDialog::get_ams_mapping_result(std::string &mapping_array_str, try { if (m_ams_mapping_result[k].ams_id.empty() || m_ams_mapping_result[k].slot_id.empty()) { // invalid case - mapping_item_v1["ams_id"] = VIRTUAL_TRAY_ID; - mapping_item_v1["slot_id"] = VIRTUAL_TRAY_ID; + mapping_item_v1["ams_id"] = 255; // TODO: Orca hack + mapping_item_v1["slot_id"] = 255; } else { mapping_item_v1["ams_id"] = std::stoi(m_ams_mapping_result[k].ams_id); @@ -2067,6 +2069,56 @@ bool SelectMachineDialog::get_ams_mapping_result(std::string &mapping_array_str, return true; } +bool SelectMachineDialog::build_nozzles_info(std::string& nozzles_info) +{ + /* init nozzles info */ + json nozzle_info_json = json::array(); + nozzles_info = nozzle_info_json.dump(); + + PresetBundle* preset_bundle = wxGetApp().preset_bundle; + if (!preset_bundle) + return false; + auto opt_nozzle_diameters = preset_bundle->printers.get_edited_preset().config.option("nozzle_diameter"); + if (opt_nozzle_diameters == nullptr) { + BOOST_LOG_TRIVIAL(error) << "build_nozzles_info, opt_nozzle_diameters is nullptr"; + return false; + } + //auto opt_nozzle_volume_type = preset_bundle->project_config.option("nozzle_volume_type"); + //if (opt_nozzle_volume_type == nullptr) { + // BOOST_LOG_TRIVIAL(error) << "build_nozzles_info, opt_nozzle_volume_type is nullptr"; + // return false; + //} + json nozzle_item; + /* only o1d two nozzles has build_nozzles info now */ + if (opt_nozzle_diameters->size() != 2) { + return false; + } + for (size_t i = 0; i < opt_nozzle_diameters->size(); i++) { + if (i == (size_t)ConfigNozzleIdx::NOZZLE_LEFT) { + nozzle_item["id"] = CloudTaskNozzleId::NOZZLE_LEFT; + } + else if (i == (size_t)ConfigNozzleIdx::NOZZLE_RIGHT) { + nozzle_item["id"] = CloudTaskNozzleId::NOZZLE_RIGHT; + } + else { + /* unknown ConfigNozzleIdx */ + BOOST_LOG_TRIVIAL(error) << "build_nozzles_info, unknown ConfigNozzleIdx = " << i; + assert(false); + continue; + } + nozzle_item["type"] = nullptr; + //if (i >= 0 && i < opt_nozzle_volume_type->size()) { + nozzle_item["flowSize"] = "standard_flow"; // TODO: Orca hack + //} + if (i >= 0 && i < opt_nozzle_diameters->size()) { + nozzle_item["diameter"] = opt_nozzle_diameters->get_at(i); + } + nozzle_info_json.push_back(nozzle_item); + } + nozzles_info = nozzle_info_json.dump(); + return true; +} + void SelectMachineDialog::prepare(int print_plate_idx) { m_print_plate_idx = print_plate_idx; @@ -2997,6 +3049,11 @@ void SelectMachineDialog::on_send_print() m_print_job->task_ams_mapping_info = ""; } + /* build nozzles info for multi extruders printers */ + if (build_nozzles_info(m_print_job->task_nozzles_info)) { + BOOST_LOG_TRIVIAL(error) << "build_nozzle_info errors"; + } + m_print_job->has_sdcard = obj_->has_sdcard(); @@ -3008,7 +3065,10 @@ void SelectMachineDialog::on_send_print() m_checkbox_list["flow_cali"]->GetValue(), false, timelapse_option, - true); + true, + 0, // TODO: Orca hack + 0, + 0); if (obj_->has_ams()) { m_print_job->task_use_ams = m_checkbox_list["use_ams"]->GetValue(); diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index ac43251511..1b6c62b31e 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -64,6 +64,18 @@ enum PrintFromType { FROM_SDCARD_VIEW, }; +enum class CloudTaskNozzleId : int +{ + NOZZLE_RIGHT = 0, + NOZZLE_LEFT = 1, +}; + +enum class ConfigNozzleIdx : int +{ + NOZZLE_LEFT = 0, + NOZZLE_RIGHT = 1, +}; + static int get_brightness_value(wxImage image) { wxImage grayImage = image.ConvertToGreyscale(); @@ -539,6 +551,7 @@ public: bool Show(bool show); bool do_ams_mapping(MachineObject* obj_); bool get_ams_mapping_result(std::string& mapping_array_str, std::string& mapping_array_str2, std::string& ams_mapping_info); + bool build_nozzles_info(std::string& nozzles_info); PrintFromType get_print_type() {return m_print_type;}; wxString format_steel_name(std::string name); diff --git a/src/slic3r/Utils/CalibUtils.cpp b/src/slic3r/Utils/CalibUtils.cpp index 0bde1163b2..73e9126ccd 100644 --- a/src/slic3r/Utils/CalibUtils.cpp +++ b/src/slic3r/Utils/CalibUtils.cpp @@ -1243,7 +1243,7 @@ void CalibUtils::send_to_print(const CalibInfo &calib_info, wxString &error_mess print_job->set_calibration_task(true); print_job->has_sdcard = obj_->has_sdcard(); - print_job->set_print_config(MachineBedTypeString[bed_type], true, false, false, false, true); + print_job->set_print_config(MachineBedTypeString[bed_type], true, false, false, false, true, 0, 0, 0); print_job->set_print_job_finished_event(wxGetApp().plater()->get_send_calibration_finished_event(), print_job->m_project_name); { // after send: record the print job