ENH:support parse new print data
jira:[for new print data] Change-Id: Iac6747e9ade690fcdf3b7b11239fe183bc7c3796
This commit is contained in:
parent
67f67d7688
commit
6c02c7bc8c
|
@ -493,7 +493,7 @@ void AMSMaterialsSetting::on_select_reset(wxCommandEvent& event) {
|
|||
else {
|
||||
PACalibIndexInfo select_index_info;
|
||||
select_index_info.tray_id = tray_id;
|
||||
select_index_info.nozzle_diameter = obj->nozzle_diameter;
|
||||
select_index_info.nozzle_diameter = obj->m_nozzle_data.nozzles[0].diameter;
|
||||
select_index_info.cali_idx = -1;
|
||||
select_index_info.filament_id = ams_filament_id;
|
||||
CalibUtils::select_PA_calib_result(select_index_info);
|
||||
|
@ -615,7 +615,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
|
|||
if (obj->cali_version >= 0) {
|
||||
PACalibIndexInfo select_index_info;
|
||||
select_index_info.tray_id = tray_id;
|
||||
select_index_info.nozzle_diameter = obj->nozzle_diameter;
|
||||
select_index_info.nozzle_diameter = obj->m_nozzle_data.nozzles[0].diameter;
|
||||
|
||||
auto cali_select_id = m_comboBox_cali_result->GetSelection();
|
||||
if (m_pa_profile_items.size() > 0 && cali_select_id >= 0) {
|
||||
|
@ -654,7 +654,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
|
|||
if (obj->cali_version >= 0) {
|
||||
PACalibIndexInfo select_index_info;
|
||||
select_index_info.tray_id = cali_tray_id;
|
||||
select_index_info.nozzle_diameter = obj->nozzle_diameter;
|
||||
select_index_info.nozzle_diameter = obj->m_nozzle_data.nozzles[0].diameter;
|
||||
|
||||
auto cali_select_id = m_comboBox_cali_result->GetSelection();
|
||||
if (m_pa_profile_items.size() > 0 && cali_select_id >= 0) {
|
||||
|
@ -817,7 +817,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
|||
std::set<std::string> filament_id_set;
|
||||
PresetBundle * preset_bundle = wxGetApp().preset_bundle;
|
||||
std::ostringstream stream;
|
||||
stream << std::fixed << std::setprecision(1) << obj->nozzle_diameter;
|
||||
stream << std::fixed << std::setprecision(1) << obj->m_nozzle_data.nozzles[0].diameter;
|
||||
std::string nozzle_diameter_str = stream.str();
|
||||
std::set<std::string> printer_names = preset_bundle->get_printer_names_by_printer_type_and_nozzle(MachineObject::get_preset_printer_model_name(obj->printer_type), nozzle_diameter_str);
|
||||
|
||||
|
@ -989,7 +989,7 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
|||
if (preset_bundle) {
|
||||
std::ostringstream stream;
|
||||
if (obj)
|
||||
stream << std::fixed << std::setprecision(1) << obj->nozzle_diameter;
|
||||
stream << std::fixed << std::setprecision(1) << obj->m_nozzle_data.nozzles[0].diameter;
|
||||
std::string nozzle_diameter_str = stream.str();
|
||||
std::set<std::string> printer_names = preset_bundle->get_printer_names_by_printer_type_and_nozzle(MachineObject::get_preset_printer_model_name(obj->printer_type),
|
||||
nozzle_diameter_str);
|
||||
|
|
|
@ -539,7 +539,7 @@ void AmsMapingPopup::update_ams_data_multi_machines()
|
|||
|
||||
void AmsMapingPopup::update(MachineObject* obj)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << "ams_mapping nozzle count " << obj->m_np_nozzle_data.nozzle.size();
|
||||
//BOOST_LOG_TRIVIAL(info) << "ams_mapping nozzle count " << obj->m_nozzle_data.nozzle.size();
|
||||
BOOST_LOG_TRIVIAL(info) << "ams_mapping total count " << obj->amsList.size();
|
||||
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ void HistoryWindow::on_device_connected(MachineObject* obj)
|
|||
int selection = 1;
|
||||
for (int i = 0; i < nozzle_diameter_list.size(); i++) {
|
||||
m_comboBox_nozzle_dia->AppendString(wxString::Format("%1.1f mm", nozzle_diameter_list[i]));
|
||||
if (abs(curr_obj->nozzle_diameter - nozzle_diameter_list[i]) < 1e-3) {
|
||||
if (abs(curr_obj->m_nozzle_data.nozzles[0].diameter - nozzle_diameter_list[i]) < 1e-3) {
|
||||
selection = i;
|
||||
}
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ wxArrayString NewCalibrationHistoryDialog::get_all_filaments(const MachineObject
|
|||
std::set<std::string> filament_id_set;
|
||||
std::set<std::string> printer_names;
|
||||
std::ostringstream stream;
|
||||
stream << std::fixed << std::setprecision(1) << obj->nozzle_diameter;
|
||||
stream << std::fixed << std::setprecision(1) << obj->m_nozzle_data.nozzles[0].diameter;
|
||||
std::string nozzle_diameter_str = stream.str();
|
||||
|
||||
for (auto printer_it = preset_bundle->printers.begin(); printer_it != preset_bundle->printers.end(); printer_it++) {
|
||||
|
@ -635,7 +635,7 @@ NewCalibrationHistoryDialog::NewCalibrationHistoryDialog(wxWindow *parent, const
|
|||
static std::array<float, 4> nozzle_diameter_list = {0.2f, 0.4f, 0.6f, 0.8f};
|
||||
for (int i = 0; i < nozzle_diameter_list.size(); i++) {
|
||||
m_comboBox_nozzle_diameter->AppendString(wxString::Format("%1.1f mm", nozzle_diameter_list[i]));
|
||||
if (abs(obj->nozzle_diameter - nozzle_diameter_list[i]) < 1e-3) {
|
||||
if (abs(obj->m_nozzle_data.nozzles[0].diameter - nozzle_diameter_list[i]) < 1e-3) {
|
||||
m_comboBox_nozzle_diameter->SetSelection(i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -479,7 +479,7 @@ void PressureAdvanceWizard::update(MachineObject* obj)
|
|||
if (obj->cali_version != -1 && obj->cali_version != cali_version) {
|
||||
cali_version = obj->cali_version;
|
||||
PACalibExtruderInfo cali_info;
|
||||
cali_info.nozzle_diameter = obj->nozzle_diameter;
|
||||
cali_info.nozzle_diameter = obj->m_nozzle_data.nozzles[0].diameter;
|
||||
CalibUtils::emit_get_PA_calib_info(cali_info);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -500,8 +500,8 @@ float CalibrationCaliPage::get_selected_calibration_nozzle_dia(MachineObject* ob
|
|||
return obj->cali_selected_nozzle_dia;
|
||||
|
||||
// return default nozzle if nozzle diameter is set
|
||||
if (obj->nozzle_diameter > 1e-3 && obj->nozzle_diameter < 10.0f)
|
||||
return obj->nozzle_diameter;
|
||||
if (obj->m_nozzle_data.nozzles[0].diameter > 1e-3 && obj->m_nozzle_data.nozzles[0].diameter < 10.0f)
|
||||
return obj->m_nozzle_data.nozzles[0].diameter;
|
||||
|
||||
// return 0.4 by default
|
||||
return 0.4;
|
||||
|
|
|
@ -1605,7 +1605,7 @@ void CalibrationPresetPage::init_with_machine(MachineObject* obj)
|
|||
// set nozzle value from machine
|
||||
bool nozzle_is_set = false;
|
||||
for (int i = 0; i < NOZZLE_LIST_COUNT; i++) {
|
||||
if (abs(obj->nozzle_diameter - nozzle_diameter_list[i]) < 1e-3) {
|
||||
if (abs(obj->m_nozzle_data.nozzles[0].diameter - nozzle_diameter_list[i]) < 1e-3) {
|
||||
if (m_comboBox_nozzle_dia->GetCount() > i) {
|
||||
m_comboBox_nozzle_dia->SetSelection(i);
|
||||
nozzle_is_set = true;
|
||||
|
@ -1936,7 +1936,7 @@ Preset* CalibrationPresetPage::get_printer_preset(MachineObject* obj, float nozz
|
|||
std::string model_id = printer_it->get_current_printer_type(preset_bundle);
|
||||
|
||||
std::string printer_type = obj->printer_type;
|
||||
if (obj->is_support_p1s_plus) { printer_type = "C12"; }
|
||||
if (obj->is_support_upgrade_kit && obj->installed_upgrade_kit) { printer_type = "C12"; }
|
||||
if (model_id.compare(printer_type) == 0
|
||||
&& printer_nozzle_vals
|
||||
&& abs(printer_nozzle_vals->get_at(0) - nozzle_value) < 1e-3) {
|
||||
|
|
|
@ -187,9 +187,8 @@ void CalibrationPAStartPage::update(MachineObject *obj)
|
|||
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false);
|
||||
}
|
||||
|
||||
// is support auto cali
|
||||
bool is_support_pa_auto = (obj->home_flag >> 16 & 1) == 1;
|
||||
if (!is_support_pa_auto) {
|
||||
|
||||
if (!obj->is_support_pa_calibration) {
|
||||
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false);
|
||||
}
|
||||
}
|
||||
|
@ -346,8 +345,7 @@ void CalibrationFlowRateStartPage::update(MachineObject *obj)
|
|||
}
|
||||
|
||||
//is support auto cali
|
||||
bool is_support_flow_rate_auto = (obj->home_flag >> 15 & 1) == 1;
|
||||
if (!is_support_flow_rate_auto) {
|
||||
if (!obj->is_support_flow_calibration) {
|
||||
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -588,8 +588,6 @@ MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string
|
|||
reset();
|
||||
|
||||
/* temprature fields */
|
||||
nozzle_temp = 0.0f;
|
||||
nozzle_temp_target = 0.0f;
|
||||
bed_temp = 0.0f;
|
||||
bed_temp_target = 0.0f;
|
||||
chamber_temp = 0.0f;
|
||||
|
@ -640,6 +638,12 @@ MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string
|
|||
|
||||
auto vslot = AmsTray(std::to_string(VIRTUAL_TRAY_MAIN_ID));
|
||||
vt_slot.push_back(vslot);
|
||||
|
||||
m_nozzle_data.current_nozzle_id = 0;
|
||||
m_nozzle_data.target_nozzle_id = 0;
|
||||
m_nozzle_data.total_nozzle_count = 1;
|
||||
Nozzle nozzle;
|
||||
m_nozzle_data.nozzles.push_back(nozzle);
|
||||
}
|
||||
|
||||
MachineObject::~MachineObject()
|
||||
|
@ -1380,7 +1384,7 @@ void MachineObject::parse_state_changed_event()
|
|||
|
||||
void MachineObject::parse_status(int flag)
|
||||
{
|
||||
is_220V_voltage = ((flag >> 3) & 0x1) != 0;
|
||||
is_220V_voltage = ((flag >> 3) & 0x1) != 0;
|
||||
if (xcam_auto_recovery_hold_count > 0)
|
||||
xcam_auto_recovery_hold_count--;
|
||||
else {
|
||||
|
@ -1396,27 +1400,30 @@ void MachineObject::parse_status(int flag)
|
|||
ams_auto_switch_filament_flag = ((flag >> 10) & 0x1) != 0;
|
||||
}
|
||||
|
||||
is_support_flow_calibration = ((flag >> 15) & 0x1) != 0;
|
||||
is_support_pa_calibration = ((flag >> 16) & 0x1) != 0;
|
||||
|
||||
if (xcam_prompt_sound_hold_count > 0)
|
||||
xcam_prompt_sound_hold_count--;
|
||||
else {
|
||||
xcam_allow_prompt_sound = ((flag >> 17) & 0x1) != 0;
|
||||
}
|
||||
|
||||
if (((flag >> 18) & 0x1) != 0) {
|
||||
is_support_prompt_sound = true;
|
||||
}
|
||||
|
||||
is_support_prompt_sound = ((flag >> 18) & 0x1) != 0;
|
||||
is_support_filament_tangle_detect = ((flag >> 19) & 0x1) != 0;
|
||||
is_support_user_preset = ((flag >> 22) & 0x1) != 0;
|
||||
|
||||
if (xcam_filament_tangle_detect_count > 0)
|
||||
xcam_filament_tangle_detect_count--;
|
||||
else {
|
||||
xcam_filament_tangle_detect = ((flag >> 20) & 0x1) != 0;
|
||||
}
|
||||
|
||||
if(!is_support_motor_noise_cali){
|
||||
/*if(!is_support_motor_noise_cali){
|
||||
is_support_motor_noise_cali = ((flag >> 21) & 0x1) != 0;
|
||||
}
|
||||
}*/
|
||||
is_support_motor_noise_cali = ((flag >> 21) & 0x1) != 0;
|
||||
|
||||
is_support_user_preset = ((flag >> 22) & 0x1) != 0;
|
||||
|
||||
is_support_nozzle_blob_detection = ((flag >> 25) & 0x1) != 0;
|
||||
nozzle_blob_detection_enabled = ((flag >> 24) & 0x1) != 0;
|
||||
|
@ -1424,7 +1431,7 @@ void MachineObject::parse_status(int flag)
|
|||
is_support_air_print_detection = ((flag >> 29) & 0x1) != 0;
|
||||
ams_air_print_status = ((flag >> 28) & 0x1) != 0;
|
||||
|
||||
if (!is_support_p1s_plus) {
|
||||
/*if (!is_support_p1s_plus) {
|
||||
auto supported_plus = ((flag >> 27) & 0x1) != 0;
|
||||
auto installed_plus = ((flag >> 26) & 0x1) != 0;
|
||||
|
||||
|
@ -1434,7 +1441,10 @@ void MachineObject::parse_status(int flag)
|
|||
else {
|
||||
is_support_p1s_plus = false;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
is_support_upgrade_kit = ((flag >> 27) & 0x1) != 0;
|
||||
installed_upgrade_kit = ((flag >> 26) & 0x1) != 0;
|
||||
|
||||
sdcard_state = MachineObject::SdcardState((flag >> 8) & 0x11);
|
||||
|
||||
|
@ -1866,28 +1876,6 @@ int MachineObject::command_ams_user_settings(int ams_id, bool start_read_opt, bo
|
|||
return this->publish_json(j.dump());
|
||||
}
|
||||
|
||||
int MachineObject::command_ams_user_settings(int ams_id, AmsOptionType op, bool value)
|
||||
{
|
||||
json j;
|
||||
j["print"]["command"] = "ams_user_setting";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["ams_id"] = ams_id;
|
||||
if (op == AmsOptionType::AMS_OP_STARTUP_READ) {
|
||||
j["print"]["startup_read_option"] = value;
|
||||
ams_power_on_flag = value;
|
||||
} else if (op == AmsOptionType::AMS_OP_TRAY_READ) {
|
||||
j["print"]["tray_read_option"] = value;
|
||||
ams_insert_flag = value;
|
||||
} else if (op == AmsOptionType::AMS_OP_CALIBRATE_REMAIN) {
|
||||
j["print"]["calibrate_remain_flag"] = value;
|
||||
ams_calibrate_remain_flag = value;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
ams_user_setting_hold_count = HOLD_COUNT_MAX;
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
|
||||
int MachineObject::command_ams_calibrate(int ams_id)
|
||||
{
|
||||
std::string gcode_cmd = (boost::format("M620 C%1% \n") % ams_id).str();
|
||||
|
@ -2594,7 +2582,6 @@ void MachineObject::reset()
|
|||
last_mc_print_stage = -1;
|
||||
m_new_ver_list_exist = false;
|
||||
extruder_axis_status = LOAD;
|
||||
nozzle_diameter = 0.0f;
|
||||
network_wired = false;
|
||||
dev_connection_name = "";
|
||||
subscribe_counter = SUBSCRIBE_RETRY_COUNT;
|
||||
|
@ -3054,7 +3041,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
|
||||
if (jj.contains("support_flow_calibration")) {
|
||||
if (jj["support_flow_calibration"].is_boolean()) {
|
||||
is_support_flow_calibration = jj["support_flow_calibration"].get<bool>();
|
||||
is_support_auto_flow_calibration = jj["support_flow_calibration"].get<bool>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3123,11 +3110,11 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
}
|
||||
}
|
||||
|
||||
//if (jj.contains("support_filament_tangle_detect")) {
|
||||
// if (jj["support_filament_tangle_detect"].is_boolean()) {
|
||||
// is_support_filament_tangle_detect = jj["support_filament_tangle_detect"].get<bool>();
|
||||
// }
|
||||
//}
|
||||
if (jj.contains("support_filament_tangle_detect")) {
|
||||
if (jj["support_filament_tangle_detect"].is_boolean()) {
|
||||
is_support_filament_tangle_detect = jj["support_filament_tangle_detect"].get<bool>();
|
||||
}
|
||||
}
|
||||
|
||||
if (jj.contains("support_1080dpi")) {
|
||||
if (jj["support_1080dpi"].is_boolean()) {
|
||||
|
@ -3407,7 +3394,6 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
curr_task->task_progress = mc_print_percent;
|
||||
curr_task->printing_status = print_status;
|
||||
curr_task->task_id = jj["subtask_id"].get<std::string>();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3433,12 +3419,16 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
}
|
||||
if (jj.contains("nozzle_temper")) {
|
||||
if (jj["nozzle_temper"].is_number()) {
|
||||
nozzle_temp = jj["nozzle_temper"].get<float>();
|
||||
if (m_nozzle_data.nozzles.size() == 1) {
|
||||
m_nozzle_data.nozzles[0].temp = jj["nozzle_temper"].get<float>();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (jj.contains("nozzle_target_temper")) {
|
||||
if (jj["nozzle_target_temper"].is_number()) {
|
||||
nozzle_temp_target = jj["nozzle_target_temper"].get<float>();
|
||||
if (m_nozzle_data.nozzles.size() == 1) {
|
||||
m_nozzle_data.nozzles[0].target_temp = jj["nozzle_temper"].get<float>();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (jj.contains("chamber_temper")) {
|
||||
|
@ -3614,15 +3604,17 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
if (nozzle_setting_hold_count > 0) {
|
||||
nozzle_setting_hold_count--;
|
||||
} else {
|
||||
float nozzle_diameter = 0.0f;
|
||||
if (jj["nozzle_diameter"].is_number_float()) {
|
||||
nozzle_diameter = jj["nozzle_diameter"].get<float>();
|
||||
}
|
||||
else if (jj["nozzle_diameter"].is_string()) {
|
||||
nozzle_diameter = string_to_float(jj["nozzle_diameter"].get<std::string>());
|
||||
}
|
||||
|
||||
if (nozzle_diameter == 0.0f) {m_nozzle_data.nozzles[0].diameter = 0.4f;}
|
||||
else {m_nozzle_data.nozzles[0].diameter = round(nozzle_diameter * 10) / 10;}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch(...) {
|
||||
|
@ -3637,13 +3629,11 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
}
|
||||
else {
|
||||
if (jj["nozzle_type"].is_string()) {
|
||||
nozzle_type = jj["nozzle_type"].get<std::string>();
|
||||
auto nozzle_type = jj["nozzle_type"].get<std::string>();
|
||||
m_nozzle_data.nozzles[0].type = nozzle_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
nozzle_type = "";
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
;
|
||||
|
@ -3927,7 +3917,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
}
|
||||
PresetBundle *preset_bundle = Slic3r::GUI::wxGetApp().preset_bundle;
|
||||
std::ostringstream stream;
|
||||
stream << std::fixed << std::setprecision(1) << nozzle_diameter;
|
||||
stream << std::fixed << std::setprecision(1) << DeviceManager::nozzle_diameter_conver(m_nozzle_data.nozzles[0].diameter);
|
||||
std::string nozzle_diameter_str = stream.str();
|
||||
if (m_printer_preset_name.find(nozzle_diameter_str + " nozzle") == std::string::npos)
|
||||
update_printer_preset_name(nozzle_diameter_str);
|
||||
|
@ -4808,44 +4798,12 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
|||
}
|
||||
}
|
||||
|
||||
/*parse np*/
|
||||
/*parse new print data*/
|
||||
try
|
||||
{
|
||||
if (jj.contains("cfg") && jj.contains("fun") && jj.contains("aux") && jj.contains("stat")) {
|
||||
is_enable_np = true;
|
||||
}
|
||||
else {
|
||||
is_enable_np = false;
|
||||
}
|
||||
|
||||
if (jj.contains("device")) {
|
||||
json const & device = jj["device"];
|
||||
|
||||
if (device.contains("nozzle")) {
|
||||
json const & nozzle = device["nozzle"];
|
||||
|
||||
m_np_nozzle_data = NozzleData();
|
||||
m_np_nozzle_data.info = nozzle["info"].get<int>();
|
||||
|
||||
|
||||
for (const auto& noz : nozzle.items()) {
|
||||
std::string nozzle_id = noz.key();
|
||||
json const & ndata = noz.value();
|
||||
|
||||
Nozzle n;
|
||||
if (ndata.contains("info")) {n.info = ndata["info"].get<int>(); }
|
||||
if (ndata.contains("snow")) {n.info = ndata["snow"].get<int>(); }
|
||||
if (ndata.contains("spre")) {n.info = ndata["spre"].get<int>(); }
|
||||
if (ndata.contains("star")) {n.info = ndata["star"].get<int>(); }
|
||||
if (ndata.contains("stat")) {n.info = ndata["stat"].get<int>(); }
|
||||
if (ndata.contains("temp")) {n.info = ndata["temp"].get<int>(); }
|
||||
m_np_nozzle_data.nozzle[nozzle_id] = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
parse_new_info(jj);
|
||||
}
|
||||
catch (...)
|
||||
{}
|
||||
catch (...){}
|
||||
}
|
||||
|
||||
if (!key_field_only) {
|
||||
|
@ -5434,9 +5392,223 @@ AmsTray MachineObject::parse_vt_tray(json vtray)
|
|||
return vt_tray;
|
||||
}
|
||||
|
||||
void MachineObject::parse_new_info(json print)
|
||||
{
|
||||
if (print.contains("cfg") && print.contains("fun") && print.contains("aux") && print.contains("stat")) {
|
||||
is_enable_np = true;
|
||||
BOOST_LOG_TRIVIAL(info) << "using new print data for parsing";
|
||||
}
|
||||
else {
|
||||
is_enable_np = false;
|
||||
return;
|
||||
}
|
||||
|
||||
/*cfg*/
|
||||
std::string cfg = print["cfg"].get<std::string>();
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "new print data cfg = " << cfg;
|
||||
|
||||
if(!cfg.empty()){
|
||||
if (ams_user_setting_hold_count > 0) ams_user_setting_hold_count--;
|
||||
if (camera_recording_hold_count > 0) camera_recording_hold_count--;
|
||||
if (camera_resolution_hold_count > 0) camera_resolution_hold_count--;
|
||||
if (camera_timelapse_hold_count > 0) camera_timelapse_hold_count--;
|
||||
//if (xcam_buildplate_marker_hold_count > 0) xcam_buildplate_marker_hold_count--;first_layer_inspector
|
||||
if (xcam_first_layer_hold_count > 0) xcam_first_layer_hold_count--;
|
||||
if (xcam_ai_monitoring_hold_count > 0) xcam_ai_monitoring_hold_count--;
|
||||
if (xcam_auto_recovery_hold_count > 0) xcam_auto_recovery_hold_count--;
|
||||
if (ams_print_option_count > 0) ams_print_option_count--;
|
||||
if (xcam_prompt_sound_hold_count > 0) xcam_prompt_sound_hold_count--;
|
||||
if (xcam_filament_tangle_detect_count > 0)xcam_filament_tangle_detect_count--;
|
||||
if (nozzle_setting_hold_count > 0)nozzle_setting_hold_count--;
|
||||
|
||||
|
||||
|
||||
ams_insert_flag = get_flag_bits(cfg, 0);
|
||||
ams_power_on_flag = get_flag_bits(cfg, 1);
|
||||
upgrade_force_upgrade = get_flag_bits(cfg, 2);
|
||||
camera_recording_when_printing = get_flag_bits(cfg, 3);
|
||||
camera_resolution = get_flag_bits(cfg, 4) == 0 ? "720p" : "1080p";
|
||||
//liveview_local = get_flag_bits(cfg, 5); todo zhanma
|
||||
camera_timelapse = get_flag_bits(cfg, 6);
|
||||
tutk_state = get_flag_bits(cfg, 7) == 1 ? "disable" : "";
|
||||
chamber_light = get_flag_bits(cfg, 8) == 1 ? LIGHT_EFFECT::LIGHT_EFFECT_ON : LIGHT_EFFECT::LIGHT_EFFECT_OFF;
|
||||
printing_speed_lvl = (PrintingSpeedLevel)get_flag_bits(cfg, 9, 3);
|
||||
//is_support_build_plate_marker_detect = get_flag_bits(cfg, 12); todo yangcong
|
||||
|
||||
xcam_first_layer_inspector = get_flag_bits(cfg, 13);
|
||||
|
||||
switch (get_flag_bits(cfg, 14, 2))
|
||||
{
|
||||
case 0:
|
||||
xcam_ai_monitoring_sensitivity = "never_halt";
|
||||
break;
|
||||
case 1:
|
||||
xcam_ai_monitoring_sensitivity = "low";
|
||||
break;
|
||||
case 2:
|
||||
xcam_ai_monitoring_sensitivity = "medium";
|
||||
break;
|
||||
case 3:
|
||||
xcam_ai_monitoring_sensitivity = "high";
|
||||
break;
|
||||
}
|
||||
|
||||
xcam_ai_monitoring = get_flag_bits(cfg, 16);
|
||||
xcam_auto_recovery_step_loss = get_flag_bits(cfg, 17);
|
||||
ams_calibrate_remain_flag = get_flag_bits(cfg, 18);
|
||||
ams_auto_switch_filament_flag = get_flag_bits(cfg, 19);
|
||||
xcam_allow_prompt_sound = get_flag_bits(cfg, 23);
|
||||
xcam_filament_tangle_detect = get_flag_bits(cfg, 24);
|
||||
nozzle_blob_detection_enabled = get_flag_bits(cfg, 25);
|
||||
installed_upgrade_kit = get_flag_bits(cfg, 26);
|
||||
}
|
||||
|
||||
/*fun*/
|
||||
std::string fun = print["fun"].get<std::string>();
|
||||
BOOST_LOG_TRIVIAL(info) << "new print data fun = " << fun;
|
||||
|
||||
if (!fun.empty()) {
|
||||
|
||||
is_support_agora = get_flag_bits(fun, 1);
|
||||
if (is_support_agora) is_support_tunnel_mqtt = false;
|
||||
|
||||
is_220V_voltage = get_flag_bits(fun, 3) == 0?false:true;
|
||||
is_support_flow_calibration = get_flag_bits(fun, 6);
|
||||
is_support_pa_calibration = get_flag_bits(fun, 7);
|
||||
is_support_prompt_sound = get_flag_bits(fun, 8);
|
||||
is_support_filament_tangle_detect = get_flag_bits(fun, 9);
|
||||
is_support_motor_noise_cali = get_flag_bits(fun, 10);
|
||||
is_support_user_preset = get_flag_bits(fun, 11);
|
||||
is_support_nozzle_blob_detection = get_flag_bits(fun, 13);
|
||||
is_support_upgrade_kit = get_flag_bits(cfg, 14);
|
||||
}
|
||||
|
||||
/*aux*/
|
||||
std::string aux = print["aux"].get<std::string>();
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "new print data aux = " << aux;
|
||||
|
||||
if (!aux.empty()) {
|
||||
//ams_exist_bits = get_flag_bits(aux, 8, 3); //todo yangcong
|
||||
sdcard_state = MachineObject::SdcardState(get_flag_bits(aux, 12, 2));
|
||||
}
|
||||
|
||||
/*stat*/
|
||||
std::string stat = print["stat"].get<std::string>();
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "new print data stat = " << stat;
|
||||
|
||||
if (!stat.empty()) {
|
||||
//sdcard_state = get_flag_bits(aux, 12, 2); todo yangcong
|
||||
camera_recording = get_flag_bits(stat, 7);
|
||||
}
|
||||
|
||||
/*device*/
|
||||
if (print.contains("device")) {
|
||||
json const& device = print["device"];
|
||||
|
||||
if (device.contains("type")) {
|
||||
int type = device["type"]; //FDM:1<<0 Laser:1<< Cut:1<<2
|
||||
}
|
||||
|
||||
if (device.contains("bed_temp")) {
|
||||
bed_temp = get_flag_bits(device["bed_temp"].get<int>(), 0, 15);
|
||||
bed_temp_target = get_flag_bits(device["bed_temp"].get<int>(), 16, 15);
|
||||
}
|
||||
|
||||
if (device.contains("cham_temp")) {
|
||||
chamber_temp = get_flag_bits(device["cham_temp"].get<int>(), 0, 15);
|
||||
chamber_temp_target = get_flag_bits(device["cham_temp"].get<int>(), 16, 15);
|
||||
}
|
||||
|
||||
if (device.contains("fan")) {
|
||||
big_fan1_speed = get_flag_bits(device["fan"].get<int>(), 0, 3);
|
||||
big_fan2_speed = get_flag_bits(device["fan"].get<int>(), 4, 3);
|
||||
cooling_fan_speed = get_flag_bits(device["fan"].get<int>(), 8, 3);
|
||||
heatbreak_fan_speed = get_flag_bits(device["fan"].get<int>(), 12, 3);
|
||||
}
|
||||
|
||||
if (device.contains("nozzle")) {
|
||||
json const& nozzle = device["nozzle"];
|
||||
|
||||
m_nozzle_data = NozzleData();
|
||||
m_nozzle_data.current_nozzle_id = get_flag_bits(nozzle["info"].get<int>(), 0, 3);
|
||||
m_nozzle_data.target_nozzle_id = get_flag_bits(nozzle["info"].get<int>(), 4, 3);
|
||||
m_nozzle_data.total_nozzle_count = get_flag_bits(nozzle["info"].get<int>(), 8, 3);
|
||||
|
||||
|
||||
for (int i = 0; i < m_nozzle_data.total_nozzle_count; i++) {
|
||||
|
||||
Nozzle nozzle_obj;
|
||||
|
||||
std::string nozzle_id = std::to_string(i);
|
||||
if (nozzle.contains(nozzle_id)) {
|
||||
auto njon = nozzle[nozzle_id].get<json>();
|
||||
|
||||
nozzle_obj.type = DeviceManager::nozzle_type_conver(get_flag_bits(njon["info"].get<int>(), 0, 2));
|
||||
nozzle_obj.diameter = DeviceManager::nozzle_diameter_conver(get_flag_bits(njon["info"].get<int>(), 3, 3));
|
||||
nozzle_obj.ext_has_filament = get_flag_bits(njon["info"].get<int>(), 7);
|
||||
nozzle_obj.buffer_has_filament = get_flag_bits(njon["info"].get<int>(), 8);
|
||||
nozzle_obj.flow_type = get_flag_bits(njon["info"].get<int>(), 9, 2);
|
||||
nozzle_obj.temp = get_flag_bits(njon["temp"].get<int>(), 0, 15);
|
||||
nozzle_obj.target_temp = get_flag_bits(njon["temp"].get<int>(), 16, 15);
|
||||
|
||||
AmsSlot spre;
|
||||
spre.ams_id = std::to_string(get_flag_bits(njon["spre"].get<int>(), 0, 8));
|
||||
spre.slot_id = std::to_string(get_flag_bits(njon["spre"].get<int>(), 8, 8));
|
||||
|
||||
AmsSlot snow;
|
||||
snow.ams_id = std::to_string(get_flag_bits(njon["snow"].get<int>(), 0, 8));
|
||||
snow.slot_id = std::to_string(get_flag_bits(njon["snow"].get<int>(), 8, 8));
|
||||
|
||||
AmsSlot star;
|
||||
star.ams_id = std::to_string(get_flag_bits(njon["star"].get<int>(), 0, 8));
|
||||
star.slot_id = std::to_string(get_flag_bits(njon["star"].get<int>(), 8, 8));
|
||||
|
||||
nozzle_obj.spre = spre;
|
||||
nozzle_obj.snow = snow;
|
||||
nozzle_obj.star = star;
|
||||
nozzle_obj.ams_stat = get_flag_bits(njon["stat"].get<int>(), 0, 15);
|
||||
nozzle_obj.rfid_stat = get_flag_bits(njon["stat"].get<int>(), 16, 7);
|
||||
}
|
||||
|
||||
m_nozzle_data.nozzles.push_back(nozzle_obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int MachineObject::get_flag_bits(std::string str, int start, int count)
|
||||
{
|
||||
int decimal_value = std::stoi(str, nullptr, 16);
|
||||
int mask = 0;
|
||||
for (int i = 0; i < count; i++) {
|
||||
mask += 1 << (start + i);
|
||||
}
|
||||
|
||||
int flag = (decimal_value & (mask)) >> start;
|
||||
return flag;
|
||||
}
|
||||
|
||||
int MachineObject::get_flag_bits(int num, int start, int count)
|
||||
{
|
||||
int decimal_value = num;
|
||||
int mask = 0;
|
||||
for (int i = 0; i < count; i++) {
|
||||
mask += 1 << (start + i);
|
||||
}
|
||||
|
||||
int flag = (decimal_value & (mask)) >> start;
|
||||
return flag;
|
||||
}
|
||||
|
||||
bool DeviceManager::EnableMultiMachine = false;
|
||||
bool DeviceManager::key_field_only = false;
|
||||
|
||||
std::vector<float> nozzle_diameter_list{ 0.2f,0.4f,0.6f,0.8f };
|
||||
std::vector<std::string> nozzle_type_list{ "hardened_steel", "stainless_steel" };
|
||||
|
||||
DeviceManager::DeviceManager(NetworkAgent* agent)
|
||||
{
|
||||
m_agent = agent;
|
||||
|
@ -5461,6 +5633,45 @@ DeviceManager::~DeviceManager()
|
|||
userMachineList.clear();
|
||||
}
|
||||
|
||||
|
||||
float DeviceManager::nozzle_diameter_conver(int diame)
|
||||
{
|
||||
if (diame < nozzle_diameter_list.size() && diame >= 0) {
|
||||
return nozzle_diameter_list[diame];
|
||||
}
|
||||
return 0.4f;
|
||||
}
|
||||
|
||||
int DeviceManager::nozzle_diameter_conver(float diame)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < nozzle_diameter_list.size(); i++) {
|
||||
if (nozzle_diameter_list[i] == diame) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
std::string DeviceManager::nozzle_type_conver(int type)
|
||||
{
|
||||
if (type < nozzle_type_list.size() && type >= 0) {
|
||||
return nozzle_type_list[type];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
int DeviceManager::nozzle_type_conver(std::string& type)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < nozzle_type_list.size(); i++) {
|
||||
if (nozzle_type_list[i] == type) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
void DeviceManager::set_agent(NetworkAgent* agent)
|
||||
{
|
||||
m_agent = agent;
|
||||
|
|
|
@ -136,20 +136,37 @@ enum ManualPaCaliMethod {
|
|||
PA_PATTERN,
|
||||
};
|
||||
|
||||
|
||||
struct AmsSlot
|
||||
{
|
||||
std::string ams_id;
|
||||
std::string slot_id;
|
||||
};
|
||||
|
||||
struct Nozzle
|
||||
{
|
||||
int info{0};
|
||||
int snow{0};
|
||||
int spre{0};
|
||||
int star{0};
|
||||
int stat{0};
|
||||
std::string type; //0-hardened_steel 1-stainless_steel
|
||||
float diameter = {0.4f}; // 0-0.2mm 1-0.4mm 2-0.6 mm3-0.8mm
|
||||
int exist{0}; //0-Not Installed 1-Wrong extruder 2-No enablement 3-Enable
|
||||
int ext_has_filament{0};
|
||||
int buffer_has_filament{0};
|
||||
int flow_type{0};//0-common 1-high flow
|
||||
|
||||
int temp{0};
|
||||
int target_temp{0};
|
||||
AmsSlot spre; //tray_pre
|
||||
AmsSlot snow; //tray_now
|
||||
AmsSlot star; //tray_tar
|
||||
int ams_stat{0}; ;
|
||||
int rfid_stat{0}; ;
|
||||
};
|
||||
|
||||
struct NozzleData
|
||||
{
|
||||
std::map<std::string, Nozzle> nozzle; /*0 - main nozzle 1 - slave nozzle*/
|
||||
int info{0};
|
||||
int current_nozzle_id{0};
|
||||
int target_nozzle_id{0};
|
||||
int total_nozzle_count {0};
|
||||
std::vector<Nozzle> nozzles;
|
||||
};
|
||||
|
||||
struct RatingInfo {
|
||||
|
@ -439,9 +456,7 @@ public:
|
|||
std::string dev_id;
|
||||
bool local_use_ssl_for_mqtt { true };
|
||||
bool local_use_ssl_for_ftp { true };
|
||||
float nozzle_diameter { 0.0f };
|
||||
int subscribe_counter{3};
|
||||
std::string nozzle_type;
|
||||
std::string dev_connection_type; /* lan | cloud */
|
||||
std::string connection_type() { return dev_connection_type; }
|
||||
std::string dev_connection_name; /* lan | eth */
|
||||
|
@ -564,8 +579,8 @@ public:
|
|||
int last_online_version = -1;
|
||||
|
||||
/* temperature */
|
||||
float nozzle_temp;
|
||||
float nozzle_temp_target;
|
||||
//float nozzle_temp;
|
||||
//float nozzle_temp_target;
|
||||
float bed_temp;
|
||||
float bed_temp_target;
|
||||
float chamber_temp;
|
||||
|
@ -776,7 +791,9 @@ public:
|
|||
bool is_support_ai_monitoring {false};
|
||||
bool is_support_lidar_calibration {false};
|
||||
bool is_support_build_plate_marker_detect{false};
|
||||
bool is_support_pa_calibration{false};
|
||||
bool is_support_flow_calibration{false};
|
||||
bool is_support_auto_flow_calibration{false};
|
||||
bool is_support_print_without_sd{false};
|
||||
bool is_support_print_all{false};
|
||||
bool is_support_send_to_sdcard {false};
|
||||
|
@ -799,12 +816,14 @@ public:
|
|||
bool is_support_motor_noise_cali{false};
|
||||
bool is_support_wait_sending_finish{false};
|
||||
bool is_support_user_preset{false};
|
||||
bool is_support_p1s_plus{false};
|
||||
//bool is_support_p1s_plus{false};
|
||||
bool is_support_nozzle_blob_detection{false};
|
||||
bool is_support_air_print_detection{false};
|
||||
bool is_support_filament_setting_inprinting{false};
|
||||
bool is_support_agora{false};
|
||||
bool is_support_upgrade_kit{false};
|
||||
|
||||
bool installed_upgrade_kit{false};
|
||||
int nozzle_max_temperature = -1;
|
||||
int bed_temperature_limit = -1;
|
||||
|
||||
|
@ -892,7 +911,6 @@ public:
|
|||
int command_ams_switch(int tray_index, int old_temp = 210, int new_temp = 210);
|
||||
int command_ams_change_filament(int tray_id, int old_temp = 210, int new_temp = 210);
|
||||
int command_ams_user_settings(int ams_id, bool start_read_opt, bool tray_read_opt, bool remain_flag = false);
|
||||
int command_ams_user_settings(int ams_id, AmsOptionType op, bool value);
|
||||
int command_ams_switch_filament(bool switch_filament);
|
||||
int command_ams_air_print_detect(bool air_print_detect);
|
||||
int command_ams_calibrate(int ams_id);
|
||||
|
@ -1002,12 +1020,17 @@ public:
|
|||
std::string get_string_from_fantype(FanType type);
|
||||
|
||||
/*for more extruder*/
|
||||
bool is_enable_np{ false };
|
||||
NozzleData m_np_nozzle_data;
|
||||
bool is_enable_np{ false };
|
||||
NozzleData m_nozzle_data;
|
||||
|
||||
/*vi slot data*/
|
||||
std::vector<AmsTray> vt_slot;
|
||||
AmsTray parse_vt_tray(json vtray);
|
||||
|
||||
/*for parse new info*/
|
||||
void parse_new_info(json print);
|
||||
int get_flag_bits(std::string str, int start, int count = 1);
|
||||
int get_flag_bits(int num, int start, int count = 1);
|
||||
};
|
||||
|
||||
class DeviceManager
|
||||
|
@ -1030,6 +1053,11 @@ public:
|
|||
void keep_alive();
|
||||
void check_pushing();
|
||||
|
||||
static float nozzle_diameter_conver(int diame);
|
||||
static int nozzle_diameter_conver(float diame);
|
||||
static std::string nozzle_type_conver(int type);
|
||||
static int nozzle_type_conver(std::string& type);
|
||||
|
||||
MachineObject* get_default_machine();
|
||||
MachineObject* get_local_selected_machine();
|
||||
MachineObject* get_local_machine(std::string dev_id);
|
||||
|
|
|
@ -555,8 +555,8 @@ void PrinterPartsDialog::set_nozzle_diameter(wxCommandEvent& evt)
|
|||
auto nozzle_diameter = std::stof(nozzle_diameter_checkbox->GetStringSelection().ToStdString());
|
||||
nozzle_diameter = round(nozzle_diameter * 10) / 10;
|
||||
|
||||
obj->nozzle_diameter = nozzle_diameter;
|
||||
obj->nozzle_type = nozzle_type;
|
||||
obj->m_nozzle_data.nozzles[0].diameter = nozzle_diameter;
|
||||
obj->m_nozzle_data.nozzles[0].type = nozzle_type;
|
||||
|
||||
obj->command_set_printer_nozzle(nozzle_type, nozzle_diameter);
|
||||
}
|
||||
|
@ -580,12 +580,9 @@ bool PrinterPartsDialog::Show(bool show)
|
|||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
CentreOnParent();
|
||||
|
||||
auto type = obj->nozzle_type;
|
||||
auto diameter = 0.4f;
|
||||
|
||||
if (obj->nozzle_diameter > 0) {
|
||||
diameter = round(obj->nozzle_diameter * 10) / 10;
|
||||
}
|
||||
auto type = obj->m_nozzle_data.nozzles[0].type;
|
||||
auto diameter = obj->m_nozzle_data.nozzles[0].diameter;
|
||||
|
||||
nozzle_type_checkbox->Clear();
|
||||
nozzle_diameter_checkbox->Clear();
|
||||
|
|
|
@ -1782,7 +1782,7 @@ wxWindow *SelectMachineDialog::create_item_checkbox(wxString title, wxWindow *pa
|
|||
|
||||
void SelectMachineDialog::update_select_layout(MachineObject *obj)
|
||||
{
|
||||
if (obj && obj->is_support_flow_calibration) {
|
||||
if (obj && obj->is_support_auto_flow_calibration) {
|
||||
select_flow->Show();
|
||||
} else {
|
||||
select_flow->Hide();
|
||||
|
@ -2556,14 +2556,14 @@ bool SelectMachineDialog::is_same_nozzle_diameters(std::string& tag_nozzle_type,
|
|||
preset_nozzle_type = "stainless_steel";
|
||||
}
|
||||
|
||||
tag_nozzle_type = obj_->nozzle_type;
|
||||
tag_nozzle_type = obj_->m_nozzle_data.nozzles[0].type;
|
||||
|
||||
auto extruders = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_used_extruders();
|
||||
if (opt_nozzle_diameters != nullptr) {
|
||||
for (auto i = 0; i < extruders.size(); i++) {
|
||||
auto extruder = extruders[i] - 1;
|
||||
preset_nozzle_diameters = float(opt_nozzle_diameters->get_at(extruder));
|
||||
if (preset_nozzle_diameters != obj_->nozzle_diameter) {
|
||||
if (preset_nozzle_diameters != obj_->m_nozzle_data.nozzles[0].diameter) {
|
||||
is_same_nozzle_diameters = false;
|
||||
}
|
||||
}
|
||||
|
@ -2593,10 +2593,10 @@ bool SelectMachineDialog::is_same_nozzle_type(std::string& filament_type, std::s
|
|||
|
||||
NozzleType nozzle_type = NozzleType::ntUndefine;
|
||||
|
||||
if (obj_->nozzle_type == "stainless_steel") {
|
||||
if (obj_->m_nozzle_data.nozzles[0].type == "stainless_steel") {
|
||||
nozzle_type = NozzleType::ntStainlessSteel;
|
||||
}
|
||||
else if (obj_->nozzle_type == "hardened_steel") {
|
||||
else if (obj_->m_nozzle_data.nozzles[0].type == "hardened_steel") {
|
||||
nozzle_type = NozzleType::ntHardenedSteel;
|
||||
}
|
||||
|
||||
|
@ -2617,7 +2617,7 @@ bool SelectMachineDialog::is_same_nozzle_type(std::string& filament_type, std::s
|
|||
return is_same_nozzle_type;
|
||||
}
|
||||
else {
|
||||
tag_nozzle_type = obj_->nozzle_type;
|
||||
tag_nozzle_type = DeviceManager::nozzle_type_conver(obj_->m_nozzle_data.nozzles[0].type);
|
||||
}
|
||||
|
||||
iter++;
|
||||
|
@ -2642,7 +2642,8 @@ bool SelectMachineDialog::is_same_printer_model()
|
|||
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
|
||||
if (preset_bundle && preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle) != obj_->printer_type) {
|
||||
|
||||
if (obj_->is_support_p1s_plus && (preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle) == "C12")) {
|
||||
if ((obj_->is_support_upgrade_kit && obj_->installed_upgrade_kit)
|
||||
&& (preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle) == "C12")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2651,7 +2652,7 @@ bool SelectMachineDialog::is_same_printer_model()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (obj_->is_support_p1s_plus) {
|
||||
if (obj_->is_support_upgrade_kit && obj_->installed_upgrade_kit) {
|
||||
BOOST_LOG_TRIVIAL(info) << "printer_model: source = " << preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
|
||||
BOOST_LOG_TRIVIAL(info) << "printer_model: target = " << obj_->printer_type << " (plus)";
|
||||
return false;
|
||||
|
@ -2807,13 +2808,13 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||
std::string filament_type;
|
||||
std::string tag_nozzle_type;
|
||||
|
||||
if (!obj_->nozzle_type.empty() && (m_print_type == PrintFromType::FROM_NORMAL)) {
|
||||
if (!obj_->m_nozzle_data.nozzles[0].type.empty() && (m_print_type == PrintFromType::FROM_NORMAL)) {
|
||||
if (!is_same_nozzle_diameters(tag_nozzle_type, nozzle_diameter)) {
|
||||
has_slice_warnings = true;
|
||||
is_printing_block = true;
|
||||
|
||||
wxString nozzle_in_preset = wxString::Format(_L("nozzle in preset: %s %s"),nozzle_diameter, "");
|
||||
wxString nozzle_in_printer = wxString::Format(_L("nozzle memorized: %.1f %s"), obj_->nozzle_diameter, "");
|
||||
wxString nozzle_in_printer = wxString::Format(_L("nozzle memorized: %.1f %s"), obj_->m_nozzle_data.nozzles[0].diameter, "");
|
||||
|
||||
confirm_text.push_back(ConfirmBeforeSendInfo(_L("Your nozzle diameter in sliced file is not consistent with memorized nozzle. If you changed your nozzle lately, please go to Device > Printer Parts to change settings.")
|
||||
+ "\n " + nozzle_in_preset
|
||||
|
@ -2824,9 +2825,9 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event)
|
|||
if (!is_same_nozzle_type(filament_type, tag_nozzle_type)){
|
||||
has_slice_warnings = true;
|
||||
is_printing_block = true;
|
||||
nozzle_diameter = wxString::Format("%.1f", obj_->nozzle_diameter).ToStdString();
|
||||
nozzle_diameter = wxString::Format("%.1f", obj_->m_nozzle_data.nozzles[0].diameter).ToStdString();
|
||||
|
||||
wxString nozzle_in_preset = wxString::Format(_L("Printing %1s material with %2s nozzle may cause nozzle damage."), filament_type,format_steel_name(obj_->nozzle_type));
|
||||
wxString nozzle_in_preset = wxString::Format(_L("Printing high temperature material(%s material) with %s may cause nozzle damage"), filament_type, format_steel_name(obj_->m_nozzle_data.nozzles[0].type));
|
||||
confirm_text.push_back(ConfirmBeforeSendInfo(nozzle_in_preset, ConfirmBeforeSendInfo::InfoLevel::Warning));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2354,7 +2354,7 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj)
|
|||
m_tempCtrl_bed->SetIconNormal();
|
||||
}
|
||||
|
||||
m_tempCtrl_nozzle->SetCurrTemp((int) obj->nozzle_temp);
|
||||
m_tempCtrl_nozzle->SetCurrTemp((int) obj->m_nozzle_data.nozzles[0].temp);
|
||||
if (obj->nozzle_max_temperature > -1) {
|
||||
if (m_tempCtrl_nozzle) m_tempCtrl_nozzle->SetMaxTemp(obj->nozzle_max_temperature);
|
||||
}
|
||||
|
@ -2365,10 +2365,10 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj)
|
|||
if (m_temp_nozzle_timeout > 0) {
|
||||
m_temp_nozzle_timeout--;
|
||||
} else {
|
||||
if (!nozzle_temp_input) { m_tempCtrl_nozzle->SetTagTemp((int) obj->nozzle_temp_target); }
|
||||
if (!nozzle_temp_input) { m_tempCtrl_nozzle->SetTagTemp((int) obj->m_nozzle_data.nozzles[0].target_temp); }
|
||||
}
|
||||
|
||||
if ((obj->nozzle_temp_target - obj->nozzle_temp) >= TEMP_THRESHOLD_VAL) {
|
||||
if ((obj->m_nozzle_data.nozzles[0].target_temp - obj->m_nozzle_data.nozzles[0].temp) >= TEMP_THRESHOLD_VAL) {
|
||||
m_tempCtrl_nozzle->SetIconActive();
|
||||
} else {
|
||||
m_tempCtrl_nozzle->SetIconNormal();
|
||||
|
@ -2576,7 +2576,7 @@ void StatusPanel::update_ams(MachineObject *obj)
|
|||
if (obj && (obj->last_cali_version != obj->cali_version)) {
|
||||
last_cali_version = obj->cali_version;
|
||||
PACalibExtruderInfo cali_info;
|
||||
cali_info.nozzle_diameter = obj->nozzle_diameter;
|
||||
cali_info.nozzle_diameter = obj->m_nozzle_data.nozzles[0].diameter;
|
||||
CalibUtils::emit_get_PA_calib_info(cali_info);
|
||||
}
|
||||
|
||||
|
@ -3400,7 +3400,7 @@ void StatusPanel::axis_ctrl_e_hint(bool up_down)
|
|||
void StatusPanel::on_axis_ctrl_e_up_10(wxCommandEvent &event)
|
||||
{
|
||||
if (obj) {
|
||||
if (obj->nozzle_temp >= TEMP_THRESHOLD_ALLOW_E_CTRL || (wxGetApp().app_config->get("not_show_ectrl_hint") == "1"))
|
||||
if (obj->m_nozzle_data.nozzles[0].temp >= TEMP_THRESHOLD_ALLOW_E_CTRL || (wxGetApp().app_config->get("not_show_ectrl_hint") == "1"))
|
||||
obj->command_axis_control("E", 1.0, -10.0f, 900);
|
||||
else
|
||||
axis_ctrl_e_hint(true);
|
||||
|
@ -3410,7 +3410,7 @@ void StatusPanel::on_axis_ctrl_e_up_10(wxCommandEvent &event)
|
|||
void StatusPanel::on_axis_ctrl_e_down_10(wxCommandEvent &event)
|
||||
{
|
||||
if (obj) {
|
||||
if (obj->nozzle_temp >= TEMP_THRESHOLD_ALLOW_E_CTRL || (wxGetApp().app_config->get("not_show_ectrl_hint") == "1"))
|
||||
if (obj->m_nozzle_data.nozzles[0].temp >= TEMP_THRESHOLD_ALLOW_E_CTRL || (wxGetApp().app_config->get("not_show_ectrl_hint") == "1"))
|
||||
obj->command_axis_control("E", 1.0, 10.0f, 900);
|
||||
else
|
||||
axis_ctrl_e_hint(false);
|
||||
|
|
|
@ -111,9 +111,9 @@ static bool is_same_nozzle_diameters(const DynamicPrintConfig &full_config, cons
|
|||
auto opt_nozzle_diameters = full_config.option<ConfigOptionFloats>("nozzle_diameter");
|
||||
if (opt_nozzle_diameters != nullptr) {
|
||||
float preset_nozzle_diameter = opt_nozzle_diameters->get_at(0);
|
||||
if (preset_nozzle_diameter != obj->nozzle_diameter) {
|
||||
if (preset_nozzle_diameter != obj->m_nozzle_data.nozzles[0].diameter) {
|
||||
wxString nozzle_in_preset = wxString::Format(_L("nozzle in preset: %s %s"), wxString::Format("%.1f", preset_nozzle_diameter).ToStdString(), to_wstring_name(nozzle_type));
|
||||
wxString nozzle_in_printer = wxString::Format(_L("nozzle memorized: %.1f %s"), obj->nozzle_diameter, to_wstring_name(obj->nozzle_type));
|
||||
wxString nozzle_in_printer = wxString::Format(_L("nozzle memorized: %.1f %s"), obj->m_nozzle_data.nozzles[0].diameter, DeviceManager::nozzle_type_conver(obj->m_nozzle_data.nozzles[0].diameter));
|
||||
|
||||
error_msg = _L("Your nozzle diameter in preset is not consistent with memorized nozzle diameter. Did you change your nozzle lately?") + "\n " + nozzle_in_preset +
|
||||
"\n " + nozzle_in_printer + "\n";
|
||||
|
@ -133,9 +133,9 @@ static bool is_same_nozzle_type(const DynamicPrintConfig &full_config, const Mac
|
|||
|
||||
NozzleType nozzle_type = NozzleType::ntUndefine;
|
||||
|
||||
if (obj->nozzle_type == "stainless_steel") {
|
||||
if (obj->m_nozzle_data.nozzles[0].type == "stainless_steel") {
|
||||
nozzle_type = NozzleType::ntStainlessSteel;
|
||||
} else if (obj->nozzle_type == "hardened_steel") {
|
||||
} else if (obj->m_nozzle_data.nozzles[0].type == "hardened_steel") {
|
||||
nozzle_type = NozzleType::ntHardenedSteel;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ static bool is_same_nozzle_type(const DynamicPrintConfig &full_config, const Mac
|
|||
if (abs(filament_nozzle_hrc) > abs(printer_nozzle_hrc)) {
|
||||
BOOST_LOG_TRIVIAL(info) << "filaments hardness mismatch: printer_nozzle_hrc = " << printer_nozzle_hrc << ", filament_nozzle_hrc = " << filament_nozzle_hrc;
|
||||
std::string filament_type = full_config.opt_string("filament_type", 0);
|
||||
error_msg = wxString::Format(_L("*Printing %s material with %s may cause nozzle damage"), filament_type, to_wstring_name(obj->nozzle_type));
|
||||
error_msg = wxString::Format(_L("*Printing %s material with %s may cause nozzle damage"), filament_type, to_wstring_name(obj->m_nozzle_data.nozzles[0].type));
|
||||
error_msg += "\n";
|
||||
|
||||
MessageDialog msg_dlg(nullptr, error_msg, wxEmptyString, wxICON_WARNING | wxOK | wxCANCEL);
|
||||
|
@ -178,7 +178,7 @@ static bool check_nozzle_diameter_and_type(const DynamicPrintConfig &full_config
|
|||
}
|
||||
|
||||
// P1P/S
|
||||
if (obj->nozzle_type.empty())
|
||||
if (obj->m_nozzle_data.nozzles[0].type.empty())
|
||||
return true;
|
||||
|
||||
if (!is_same_nozzle_diameters(full_config, obj, error_msg))
|
||||
|
|
Loading…
Reference in New Issue