mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-21 12:15:21 +00:00
Fix setting AMS calib profile
ENH: calib support multi_extruder 1. backend support multi_extrude data structure 2. Compatible with third-party calibration (cherry picked from commit bambulab/BambuStudio@21e6271e59) Co-authored-by: zhimin.zeng <zhimin.zeng@bambulab.com>
This commit is contained in:
@@ -317,6 +317,12 @@ enum ZHopType {
|
||||
zhtCount
|
||||
};
|
||||
|
||||
enum NozzleVolumeType {
|
||||
nvtNormal = 0,
|
||||
nvtBigTraffic,
|
||||
nvtMaxNozzleVolumeType = nvtBigTraffic
|
||||
};
|
||||
|
||||
enum RetractLiftEnforceType {
|
||||
rletAllSurfaces = 0,
|
||||
rletTopOnly,
|
||||
|
||||
@@ -32,6 +32,7 @@ enum class CalibState { Start = 0, Preset, Calibration, CoarseSave, FineCalibrat
|
||||
struct Calib_Params
|
||||
{
|
||||
Calib_Params() : mode(CalibMode::Calib_None){};
|
||||
int extruder_id = 0;
|
||||
double start, end, step;
|
||||
bool print_numbers;
|
||||
double freqStartX, freqEndX, freqStartY, freqEndY;
|
||||
@@ -52,8 +53,12 @@ class X1CCalibInfos
|
||||
public:
|
||||
struct X1CCalibInfo
|
||||
{
|
||||
int extruder_id = -1;
|
||||
int tray_id;
|
||||
int ams_id = 0;
|
||||
int slot_id = 0;
|
||||
int bed_temp;
|
||||
NozzleVolumeType nozzle_volume_type = NozzleVolumeType::nvtNormal;
|
||||
int nozzle_temp;
|
||||
float nozzle_diameter;
|
||||
std::string filament_id;
|
||||
@@ -102,7 +107,11 @@ public:
|
||||
CALI_RESULT_PROBLEM = 1,
|
||||
CALI_RESULT_FAILED = 2,
|
||||
};
|
||||
int tray_id;
|
||||
int extruder_id = -1;
|
||||
NozzleVolumeType nozzle_volume_type;
|
||||
int tray_id = 0;
|
||||
int ams_id = 0;
|
||||
int slot_id = 0;
|
||||
int cali_idx = -1;
|
||||
float nozzle_diameter;
|
||||
std::string filament_id;
|
||||
@@ -115,12 +124,31 @@ public:
|
||||
|
||||
struct PACalibIndexInfo
|
||||
{
|
||||
int tray_id;
|
||||
int extruder_id = -1;
|
||||
NozzleVolumeType nozzle_volume_type;
|
||||
int tray_id = 0;
|
||||
int ams_id = 0;
|
||||
int slot_id = 0;
|
||||
int cali_idx;
|
||||
float nozzle_diameter;
|
||||
std::string filament_id;
|
||||
};
|
||||
|
||||
struct PACalibExtruderInfo
|
||||
{
|
||||
int extruder_id;
|
||||
NozzleVolumeType nozzle_volume_type;
|
||||
float nozzle_diameter;
|
||||
std::string filament_id = "";
|
||||
};
|
||||
|
||||
struct PACalibTabInfo
|
||||
{
|
||||
float pa_calib_tab_nozzle_dia;
|
||||
int extruder_id;
|
||||
NozzleVolumeType nozzle_volume_type;
|
||||
};
|
||||
|
||||
class FlowRatioCalibResult
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
|
||||
|
||||
#define HISTORY_WINDOW_SIZE wxSize(FromDIP(700), FromDIP(600))
|
||||
#define EDIT_HISTORY_DIALOG_INPUT_SIZE wxSize(FromDIP(160), FromDIP(24))
|
||||
#define NEW_HISTORY_DIALOG_INPUT_SIZE wxSize(FromDIP(250), FromDIP(24))
|
||||
@@ -217,20 +217,22 @@ void HistoryWindow::update(MachineObject* obj)
|
||||
void HistoryWindow::on_select_nozzle(wxCommandEvent& evt)
|
||||
{
|
||||
reqeust_history_result(curr_obj);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void HistoryWindow::reqeust_history_result(MachineObject* obj)
|
||||
{
|
||||
if (curr_obj) {
|
||||
// reset
|
||||
// reset
|
||||
curr_obj->reset_pa_cali_history_result();
|
||||
m_calib_results_history.clear();
|
||||
sync_history_data();
|
||||
|
||||
float nozzle_value = get_nozzle_value();
|
||||
if (nozzle_value > 0) {
|
||||
CalibUtils::emit_get_PA_calib_infos(nozzle_value);
|
||||
PACalibExtruderInfo cali_info;
|
||||
cali_info.nozzle_diameter = nozzle_value;
|
||||
CalibUtils::emit_get_PA_calib_infos(cali_info);
|
||||
m_tips->SetLabel(_L("Refreshing the historical Flow Dynamics Calibration records"));
|
||||
BOOST_LOG_TRIVIAL(info) << "request calib history";
|
||||
}
|
||||
@@ -303,7 +305,12 @@ void HistoryWindow::sync_history_data() {
|
||||
gbSizer->SetEmptyCellSize({ 0,0 });
|
||||
m_history_data_panel->Layout();
|
||||
m_history_data_panel->Fit();
|
||||
CalibUtils::delete_PA_calib_result({ result.tray_id, result.cali_idx, result.nozzle_diameter, result.filament_id });
|
||||
PACalibIndexInfo cali_info;
|
||||
cali_info.tray_id = result.tray_id;
|
||||
cali_info.cali_idx = result.cali_idx;
|
||||
cali_info.nozzle_diameter = result.nozzle_diameter;
|
||||
cali_info.filament_id = result.filament_id;
|
||||
CalibUtils::delete_PA_calib_result(cali_info);
|
||||
});
|
||||
|
||||
auto edit_button = new Button(m_history_data_panel, _L("Edit"));
|
||||
@@ -468,7 +475,7 @@ void EditCalibrationHistoryDialog::on_save(wxCommandEvent& event) {
|
||||
return;
|
||||
|
||||
m_new_result.name = m_name_value->GetTextCtrl()->GetValue().ToUTF8().data();
|
||||
|
||||
|
||||
float k = 0.0f;
|
||||
if (!CalibUtils::validate_input_k_value(m_k_value->GetTextCtrl()->GetValue(), &k)) {
|
||||
MessageDialog msg_dlg(nullptr, wxString::Format(_L("Please input a valid value (K in %.1f~%.1f)"), MIN_PA_K_VALUE, MAX_PA_K_VALUE), wxEmptyString, wxICON_WARNING | wxOK);
|
||||
@@ -620,7 +627,7 @@ NewCalibrationHistoryDialog::NewCalibrationHistoryDialog(wxWindow *parent, const
|
||||
m_comboBox_nozzle_diameter->SetSelection(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Nozzle Diameter
|
||||
flex_sizer->Add(nozzle_diameter_title);
|
||||
flex_sizer->Add(m_comboBox_nozzle_diameter);
|
||||
@@ -628,7 +635,7 @@ NewCalibrationHistoryDialog::NewCalibrationHistoryDialog(wxWindow *parent, const
|
||||
Label *k_title = new Label(top_panel, _L("Factor K"));
|
||||
auto k_str = wxString::Format("%.3f", m_new_result.k_value);
|
||||
m_k_value = new TextInput(top_panel, k_str, "", "", wxDefaultPosition, NEW_HISTORY_DIALOG_INPUT_SIZE, wxTE_PROCESS_ENTER);
|
||||
|
||||
|
||||
// Factor K
|
||||
flex_sizer->Add(k_title);
|
||||
flex_sizer->Add(m_k_value);
|
||||
@@ -703,7 +710,7 @@ void NewCalibrationHistoryDialog::on_ok(wxCommandEvent &event)
|
||||
m_new_result.k_value = k;
|
||||
m_new_result.tray_id = -1;
|
||||
m_new_result.cali_idx = -1;
|
||||
|
||||
|
||||
m_new_result.nozzle_diameter = nozzle_value;
|
||||
m_new_result.filament_id = filament_id;
|
||||
m_new_result.setting_id = setting_id;
|
||||
|
||||
@@ -46,7 +46,7 @@ bool is_pa_params_valid(const Calib_Params& params)
|
||||
}
|
||||
|
||||
CalibrationWizard::CalibrationWizard(wxWindow* parent, CalibMode mode, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxPanel(parent, id, pos, size, style)
|
||||
: wxPanel(parent, id, pos, size, style)
|
||||
, m_mode(mode)
|
||||
{
|
||||
SetBackgroundColour(wxColour(0xEEEEEE));
|
||||
@@ -58,8 +58,8 @@ CalibrationWizard::CalibrationWizard(wxWindow* parent, CalibMode mode, wxWindowI
|
||||
m_scrolledWindow->SetBackgroundColour(*wxWHITE);
|
||||
|
||||
wxBoxSizer* padding_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
padding_sizer->Add(0, 0, 1);
|
||||
|
||||
padding_sizer->Add(0, 0, 1);
|
||||
|
||||
m_all_pages_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
padding_sizer->Add(m_all_pages_sizer, 0);
|
||||
|
||||
@@ -320,7 +320,7 @@ void CalibrationWizard::back_preset_info(MachineObject *obj, bool cali_finish, b
|
||||
wxGetApp().app_config->save_printer_cali_infos(printer_cali_info, back_cali_flag);
|
||||
}
|
||||
|
||||
void CalibrationWizard::msw_rescale()
|
||||
void CalibrationWizard::msw_rescale()
|
||||
{
|
||||
for (int i = 0; i < m_page_steps.size(); i++) {
|
||||
if (m_page_steps[i]->page)
|
||||
@@ -402,7 +402,7 @@ void PressureAdvanceWizard::create_pages()
|
||||
preset_step = new CalibrationWizardPageStep(new CalibrationPresetPage(m_scrolledWindow, m_mode, false));
|
||||
cali_step = new CalibrationWizardPageStep(new CalibrationCaliPage(m_scrolledWindow, m_mode));
|
||||
save_step = new CalibrationWizardPageStep(new CalibrationPASavePage(m_scrolledWindow));
|
||||
|
||||
|
||||
m_all_pages_sizer->Add(start_step->page, 1, wxEXPAND | wxALL, FromDIP(25));
|
||||
m_all_pages_sizer->Add(preset_step->page, 1, wxEXPAND | wxALL, FromDIP(25));
|
||||
m_all_pages_sizer->Add(cali_step->page, 1, wxEXPAND | wxALL, FromDIP(25));
|
||||
@@ -477,7 +477,9 @@ void PressureAdvanceWizard::update(MachineObject* obj)
|
||||
if (!m_show_result_dialog) {
|
||||
if (obj->cali_version != -1 && obj->cali_version != cali_version) {
|
||||
cali_version = obj->cali_version;
|
||||
CalibUtils::emit_get_PA_calib_info(obj->nozzle_diameter, "");
|
||||
PACalibExtruderInfo cali_info;
|
||||
cali_info.nozzle_diameter = obj->nozzle_diameter;
|
||||
CalibUtils::emit_get_PA_calib_info(cali_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -620,7 +622,7 @@ void PressureAdvanceWizard::on_cali_start()
|
||||
BOOST_LOG_TRIVIAL(error) << "CaliPreset: get preset info error";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CalibInfo calib_info;
|
||||
calib_info.dev_id = curr_obj->dev_id;
|
||||
calib_info.select_ams = "[" + std::to_string(selected_filaments.begin()->first) + "]";
|
||||
@@ -656,10 +658,10 @@ void PressureAdvanceWizard::on_cali_start()
|
||||
pa_cali_method = ManualPaCaliMethod::PA_LINE;
|
||||
else if (calib_info.params.mode == CalibMode::Calib_PA_Pattern)
|
||||
pa_cali_method = ManualPaCaliMethod::PA_PATTERN;
|
||||
|
||||
|
||||
cali_page->set_pa_cali_image(int(pa_cali_method));
|
||||
curr_obj->manual_pa_cali_method = pa_cali_method;
|
||||
|
||||
|
||||
if (curr_obj->get_printer_series() != PrinterSeries::SERIES_X1 && curr_obj->pa_calib_tab.size() >= MAX_PA_HISTORY_RESULTS_NUMS) {
|
||||
MessageDialog msg_dlg(nullptr, wxString::Format(_L("This machine type can only hold 16 history results per nozzle. "
|
||||
"You can delete the existing historical results and then start calibration. "
|
||||
@@ -740,7 +742,7 @@ void PressureAdvanceWizard::on_cali_save()
|
||||
auto iter = std::find_if(curr_obj->pa_calib_tab.begin(), curr_obj->pa_calib_tab.end(), [&new_pa_cali_result](const PACalibResult &item) {
|
||||
return item.name == new_pa_cali_result.name && item.filament_id == item.filament_id;
|
||||
});
|
||||
|
||||
|
||||
if (iter != curr_obj->pa_calib_tab.end()) {
|
||||
MessageDialog
|
||||
msg_dlg(nullptr,
|
||||
@@ -819,7 +821,7 @@ void FlowRateWizard::create_pages()
|
||||
coarse_save_step = new CalibrationWizardPageStep(new CalibrationFlowCoarseSavePage(m_scrolledWindow));
|
||||
cali_fine_step = new CalibrationWizardPageStep(new CalibrationCaliPage(m_scrolledWindow, m_mode, CaliPageType::CALI_PAGE_FINE_CALI));
|
||||
fine_save_step = new CalibrationWizardPageStep(new CalibrationFlowFineSavePage(m_scrolledWindow));
|
||||
|
||||
|
||||
// auto
|
||||
cali_step = new CalibrationWizardPageStep(new CalibrationCaliPage(m_scrolledWindow, m_mode));
|
||||
save_step = new CalibrationWizardPageStep(new CalibrationFlowX1SavePage(m_scrolledWindow));
|
||||
@@ -897,7 +899,7 @@ void FlowRateWizard::on_cali_action(wxCommandEvent& evt)
|
||||
else if (action == CaliPageActionType::CALI_ACTION_CALI) {
|
||||
if (m_cali_method == CalibrationMethod::CALI_METHOD_AUTO) {
|
||||
on_cali_start();
|
||||
}
|
||||
}
|
||||
else if (m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) {
|
||||
CaliPresetStage stage = CaliPresetStage::CALI_MANULA_STAGE_NONE;
|
||||
float cali_value = 0.0f;
|
||||
@@ -908,7 +910,7 @@ void FlowRateWizard::on_cali_action(wxCommandEvent& evt)
|
||||
m_curr_step->chain(cali_fine_step);
|
||||
}
|
||||
// automatically jump to next step when print job is sending finished.
|
||||
}
|
||||
}
|
||||
else {
|
||||
on_cali_start();
|
||||
}
|
||||
@@ -1307,7 +1309,7 @@ void FlowRateWizard::cache_coarse_info(MachineObject *obj)
|
||||
|
||||
wxString out_name;
|
||||
coarse_page->get_result(&obj->cache_flow_ratio, &out_name);
|
||||
|
||||
|
||||
back_preset_info(obj, false);
|
||||
}
|
||||
|
||||
@@ -1317,7 +1319,7 @@ MaxVolumetricSpeedWizard::MaxVolumetricSpeedWizard(wxWindow* parent, wxWindowID
|
||||
create_pages();
|
||||
}
|
||||
|
||||
void MaxVolumetricSpeedWizard::create_pages()
|
||||
void MaxVolumetricSpeedWizard::create_pages()
|
||||
{
|
||||
start_step = new CalibrationWizardPageStep(new CalibrationMaxVolumetricSpeedStartPage(m_scrolledWindow));
|
||||
preset_step = new CalibrationWizardPageStep(new MaxVolumetricSpeedPresetPage(m_scrolledWindow, m_mode, true));
|
||||
|
||||
@@ -2169,6 +2169,10 @@ int MachineObject::command_start_pa_calibration(const X1CCalibInfos &pa_data, in
|
||||
j["print"]["filaments"][i]["filament_id"] = pa_data.calib_datas[i].filament_id;
|
||||
j["print"]["filaments"][i]["setting_id"] = pa_data.calib_datas[i].setting_id;
|
||||
j["print"]["filaments"][i]["nozzle_temp"] = pa_data.calib_datas[i].nozzle_temp;
|
||||
j["print"]["filaments"][i]["ams_id"] = pa_data.calib_datas[i].ams_id;
|
||||
j["print"]["filaments"][i]["slot_id"] = pa_data.calib_datas[i].slot_id;
|
||||
j["print"]["filaments"][i]["nozzle_volume_type"] = int(pa_data.calib_datas[i].nozzle_volume_type);
|
||||
j["print"]["filaments"][i]["nozzle_diameter"] = pa_data.calib_datas[i].nozzle_diameter;
|
||||
j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(pa_data.calib_datas[i].max_volumetric_speed);
|
||||
|
||||
if (i > 0) filament_ids += ",";
|
||||
@@ -2206,6 +2210,10 @@ int MachineObject::command_set_pa_calibration(const std::vector<PACalibResult> &
|
||||
if (pa_calib_values[i].cali_idx >= 0)
|
||||
j["print"]["filaments"][i]["cali_idx"] = pa_calib_values[i].cali_idx;
|
||||
j["print"]["filaments"][i]["tray_id"] = pa_calib_values[i].tray_id;
|
||||
j["print"]["filaments"][i]["extruder_id"] = pa_calib_values[i].extruder_id;
|
||||
j["print"]["filaments"][i]["nozzle_volume_type"] = int(pa_calib_values[i].nozzle_volume_type);
|
||||
j["print"]["filaments"][i]["ams_id"] = pa_calib_values[i].ams_id;
|
||||
j["print"]["filaments"][i]["slot_id"] = pa_calib_values[i].slot_id;
|
||||
j["print"]["filaments"][i]["filament_id"] = pa_calib_values[i].filament_id;
|
||||
j["print"]["filaments"][i]["setting_id"] = pa_calib_values[i].setting_id;
|
||||
j["print"]["filaments"][i]["name"] = pa_calib_values[i].name;
|
||||
@@ -2228,6 +2236,8 @@ int MachineObject::command_delete_pa_calibration(const PACalibIndexInfo& pa_cali
|
||||
json j;
|
||||
j["print"]["command"] = "extrusion_cali_del";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["extruder_id"] = pa_calib.extruder_id;
|
||||
j["print"]["nozzle_volume_type"] = int(pa_calib.nozzle_volume_type);
|
||||
j["print"]["filament_id"] = pa_calib.filament_id;
|
||||
j["print"]["cali_idx"] = pa_calib.cali_idx;
|
||||
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib.nozzle_diameter);
|
||||
@@ -2236,15 +2246,17 @@ int MachineObject::command_delete_pa_calibration(const PACalibIndexInfo& pa_cali
|
||||
return this->publish_json(j.dump());
|
||||
}
|
||||
|
||||
int MachineObject::command_get_pa_calibration_tab(float nozzle_diameter, const std::string &filament_id)
|
||||
int MachineObject::command_get_pa_calibration_tab(const PACalibExtruderInfo &calib_info)
|
||||
{
|
||||
reset_pa_cali_history_result();
|
||||
|
||||
json j;
|
||||
j["print"]["command"] = "extrusion_cali_get";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["filament_id"] = filament_id;
|
||||
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(nozzle_diameter);
|
||||
j["print"]["filament_id"] = calib_info.filament_id;
|
||||
j["print"]["extruder_id"] = calib_info.extruder_id;
|
||||
j["print"]["nozzle_volume_type"] = int(calib_info.nozzle_volume_type);
|
||||
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(calib_info.nozzle_diameter);
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "extrusion_cali_get: " << j.dump();
|
||||
return this->publish_json(j.dump());
|
||||
@@ -2267,6 +2279,8 @@ int MachineObject::commnad_select_pa_calibration(const PACalibIndexInfo& pa_cali
|
||||
j["print"]["command"] = "extrusion_cali_sel";
|
||||
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||
j["print"]["tray_id"] = pa_calib_info.tray_id;
|
||||
j["print"]["ams_id"] = pa_calib_info.ams_id;
|
||||
j["print"]["slot_id"] = pa_calib_info.slot_id;
|
||||
j["print"]["cali_idx"] = pa_calib_info.cali_idx;
|
||||
j["print"]["filament_id"] = pa_calib_info.filament_id;
|
||||
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib_info.nozzle_diameter);
|
||||
@@ -3943,7 +3957,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
if (!it->contains("id")) continue;
|
||||
std::string ams_id = (*it)["id"].get<std::string>();
|
||||
|
||||
int nozzle_id = 0; // Default nozzle id
|
||||
int nozzle_id = 0; // Default nozzle id
|
||||
int type_id = 1; // 0:dummy 1:ams 2:ams-lite 3:n3f 4:n3s
|
||||
|
||||
if (it->contains("nozzle")) {
|
||||
@@ -3953,7 +3967,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
if (it->contains("type")) {
|
||||
type_id = (*it)["type"].get<int>();
|
||||
}
|
||||
|
||||
|
||||
ams_id_set.erase(ams_id);
|
||||
Ams* curr_ams = nullptr;
|
||||
auto ams_it = amsList.find(ams_id);
|
||||
@@ -4640,10 +4654,10 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
|
||||
if (jj.contains("nozzle_diameter")) {
|
||||
if (jj["nozzle_diameter"].is_number_float()) {
|
||||
pa_calib_tab_nozzle_dia = jj["nozzle_diameter"].get<float>();
|
||||
pa_calib_tab_info.pa_calib_tab_nozzle_dia = jj["nozzle_diameter"].get<float>();
|
||||
}
|
||||
else if (jj["nozzle_diameter"].is_string()) {
|
||||
pa_calib_tab_nozzle_dia = string_to_float(jj["nozzle_diameter"].get<std::string>());
|
||||
pa_calib_tab_info.pa_calib_tab_nozzle_dia = string_to_float(jj["nozzle_diameter"].get<std::string>());
|
||||
}
|
||||
else {
|
||||
assert(false);
|
||||
@@ -4653,6 +4667,14 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
assert(false);
|
||||
}
|
||||
|
||||
if (jj.contains("extruder_id")) {
|
||||
pa_calib_tab_info.extruder_id = jj["extruder_id"].get<int>();
|
||||
}
|
||||
|
||||
if (jj.contains("nozzle_volume_type")) {
|
||||
pa_calib_tab_info.nozzle_volume_type = NozzleVolumeType(jj["nozzle_volume_type"].get<int>());
|
||||
}
|
||||
|
||||
if (jj.contains("filaments") && jj["filaments"].is_array()) {
|
||||
try {
|
||||
#ifdef CALI_DEBUG
|
||||
@@ -4727,6 +4749,30 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
pa_calib_result.nozzle_diameter = string_to_float(jj["nozzle_diameter"].get<std::string>());
|
||||
}
|
||||
|
||||
if (it->contains("ams_id")) {
|
||||
pa_calib_result.ams_id = (*it)["ams_id"].get<int>();
|
||||
} else {
|
||||
pa_calib_result.ams_id = 0;
|
||||
}
|
||||
|
||||
if (it->contains("slot_id")) {
|
||||
pa_calib_result.slot_id = (*it)["slot_id"].get<int>();
|
||||
} else {
|
||||
pa_calib_result.slot_id = 0;
|
||||
}
|
||||
|
||||
if (it->contains("extruder_id")) {
|
||||
pa_calib_result.extruder_id = (*it)["extruder_id"].get<int>();
|
||||
} else {
|
||||
pa_calib_result.extruder_id = -1;
|
||||
}
|
||||
|
||||
if (it->contains("nozzle_volume_type")) {
|
||||
pa_calib_result.nozzle_volume_type = NozzleVolumeType((*it)["nozzle_volume_type"].get<int>());
|
||||
} else {
|
||||
pa_calib_result.nozzle_volume_type = NozzleVolumeType::nvtNormal;
|
||||
}
|
||||
|
||||
if ((*it)["k_value"].is_number_float())
|
||||
pa_calib_result.k_value = (*it)["k_value"].get<float>();
|
||||
else if ((*it)["k_value"].is_string())
|
||||
@@ -4799,7 +4845,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
|
||||
|
||||
if (jj.contains("device")) {
|
||||
json const & device = jj["device"];
|
||||
|
||||
|
||||
if (device.contains("nozzle")) {
|
||||
json const & nozzle = device["nozzle"];
|
||||
|
||||
|
||||
@@ -406,8 +406,8 @@ public:
|
||||
};
|
||||
|
||||
enum ActiveState {
|
||||
NotActive,
|
||||
Active,
|
||||
NotActive,
|
||||
Active,
|
||||
UpdateToDate
|
||||
};
|
||||
|
||||
@@ -473,7 +473,7 @@ public:
|
||||
std::string product_name; // set by iot service, get /user/print
|
||||
|
||||
std::vector<int> filam_bak;
|
||||
|
||||
|
||||
|
||||
std::string bind_user_name;
|
||||
std::string bind_user_id;
|
||||
@@ -658,14 +658,16 @@ public:
|
||||
ManualPaCaliMethod manual_pa_cali_method = ManualPaCaliMethod::PA_LINE;
|
||||
bool has_get_pa_calib_tab{ false };
|
||||
std::vector<PACalibResult> pa_calib_tab;
|
||||
float pa_calib_tab_nozzle_dia;
|
||||
PACalibTabInfo pa_calib_tab_info;
|
||||
bool get_pa_calib_result { false };
|
||||
std::vector<PACalibResult> pa_calib_results;
|
||||
bool get_flow_calib_result { false };
|
||||
std::vector<FlowRatioCalibResult> flow_ratio_results;
|
||||
void reset_pa_cali_history_result()
|
||||
{
|
||||
pa_calib_tab_nozzle_dia = 0.4f;
|
||||
pa_calib_tab_info.pa_calib_tab_nozzle_dia = 0.4f;
|
||||
pa_calib_tab_info.extruder_id = -1;
|
||||
pa_calib_tab_info.nozzle_volume_type = NozzleVolumeType::nvtNormal;
|
||||
has_get_pa_calib_tab = false;
|
||||
pa_calib_tab.clear();
|
||||
}
|
||||
@@ -727,7 +729,7 @@ public:
|
||||
enum LiveviewLocal {
|
||||
LVL_None,
|
||||
LVL_Disable,
|
||||
LVL_Local,
|
||||
LVL_Local,
|
||||
LVL_Rtsps,
|
||||
LVL_Rtsp
|
||||
} liveview_local{ LVL_None };
|
||||
@@ -839,7 +841,7 @@ public:
|
||||
RatingInfo* rating_info { nullptr };
|
||||
int request_model_result = 0;
|
||||
bool get_model_mall_result_need_retry = false;
|
||||
|
||||
|
||||
std::string obj_subtask_id; // subtask_id == 0 for sdcard
|
||||
std::string subtask_name;
|
||||
bool is_sdcard_printing();
|
||||
@@ -928,7 +930,7 @@ public:
|
||||
int command_start_pa_calibration(const X1CCalibInfos& pa_data, int mode = 0); // 0: automatic mode; 1: manual mode. default: automatic mode
|
||||
int command_set_pa_calibration(const std::vector<PACalibResult>& pa_calib_values, bool is_auto_cali);
|
||||
int command_delete_pa_calibration(const PACalibIndexInfo& pa_calib);
|
||||
int command_get_pa_calibration_tab(float nozzle_diameter, const std::string &filament_id = "");
|
||||
int command_get_pa_calibration_tab(const PACalibExtruderInfo& calib_info);
|
||||
int command_get_pa_calibration_result(float nozzle_diameter);
|
||||
int commnad_select_pa_calibration(const PACalibIndexInfo& pa_calib_info);
|
||||
|
||||
|
||||
@@ -2583,7 +2583,9 @@ void StatusPanel::update_ams(MachineObject *obj)
|
||||
|
||||
if (obj->cali_version != -1 && last_cali_version != obj->cali_version) {
|
||||
last_cali_version = obj->cali_version;
|
||||
CalibUtils::emit_get_PA_calib_info(obj->nozzle_diameter, "");
|
||||
PACalibExtruderInfo cali_info;
|
||||
cali_info.nozzle_diameter = obj->nozzle_diameter;
|
||||
CalibUtils::emit_get_PA_calib_info(cali_info);
|
||||
}
|
||||
|
||||
bool is_support_virtual_tray = obj->ams_support_virtual_tray;
|
||||
@@ -3788,7 +3790,7 @@ void StatusPanel::on_ext_spool_edit(wxCommandEvent &event)
|
||||
m_filament_setting_dlg->set_colors(cols);
|
||||
|
||||
}
|
||||
|
||||
|
||||
m_filament_setting_dlg->m_is_third = !MachineObject::is_bbl_filament(obj->vt_tray.tag_uid);
|
||||
if (!m_filament_setting_dlg->m_is_third) {
|
||||
sn_number = obj->vt_tray.uuid;
|
||||
|
||||
@@ -373,7 +373,7 @@ bool CalibUtils::get_PA_calib_results(std::vector<PACalibResult>& pa_calib_resul
|
||||
return pa_calib_results.size() > 0;
|
||||
}
|
||||
|
||||
void CalibUtils::emit_get_PA_calib_infos(float nozzle_diameter)
|
||||
void CalibUtils::emit_get_PA_calib_infos(const PACalibExtruderInfo &cali_info)
|
||||
{
|
||||
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev)
|
||||
@@ -383,7 +383,7 @@ void CalibUtils::emit_get_PA_calib_infos(float nozzle_diameter)
|
||||
if (obj_ == nullptr)
|
||||
return;
|
||||
|
||||
obj_->command_get_pa_calibration_tab(nozzle_diameter);
|
||||
obj_->command_get_pa_calibration_tab(cali_info);
|
||||
}
|
||||
|
||||
bool CalibUtils::get_PA_calib_tab(std::vector<PACalibResult> &pa_calib_infos)
|
||||
@@ -402,7 +402,7 @@ bool CalibUtils::get_PA_calib_tab(std::vector<PACalibResult> &pa_calib_infos)
|
||||
return obj_->has_get_pa_calib_tab;
|
||||
}
|
||||
|
||||
void CalibUtils::emit_get_PA_calib_info(float nozzle_diameter, const std::string &filament_id)
|
||||
void CalibUtils::emit_get_PA_calib_info(const PACalibExtruderInfo &cali_info)
|
||||
{
|
||||
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) return;
|
||||
@@ -410,7 +410,7 @@ void CalibUtils::emit_get_PA_calib_info(float nozzle_diameter, const std::string
|
||||
MachineObject *obj_ = dev->get_selected_machine();
|
||||
if (obj_ == nullptr) return;
|
||||
|
||||
obj_->command_get_pa_calibration_tab(nozzle_diameter, filament_id);
|
||||
obj_->command_get_pa_calibration_tab(cali_info);
|
||||
}
|
||||
|
||||
bool CalibUtils::get_PA_calib_info(PACalibResult & pa_calib_info) {
|
||||
|
||||
@@ -16,6 +16,9 @@ extern const float MAX_PA_K_VALUE;
|
||||
class CalibInfo
|
||||
{
|
||||
public:
|
||||
int extruder_id = 0;
|
||||
int ams_id = 0;
|
||||
int slot_id = 0;
|
||||
Calib_Params params;
|
||||
Preset* printer_prest;
|
||||
Preset* filament_prest;
|
||||
@@ -35,14 +38,14 @@ public:
|
||||
static CalibMode get_calib_mode_by_name(const std::string name, int &cali_stage);
|
||||
|
||||
static void calib_PA(const X1CCalibInfos& calib_infos, int mode, wxString& error_message);
|
||||
|
||||
|
||||
static void emit_get_PA_calib_results(float nozzle_diameter);
|
||||
static bool get_PA_calib_results(std::vector<PACalibResult> &pa_calib_results);
|
||||
|
||||
static void emit_get_PA_calib_infos(float nozzle_diameter);
|
||||
|
||||
static void emit_get_PA_calib_infos(const PACalibExtruderInfo &cali_info);
|
||||
static bool get_PA_calib_tab(std::vector<PACalibResult> &pa_calib_infos);
|
||||
|
||||
static void emit_get_PA_calib_info(float nozzle_diameter, const std::string &filament_id);
|
||||
static void emit_get_PA_calib_info(const PACalibExtruderInfo& cali_info);
|
||||
static bool get_PA_calib_info(PACalibResult &pa_calib_info);
|
||||
|
||||
static void set_PA_calib_result(const std::vector<PACalibResult>& pa_calib_values, bool is_auto_cali);
|
||||
|
||||
Reference in New Issue
Block a user