ENH: AMSSetting dialog can select pa cali result
Change-Id: I4d3649d904a5e9e93e93a0555186319cec65fa10 (cherry picked from commit 4ddaaf8e9dd552930653c93d97e677a5acd6982e)
This commit is contained in:
parent
663e0503a2
commit
af770a87b8
|
@ -5,6 +5,7 @@
|
||||||
#include "libslic3r/Preset.hpp"
|
#include "libslic3r/Preset.hpp"
|
||||||
#include "I18N.hpp"
|
#include "I18N.hpp"
|
||||||
#include <wx/dcgraph.h>
|
#include <wx/dcgraph.h>
|
||||||
|
#include "CalibUtils.hpp"
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
@ -110,6 +111,8 @@ void AMSMaterialsSetting::create()
|
||||||
Bind(wxEVT_PAINT, &AMSMaterialsSetting::paintEvent, this);
|
Bind(wxEVT_PAINT, &AMSMaterialsSetting::paintEvent, this);
|
||||||
Bind(EVT_SELECTED_COLOR, &AMSMaterialsSetting::on_picker_color, this);
|
Bind(EVT_SELECTED_COLOR, &AMSMaterialsSetting::on_picker_color, this);
|
||||||
m_comboBox_filament->Connect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(AMSMaterialsSetting::on_select_filament), NULL, this);
|
m_comboBox_filament->Connect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(AMSMaterialsSetting::on_select_filament), NULL, this);
|
||||||
|
|
||||||
|
m_comboBox_cali_result->Connect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(AMSMaterialsSetting::on_select_cali_result), NULL, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMSMaterialsSetting::create_panel_normal(wxWindow* parent)
|
void AMSMaterialsSetting::create_panel_normal(wxWindow* parent)
|
||||||
|
@ -273,6 +276,18 @@ void AMSMaterialsSetting::create_panel_kn(wxWindow* parent)
|
||||||
m_ratio_text->SetForegroundColour(wxColour(50, 58, 61));
|
m_ratio_text->SetForegroundColour(wxColour(50, 58, 61));
|
||||||
m_ratio_text->SetFont(Label::Head_14);
|
m_ratio_text->SetFont(Label::Head_14);
|
||||||
|
|
||||||
|
wxBoxSizer *m_sizer_cali_resutl = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
// pa profile
|
||||||
|
m_title_pa_profile = new wxStaticText(parent, wxID_ANY, _L("PA Profile"), wxDefaultPosition, wxSize(AMS_MATERIALS_SETTING_LABEL_WIDTH, -1), 0);
|
||||||
|
m_title_pa_profile->SetFont(::Label::Body_13);
|
||||||
|
m_title_pa_profile->SetForegroundColour(AMS_MATERIALS_SETTING_GREY800);
|
||||||
|
m_title_pa_profile->Wrap(-1);
|
||||||
|
m_sizer_cali_resutl->Add(m_title_pa_profile, 0, wxALIGN_CENTER, 0);
|
||||||
|
m_sizer_cali_resutl->Add(0, 0, 0, wxEXPAND, 0);
|
||||||
|
|
||||||
|
m_comboBox_cali_result = new ::ComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, AMS_MATERIALS_SETTING_COMBOX_WIDTH, 0, nullptr, wxCB_READONLY);
|
||||||
|
m_sizer_cali_resutl->Add(m_comboBox_cali_result, 1, wxALIGN_CENTER, 0);
|
||||||
|
|
||||||
auto kn_val_sizer = new wxFlexGridSizer(0, 2, 0, 0);
|
auto kn_val_sizer = new wxFlexGridSizer(0, 2, 0, 0);
|
||||||
kn_val_sizer->SetFlexibleDirection(wxBOTH);
|
kn_val_sizer->SetFlexibleDirection(wxBOTH);
|
||||||
kn_val_sizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
kn_val_sizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
||||||
|
@ -300,12 +315,16 @@ void AMSMaterialsSetting::create_panel_kn(wxWindow* parent)
|
||||||
m_input_n_val->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
|
m_input_n_val->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
|
||||||
kn_val_sizer->Add(m_input_n_val, 0, wxALL | wxEXPAND | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
kn_val_sizer->Add(m_input_n_val, 0, wxALL | wxEXPAND | wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||||
|
|
||||||
// hide n
|
// hide n (P1P old logic)
|
||||||
m_n_param->Hide();
|
//if (!this->obj || !this->obj->is_high_printer_type()) {
|
||||||
m_input_n_val->Hide();
|
// m_n_param->Hide();
|
||||||
|
// m_input_n_val->Hide();
|
||||||
|
//}
|
||||||
|
|
||||||
sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
|
sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
|
||||||
sizer->Add(m_ratio_text, 0, wxLEFT | wxRIGHT | wxEXPAND, FromDIP(20));
|
sizer->Add(m_ratio_text, 0, wxLEFT | wxRIGHT | wxEXPAND, FromDIP(20));
|
||||||
|
sizer->Add(0, 0, 0, wxTOP, FromDIP(16));
|
||||||
|
sizer->Add(m_sizer_cali_resutl, 0, wxLEFT | wxRIGHT, FromDIP(20));
|
||||||
sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
|
sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
|
||||||
sizer->Add(kn_val_sizer, 0, wxLEFT | wxRIGHT | wxEXPAND, FromDIP(20));
|
sizer->Add(kn_val_sizer, 0, wxLEFT | wxRIGHT | wxEXPAND, FromDIP(20));
|
||||||
sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
|
sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
|
||||||
|
@ -324,6 +343,7 @@ void AMSMaterialsSetting::paintEvent(wxPaintEvent &evt)
|
||||||
AMSMaterialsSetting::~AMSMaterialsSetting()
|
AMSMaterialsSetting::~AMSMaterialsSetting()
|
||||||
{
|
{
|
||||||
m_comboBox_filament->Disconnect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(AMSMaterialsSetting::on_select_filament), NULL, this);
|
m_comboBox_filament->Disconnect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(AMSMaterialsSetting::on_select_filament), NULL, this);
|
||||||
|
m_comboBox_cali_result->Disconnect(wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler(AMSMaterialsSetting::on_select_cali_result), NULL, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMSMaterialsSetting::input_min_finish()
|
void AMSMaterialsSetting::input_min_finish()
|
||||||
|
@ -450,6 +470,21 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
|
||||||
wxString k_text = m_input_k_val->GetTextCtrl()->GetValue();
|
wxString k_text = m_input_k_val->GetTextCtrl()->GetValue();
|
||||||
wxString n_text = m_input_n_val->GetTextCtrl()->GetValue();
|
wxString n_text = m_input_n_val->GetTextCtrl()->GetValue();
|
||||||
|
|
||||||
|
if (obj && obj->is_high_printer_type()) {
|
||||||
|
PACalibIndexInfo select_index_info;
|
||||||
|
select_index_info.tray_id = tray_id;
|
||||||
|
select_index_info.nozzle_diameter = obj->nozzle_diameter;
|
||||||
|
if (m_pa_cali_select_id > 0) {
|
||||||
|
select_index_info.cali_idx = obj->pa_calib_tab[m_pa_cali_select_id - 1].cali_idx;
|
||||||
|
select_index_info.filament_id = obj->pa_calib_tab[m_pa_cali_select_id - 1].filament_id;
|
||||||
|
} else { // default item
|
||||||
|
select_index_info.cali_idx = -1;
|
||||||
|
select_index_info.filament_id = obj->pa_calib_tab[0].filament_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
CalibUtils::select_PA_calib_result(select_index_info);
|
||||||
|
}
|
||||||
|
|
||||||
if (is_virtual_tray() && obj && !obj->is_support_filament_edit_virtual_tray) {
|
if (is_virtual_tray() && obj && !obj->is_support_filament_edit_virtual_tray) {
|
||||||
if (!ExtrusionCalibration::check_k_validation(k_text)) {
|
if (!ExtrusionCalibration::check_k_validation(k_text)) {
|
||||||
wxString k_tips = _L("Please input a valid value (K in 0~0.5)");
|
wxString k_tips = _L("Please input a valid value (K in 0~0.5)");
|
||||||
|
@ -695,7 +730,7 @@ void AMSMaterialsSetting::update_widgets()
|
||||||
else
|
else
|
||||||
m_panel_normal->Hide();
|
m_panel_normal->Hide();
|
||||||
m_panel_kn->Show();
|
m_panel_kn->Show();
|
||||||
} else if (obj && obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY)) {
|
} else if (obj && (obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY) || obj->is_high_printer_type())) {
|
||||||
m_panel_normal->Show();
|
m_panel_normal->Show();
|
||||||
m_panel_kn->Show();
|
m_panel_kn->Show();
|
||||||
} else {
|
} else {
|
||||||
|
@ -713,7 +748,7 @@ bool AMSMaterialsSetting::Show(bool show)
|
||||||
m_input_nozzle_min->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(20)));
|
m_input_nozzle_min->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(20)));
|
||||||
//m_clr_picker->set_color(m_clr_picker->GetParent()->GetBackgroundColour());
|
//m_clr_picker->set_color(m_clr_picker->GetParent()->GetBackgroundColour());
|
||||||
|
|
||||||
if (obj && obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) {
|
if (obj && (obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI) || obj->is_high_printer_type())) {
|
||||||
m_ratio_text->Show();
|
m_ratio_text->Show();
|
||||||
m_k_param->Show();
|
m_k_param->Show();
|
||||||
m_input_k_val->Show();
|
m_input_k_val->Show();
|
||||||
|
@ -774,6 +809,8 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
||||||
m_readonly_filament->SetLabel("Bambu " + filament);
|
m_readonly_filament->SetLabel("Bambu " + filament);
|
||||||
m_input_nozzle_min->GetTextCtrl()->SetValue(temp_min);
|
m_input_nozzle_min->GetTextCtrl()->SetValue(temp_min);
|
||||||
m_input_nozzle_max->GetTextCtrl()->SetValue(temp_max);
|
m_input_nozzle_max->GetTextCtrl()->SetValue(temp_max);
|
||||||
|
m_title_pa_profile->Hide();
|
||||||
|
m_comboBox_cali_result->Hide();
|
||||||
|
|
||||||
update();
|
update();
|
||||||
Layout();
|
Layout();
|
||||||
|
@ -787,6 +824,8 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
||||||
m_panel_SN->Hide();
|
m_panel_SN->Hide();
|
||||||
m_comboBox_filament->Show();
|
m_comboBox_filament->Show();
|
||||||
m_readonly_filament->Hide();
|
m_readonly_filament->Hide();
|
||||||
|
m_title_pa_profile->Show();
|
||||||
|
m_comboBox_cali_result->Show();
|
||||||
|
|
||||||
|
|
||||||
int selection_idx = -1, idx = 0;
|
int selection_idx = -1, idx = 0;
|
||||||
|
@ -856,6 +895,36 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxArrayString items;
|
||||||
|
if (this->obj && this->obj->is_high_printer_type()) {
|
||||||
|
std::vector<PACalibResult> cali_history = this->obj->pa_calib_tab;
|
||||||
|
items.push_back("default");
|
||||||
|
for (auto cali_item : cali_history) {
|
||||||
|
items.push_back(cali_item.name);
|
||||||
|
}
|
||||||
|
m_comboBox_cali_result->Set(items);
|
||||||
|
|
||||||
|
Ams* selected_ams = this->obj->amsList[std::to_string(ams_id)];
|
||||||
|
AmsTray* selected_tray = selected_ams->trayList[std::to_string(tray_id)];
|
||||||
|
int select_idx = CalibUtils::get_selected_calib_idx(this->obj->pa_calib_tab, selected_tray->cali_idx);
|
||||||
|
m_comboBox_cali_result->SetSelection(select_idx + 1);
|
||||||
|
|
||||||
|
if (select_idx >= 0) {
|
||||||
|
m_input_k_val->GetTextCtrl()->SetValue(std::to_string(this->obj->pa_calib_tab[select_idx].k_value));
|
||||||
|
m_input_n_val->GetTextCtrl()->SetValue(std::to_string(this->obj->pa_calib_tab[select_idx].n_coef));
|
||||||
|
} else { // default value
|
||||||
|
m_input_k_val->GetTextCtrl()->SetValue("0.00");
|
||||||
|
m_input_n_val->GetTextCtrl()->SetValue("0.00");
|
||||||
|
}
|
||||||
|
m_input_k_val->Enable(false);
|
||||||
|
m_input_n_val->Enable(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_input_k_val->Enable(true);
|
||||||
|
m_input_n_val->Enable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
update();
|
update();
|
||||||
Layout();
|
Layout();
|
||||||
Fit();
|
Fit();
|
||||||
|
@ -873,6 +942,19 @@ void AMSMaterialsSetting::msw_rescale()
|
||||||
m_clr_picker->msw_rescale();
|
m_clr_picker->msw_rescale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AMSMaterialsSetting::on_select_cali_result(wxCommandEvent &evt)
|
||||||
|
{
|
||||||
|
m_pa_cali_select_id = evt.GetSelection();
|
||||||
|
if (m_pa_cali_select_id > 0) {
|
||||||
|
m_input_k_val->GetTextCtrl()->SetValue(std::to_string(this->obj->pa_calib_tab[m_pa_cali_select_id - 1].k_value));
|
||||||
|
m_input_n_val->GetTextCtrl()->SetValue(std::to_string(this->obj->pa_calib_tab[m_pa_cali_select_id - 1].n_coef));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
m_input_k_val->GetTextCtrl()->SetValue(std::to_string(0.00));
|
||||||
|
m_input_n_val->GetTextCtrl()->SetValue(std::to_string(0.00));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
||||||
{
|
{
|
||||||
m_filament_type = "";
|
m_filament_type = "";
|
||||||
|
|
|
@ -130,6 +130,7 @@ protected:
|
||||||
void create_panel_kn(wxWindow* parent);
|
void create_panel_kn(wxWindow* parent);
|
||||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||||
void on_select_filament(wxCommandEvent& evt);
|
void on_select_filament(wxCommandEvent& evt);
|
||||||
|
void on_select_cali_result(wxCommandEvent &evt);
|
||||||
void on_select_ok(wxCommandEvent &event);
|
void on_select_ok(wxCommandEvent &event);
|
||||||
void on_select_reset(wxCommandEvent &event);
|
void on_select_reset(wxCommandEvent &event);
|
||||||
void on_select_close(wxCommandEvent &event);
|
void on_select_close(wxCommandEvent &event);
|
||||||
|
@ -146,6 +147,7 @@ protected:
|
||||||
wxStaticText * warning_text;
|
wxStaticText * warning_text;
|
||||||
//wxPanel * m_panel_body;
|
//wxPanel * m_panel_body;
|
||||||
wxStaticText * m_title_filament;
|
wxStaticText * m_title_filament;
|
||||||
|
wxStaticText * m_title_pa_profile;
|
||||||
wxStaticText * m_title_colour;
|
wxStaticText * m_title_colour;
|
||||||
wxStaticText * m_title_temperature;
|
wxStaticText * m_title_temperature;
|
||||||
TextInput * m_input_nozzle_min;
|
TextInput * m_input_nozzle_min;
|
||||||
|
@ -167,11 +169,14 @@ protected:
|
||||||
TextInput* m_input_n_val;
|
TextInput* m_input_n_val;
|
||||||
int m_filament_selection;
|
int m_filament_selection;
|
||||||
|
|
||||||
|
int m_pa_cali_select_id = 0;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
wxComboBox *m_comboBox_filament;
|
wxComboBox *m_comboBox_filament;
|
||||||
#else
|
#else
|
||||||
ComboBox *m_comboBox_filament;
|
ComboBox *m_comboBox_filament;
|
||||||
#endif
|
#endif
|
||||||
|
ComboBox * m_comboBox_cali_result;
|
||||||
TextInput* m_readonly_filament;
|
TextInput* m_readonly_filament;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1746,8 +1746,7 @@ void PressureAdvanceWizard::request_calib_result() {
|
||||||
// todo emit once and loop to get
|
// todo emit once and loop to get
|
||||||
if (is_high_end_type(curr_obj)) {
|
if (is_high_end_type(curr_obj)) {
|
||||||
if (is_first_time_get_result) {
|
if (is_first_time_get_result) {
|
||||||
float nozzle_diameter = dynamic_cast<ConfigOptionFloats *>(m_printer_preset->config.option("nozzle_diameter"))->get_at(0);
|
CalibUtils::emit_get_PA_calib_results(curr_obj->nozzle_diameter);
|
||||||
CalibUtils::emit_get_PA_calib_results(nozzle_diameter);
|
|
||||||
is_first_time_get_result = false;
|
is_first_time_get_result = false;
|
||||||
}
|
}
|
||||||
CalibUtils::get_PA_calib_results(m_calib_results);
|
CalibUtils::get_PA_calib_results(m_calib_results);
|
||||||
|
@ -2099,15 +2098,10 @@ void PressureAdvanceWizard::check_sync_printer_status()
|
||||||
|
|
||||||
if (m_cali_version != obj_->cali_version) {
|
if (m_cali_version != obj_->cali_version) {
|
||||||
m_cali_version = obj_->cali_version;
|
m_cali_version = obj_->cali_version;
|
||||||
float nozzle_diameter = dynamic_cast<ConfigOptionFloats *>(m_printer_preset->config.option("nozzle_diameter"))->get_at(0);
|
CalibUtils::emit_get_PA_calib_info(obj_->nozzle_diameter, m_filament_preset->filament_id);
|
||||||
CalibUtils::emit_get_PA_calib_info(nozzle_diameter, m_filament_preset->filament_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CalibUtils::get_PA_calib_tab(m_calib_results_history)) {
|
if (CalibUtils::get_PA_calib_tab(m_calib_results_history)) {
|
||||||
has_get_history_result = true;
|
|
||||||
|
|
||||||
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
|
||||||
MachineObject *obj_ = dev->get_selected_machine();
|
|
||||||
obj_->has_get_pa_calib_tab = false;
|
obj_->has_get_pa_calib_tab = false;
|
||||||
|
|
||||||
//PACalibIndexInfo cali_info;
|
//PACalibIndexInfo cali_info;
|
||||||
|
@ -2133,6 +2127,17 @@ void PressureAdvanceWizard::check_sync_printer_status()
|
||||||
//cali_info.filament_id = result_0.filament_id;
|
//cali_info.filament_id = result_0.filament_id;
|
||||||
//CalibUtils::select_PA_calib_result(cali_info);
|
//CalibUtils::select_PA_calib_result(cali_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if (m_calib_results_history.size() > 10) {
|
||||||
|
// PACalibIndexInfo cali_info;
|
||||||
|
// PACalibResult result_0 = m_calib_results_history[0];
|
||||||
|
|
||||||
|
// cali_info.tray_id = 0;
|
||||||
|
// cali_info.cali_idx = result_0.cali_idx;
|
||||||
|
// cali_info.nozzle_diameter = result_0.nozzle_diameter;
|
||||||
|
// cali_info.filament_id = result_0.filament_id;
|
||||||
|
// CalibUtils::delete_PA_calib_result(cali_info);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
FlowRateWizard::FlowRateWizard(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
FlowRateWizard::FlowRateWizard(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
|
@ -2524,8 +2529,7 @@ void FlowRateWizard::request_calib_result() {
|
||||||
|
|
||||||
if (is_high_end_type(curr_obj)) {
|
if (is_high_end_type(curr_obj)) {
|
||||||
if (is_first_time_get_result) {
|
if (is_first_time_get_result) {
|
||||||
float nozzle_diameter = dynamic_cast<ConfigOptionFloats *>(m_printer_preset->config.option("nozzle_diameter"))->get_at(0);
|
CalibUtils::emit_get_flow_ratio_calib_results(curr_obj->nozzle_diameter);
|
||||||
CalibUtils::emit_get_flow_ratio_calib_results(nozzle_diameter);
|
|
||||||
is_first_time_get_result = false;
|
is_first_time_get_result = false;
|
||||||
}
|
}
|
||||||
CalibUtils::get_flow_ratio_calib_results(m_calib_results);
|
CalibUtils::get_flow_ratio_calib_results(m_calib_results);
|
||||||
|
|
|
@ -252,9 +252,6 @@ private:
|
||||||
wxPanel* m_grid_panel;
|
wxPanel* m_grid_panel;
|
||||||
|
|
||||||
bool is_first_time_get_result = true;
|
bool is_first_time_get_result = true;
|
||||||
|
|
||||||
bool is_history_result_dirty = true;
|
|
||||||
bool has_get_history_result = false;
|
|
||||||
|
|
||||||
int m_cali_version = -1;
|
int m_cali_version = -1;
|
||||||
};
|
};
|
||||||
|
|
|
@ -413,6 +413,11 @@ bool MachineObject::is_lan_mode_printer()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MachineObject::is_high_printer_type()
|
||||||
|
{
|
||||||
|
return this->printer_type == "BL-P001" || this->printer_type == "BL-P002";
|
||||||
|
}
|
||||||
|
|
||||||
MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string id, std::string ip)
|
MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string id, std::string ip)
|
||||||
:dev_name(name),
|
:dev_name(name),
|
||||||
dev_id(id),
|
dev_id(id),
|
||||||
|
@ -1941,7 +1946,7 @@ int MachineObject::command_start_pa_calibration(const X1CCalibInfos& pa_data)
|
||||||
json j;
|
json j;
|
||||||
j["print"]["command"] = "extrusion_cali";
|
j["print"]["command"] = "extrusion_cali";
|
||||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
j["print"]["nozzle_diameter"] = std::to_string(pa_data.calib_datas[0].nozzle_diameter);
|
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_data.calib_datas[0].nozzle_diameter);
|
||||||
|
|
||||||
for (int i = 0; i < pa_data.calib_datas.size(); ++i) {
|
for (int i = 0; i < pa_data.calib_datas.size(); ++i) {
|
||||||
j["print"]["filaments"][i]["tray_id"] = pa_data.calib_datas[i].tray_id;
|
j["print"]["filaments"][i]["tray_id"] = pa_data.calib_datas[i].tray_id;
|
||||||
|
@ -3229,6 +3234,7 @@ int MachineObject::parse_json(std::string payload)
|
||||||
if (jj.contains("cali_version")) {
|
if (jj.contains("cali_version")) {
|
||||||
cali_version = jj["cali_version"].get<int>();
|
cali_version = jj["cali_version"].get<int>();
|
||||||
}
|
}
|
||||||
|
std::string str = jj.dump();
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
;
|
;
|
||||||
|
@ -3371,10 +3377,10 @@ int MachineObject::parse_json(std::string payload)
|
||||||
}
|
}
|
||||||
if (!curr_tray) continue;
|
if (!curr_tray) continue;
|
||||||
|
|
||||||
if (curr_tray->hold_count > 0) {
|
//if (curr_tray->hold_count > 0) {
|
||||||
curr_tray->hold_count--;
|
// curr_tray->hold_count--;
|
||||||
continue;
|
// continue;
|
||||||
}
|
//}
|
||||||
|
|
||||||
curr_tray->id = (*tray_it)["id"].get<std::string>();
|
curr_tray->id = (*tray_it)["id"].get<std::string>();
|
||||||
if (tray_it->contains("tag_uid"))
|
if (tray_it->contains("tag_uid"))
|
||||||
|
@ -3490,6 +3496,8 @@ int MachineObject::parse_json(std::string payload)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string temp = tray_it->dump();
|
||||||
|
|
||||||
if (tray_it->contains("cali_idx")) {
|
if (tray_it->contains("cali_idx")) {
|
||||||
curr_tray->cali_idx = (*tray_it)["cali_idx"].get<int>();
|
curr_tray->cali_idx = (*tray_it)["cali_idx"].get<int>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -480,6 +480,7 @@ public:
|
||||||
void erase_user_access_code();
|
void erase_user_access_code();
|
||||||
std::string get_user_access_code();
|
std::string get_user_access_code();
|
||||||
bool is_lan_mode_printer();
|
bool is_lan_mode_printer();
|
||||||
|
bool is_high_printer_type();
|
||||||
|
|
||||||
//PRINTER_TYPE printer_type = PRINTER_3DPrinter_UKNOWN;
|
//PRINTER_TYPE printer_type = PRINTER_3DPrinter_UKNOWN;
|
||||||
std::string printer_type; /* model_id */
|
std::string printer_type; /* model_id */
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "libslic3r/Thread.hpp"
|
#include "libslic3r/Thread.hpp"
|
||||||
|
|
||||||
#include "RecenterDialog.hpp"
|
#include "RecenterDialog.hpp"
|
||||||
|
#include "CalibUtils.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
@ -2012,6 +2013,11 @@ void StatusPanel::update_ams(MachineObject *obj)
|
||||||
}
|
}
|
||||||
if (m_filament_setting_dlg) { m_filament_setting_dlg->obj = obj; }
|
if (m_filament_setting_dlg) { m_filament_setting_dlg->obj = obj; }
|
||||||
|
|
||||||
|
if (obj->is_high_printer_type() && last_cali_version != obj->cali_version) {
|
||||||
|
last_cali_version = obj->cali_version;
|
||||||
|
CalibUtils::emit_get_PA_calib_info(obj->nozzle_diameter, "GFA01"); // todo: get all
|
||||||
|
}
|
||||||
|
|
||||||
bool is_support_extrusion_cali = obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI);
|
bool is_support_extrusion_cali = obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI);
|
||||||
bool is_support_virtual_tray = obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY);
|
bool is_support_virtual_tray = obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY);
|
||||||
bool is_support_filament_backup = obj->is_function_supported(PrinterFunction::FUNC_FILAMENT_BACKUP);
|
bool is_support_filament_backup = obj->is_function_supported(PrinterFunction::FUNC_FILAMENT_BACKUP);
|
||||||
|
|
|
@ -431,6 +431,7 @@ public:
|
||||||
long last_read_done_bits{ -1 };
|
long last_read_done_bits{ -1 };
|
||||||
long last_reading_bits { -1 };
|
long last_reading_bits { -1 };
|
||||||
long last_ams_version { -1 };
|
long last_ams_version { -1 };
|
||||||
|
int last_cali_version{-1};
|
||||||
|
|
||||||
enum ThumbnailState task_thumbnail_state {ThumbnailState::PLACE_HOLDER};
|
enum ThumbnailState task_thumbnail_state {ThumbnailState::PLACE_HOLDER};
|
||||||
std::vector<int> last_stage_list_info;
|
std::vector<int> last_stage_list_info;
|
||||||
|
|
|
@ -638,6 +638,14 @@ void CalibUtils::calib_retraction(const CalibInfo &calib_info, std::string &erro
|
||||||
send_to_print(calib_info, error_message);
|
send_to_print(calib_info, error_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CalibUtils::get_selected_calib_idx(const std::vector<PACalibResult> &pa_calib_values, int cali_idx) {
|
||||||
|
for (int i = 0; i < pa_calib_values.size(); ++i) {
|
||||||
|
if(pa_calib_values[i].cali_idx == cali_idx)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& full_config, const Calib_Params& params, std::string& error_message)
|
void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& full_config, const Calib_Params& params, std::string& error_message)
|
||||||
{
|
{
|
||||||
Pointfs bedfs = full_config.opt<ConfigOptionPoints>("printable_area")->values;
|
Pointfs bedfs = full_config.opt<ConfigOptionPoints>("printable_area")->values;
|
||||||
|
|
|
@ -56,6 +56,9 @@ public:
|
||||||
static void calib_VFA(const CalibInfo& calib_info, std::string& error_message);
|
static void calib_VFA(const CalibInfo& calib_info, std::string& error_message);
|
||||||
static void calib_retraction(const CalibInfo &calib_info, std::string &error_message);
|
static void calib_retraction(const CalibInfo &calib_info, std::string &error_message);
|
||||||
|
|
||||||
|
//help function
|
||||||
|
static int get_selected_calib_idx(const std::vector<PACalibResult> &pa_calib_values, int cali_idx);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void process_and_store_3mf(Model* model, const DynamicPrintConfig& full_config, const Calib_Params& params, std::string& error_message);
|
static void process_and_store_3mf(Model* model, const DynamicPrintConfig& full_config, const Calib_Params& params, std::string& error_message);
|
||||||
static void send_to_print(const CalibInfo& calib_info, std::string &error_message);
|
static void send_to_print(const CalibInfo& calib_info, std::string &error_message);
|
||||||
|
|
Loading…
Reference in New Issue