ENH: Add buried points for calibration
jira: 6304 Change-Id: If5518919658afeaeef6cf97d18495e98fd52ed43
This commit is contained in:
parent
f4028927f2
commit
356e4d825e
|
@ -577,6 +577,8 @@ NewCalibrationHistoryDialog::NewCalibrationHistoryDialog(wxWindow *parent, const
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
curr_obj = obj;
|
||||||
|
|
||||||
this->SetBackgroundColour(*wxWHITE);
|
this->SetBackgroundColour(*wxWHITE);
|
||||||
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
|
@ -737,6 +739,17 @@ void NewCalibrationHistoryDialog::on_ok(wxCommandEvent &event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
json js;
|
||||||
|
js["cali_type"] = "cali_new_pa";
|
||||||
|
js["nozzle_diameter"] = m_new_result.nozzle_diameter;
|
||||||
|
js["filament_id"] = m_new_result.filament_id;
|
||||||
|
js["printer_type"] = curr_obj->printer_type;
|
||||||
|
|
||||||
|
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||||
|
if (agent) agent->track_event("cali", js.dump());
|
||||||
|
} catch (...) {}
|
||||||
|
|
||||||
CalibUtils::set_PA_calib_result({m_new_result}, true);
|
CalibUtils::set_PA_calib_result({m_new_result}, true);
|
||||||
|
|
||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
|
|
|
@ -74,6 +74,7 @@ protected:
|
||||||
protected:
|
protected:
|
||||||
PACalibResult m_new_result;
|
PACalibResult m_new_result;
|
||||||
std::vector<PACalibResult> m_history_results;
|
std::vector<PACalibResult> m_history_results;
|
||||||
|
MachineObject * curr_obj;
|
||||||
|
|
||||||
TextInput *m_name_value{nullptr};
|
TextInput *m_name_value{nullptr};
|
||||||
TextInput *m_k_value{nullptr};
|
TextInput *m_k_value{nullptr};
|
||||||
|
|
|
@ -2124,6 +2124,7 @@ int MachineObject::command_start_pa_calibration(const X1CCalibInfos &pa_data, in
|
||||||
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_data.calib_datas[0].nozzle_diameter);
|
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_data.calib_datas[0].nozzle_diameter);
|
||||||
j["print"]["mode"] = mode;
|
j["print"]["mode"] = mode;
|
||||||
|
|
||||||
|
std::string filament_ids;
|
||||||
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;
|
||||||
j["print"]["filaments"][i]["bed_temp"] = pa_data.calib_datas[i].bed_temp;
|
j["print"]["filaments"][i]["bed_temp"] = pa_data.calib_datas[i].bed_temp;
|
||||||
|
@ -2131,9 +2132,25 @@ int MachineObject::command_start_pa_calibration(const X1CCalibInfos &pa_data, in
|
||||||
j["print"]["filaments"][i]["setting_id"] = pa_data.calib_datas[i].setting_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]["nozzle_temp"] = pa_data.calib_datas[i].nozzle_temp;
|
||||||
j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(pa_data.calib_datas[i].max_volumetric_speed);
|
j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(pa_data.calib_datas[i].max_volumetric_speed);
|
||||||
|
|
||||||
|
if (i > 0)
|
||||||
|
filament_ids += ",";
|
||||||
|
filament_ids += pa_data.calib_datas[i].filament_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(trace) << "extrusion_cali: " << j.dump();
|
BOOST_LOG_TRIVIAL(trace) << "extrusion_cali: " << j.dump();
|
||||||
|
|
||||||
|
try {
|
||||||
|
json js;
|
||||||
|
js["cali_type"] = "cali_pa_auto";
|
||||||
|
js["nozzle_diameter"] = pa_data.calib_datas[0].nozzle_diameter;
|
||||||
|
js["filament_id"] = filament_ids;
|
||||||
|
js["printer_type"] = this->printer_type;
|
||||||
|
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||||
|
if (agent)
|
||||||
|
agent->track_event("cali", js.dump());
|
||||||
|
} catch (...) {}
|
||||||
|
|
||||||
return this->publish_json(j.dump());
|
return this->publish_json(j.dump());
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -2247,6 +2264,7 @@ int MachineObject::command_start_flow_ratio_calibration(const X1CCalibInfos& cal
|
||||||
j["print"]["tray_id"] = calib_data.calib_datas[0].tray_id;
|
j["print"]["tray_id"] = calib_data.calib_datas[0].tray_id;
|
||||||
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(calib_data.calib_datas[0].nozzle_diameter);
|
j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(calib_data.calib_datas[0].nozzle_diameter);
|
||||||
|
|
||||||
|
std::string filament_ids;
|
||||||
for (int i = 0; i < calib_data.calib_datas.size(); ++i) {
|
for (int i = 0; i < calib_data.calib_datas.size(); ++i) {
|
||||||
j["print"]["filaments"][i]["tray_id"] = calib_data.calib_datas[i].tray_id;
|
j["print"]["filaments"][i]["tray_id"] = calib_data.calib_datas[i].tray_id;
|
||||||
j["print"]["filaments"][i]["bed_temp"] = calib_data.calib_datas[i].bed_temp;
|
j["print"]["filaments"][i]["bed_temp"] = calib_data.calib_datas[i].bed_temp;
|
||||||
|
@ -2255,8 +2273,22 @@ int MachineObject::command_start_flow_ratio_calibration(const X1CCalibInfos& cal
|
||||||
j["print"]["filaments"][i]["nozzle_temp"] = calib_data.calib_datas[i].nozzle_temp;
|
j["print"]["filaments"][i]["nozzle_temp"] = calib_data.calib_datas[i].nozzle_temp;
|
||||||
j["print"]["filaments"][i]["def_flow_ratio"] = std::to_string(calib_data.calib_datas[i].flow_rate);
|
j["print"]["filaments"][i]["def_flow_ratio"] = std::to_string(calib_data.calib_datas[i].flow_rate);
|
||||||
j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(calib_data.calib_datas[i].max_volumetric_speed);
|
j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(calib_data.calib_datas[i].max_volumetric_speed);
|
||||||
|
|
||||||
|
if (i > 0)
|
||||||
|
filament_ids += ",";
|
||||||
|
filament_ids += calib_data.calib_datas[i].filament_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
json js;
|
||||||
|
js["cali_type"] = "cali_flow_rate_auto";
|
||||||
|
js["nozzle_diameter"] = calib_data.calib_datas[0].nozzle_diameter;
|
||||||
|
js["filament_id"] = filament_ids;
|
||||||
|
js["printer_type"] = this->printer_type;
|
||||||
|
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||||
|
if (agent) agent->track_event("cali", js.dump());
|
||||||
|
} catch (...) {}
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(trace) << "flowrate_cali: " << j.dump();
|
BOOST_LOG_TRIVIAL(trace) << "flowrate_cali: " << j.dump();
|
||||||
return this->publish_json(j.dump());
|
return this->publish_json(j.dump());
|
||||||
}
|
}
|
||||||
|
|
|
@ -2867,7 +2867,15 @@ void MainFrame::init_menubar_as_editor()
|
||||||
|
|
||||||
// help
|
// help
|
||||||
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Tutorial"), _L("Calibration help"),
|
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Tutorial"), _L("Calibration help"),
|
||||||
[this](wxCommandEvent&) { wxLaunchDefaultBrowser("https://wiki.bambulab.com/e/en/staging/bambu-studio/Calibration", wxBROWSER_NEW_WINDOW); }, "", nullptr,
|
[this](wxCommandEvent&) {
|
||||||
|
try {
|
||||||
|
json js;
|
||||||
|
js["cali_type"] = "third_cali_tutorial";
|
||||||
|
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||||
|
if (agent) agent->track_event("third_cali", js.dump());
|
||||||
|
} catch (...) {}
|
||||||
|
wxLaunchDefaultBrowser("https://wiki.bambulab.com/en/bambu-studio/Calibration", wxBROWSER_NEW_WINDOW);
|
||||||
|
}, "", nullptr,
|
||||||
[this]() {return m_plater->is_view3D_shown();; }, this);
|
[this]() {return m_plater->is_view3D_shown();; }, this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2989,7 +2997,15 @@ void MainFrame::init_menubar_as_editor()
|
||||||
// help
|
// help
|
||||||
append_menu_item(
|
append_menu_item(
|
||||||
m_calib_menu, wxID_ANY, _L("Tutorial"), _L("Calibration help"),
|
m_calib_menu, wxID_ANY, _L("Tutorial"), _L("Calibration help"),
|
||||||
[this](wxCommandEvent &) { wxLaunchDefaultBrowser("https://wiki.bambulab.com/en/bambu-studio/Calibration", wxBROWSER_NEW_WINDOW); }, "", nullptr,
|
[this](wxCommandEvent &) {
|
||||||
|
try {
|
||||||
|
json js;
|
||||||
|
js["cali_type"] = "third_cali_tutorial";
|
||||||
|
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||||
|
if (agent) agent->track_event("third_cali", js.dump());
|
||||||
|
} catch (...) {}
|
||||||
|
wxLaunchDefaultBrowser("https://wiki.bambulab.com/en/bambu-studio/Calibration", wxBROWSER_NEW_WINDOW);
|
||||||
|
}, "", nullptr,
|
||||||
[this]() {
|
[this]() {
|
||||||
return m_plater->is_view3D_shown();
|
return m_plater->is_view3D_shown();
|
||||||
;
|
;
|
||||||
|
|
|
@ -9053,6 +9053,23 @@ void Plater::calib_pa(const Calib_Params ¶ms)
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
json js;
|
||||||
|
if (params.mode == CalibMode::Calib_PA_Line)
|
||||||
|
js["cali_type"] = "third_cali_pa_line";
|
||||||
|
else if (params.mode == CalibMode::Calib_PA_Pattern)
|
||||||
|
js["cali_type"] = "third_cali_pa_pattern";
|
||||||
|
else if (params.mode == CalibMode::Calib_PA_Tower)
|
||||||
|
js["cali_type"] = "third_cali_pa_tower";
|
||||||
|
|
||||||
|
std::string filament_id = wxGetApp().preset_bundle->filaments.get_edited_preset().filament_id;
|
||||||
|
js["filament_id"] = filament_id;
|
||||||
|
|
||||||
|
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||||
|
if (agent)
|
||||||
|
agent->track_event("third_cali", js.dump());
|
||||||
|
} catch (...) {}
|
||||||
|
|
||||||
p->background_process.fff_print()->set_calib_params(params);
|
p->background_process.fff_print()->set_calib_params(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9259,6 +9276,20 @@ void Plater::calib_flowrate(int pass)
|
||||||
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->reload_config();
|
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->reload_config();
|
||||||
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
|
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
|
||||||
|
|
||||||
|
try {
|
||||||
|
json js;
|
||||||
|
if (pass == 1)
|
||||||
|
js["cali_type"] = "third_cali_flow_rate_1";
|
||||||
|
if (pass == 2)
|
||||||
|
js["cali_type"] = "third_cali_flow_rate_2";
|
||||||
|
|
||||||
|
std::string filament_id = wxGetApp().preset_bundle->filaments.get_edited_preset().filament_id;
|
||||||
|
js["filament_id"] = filament_id;
|
||||||
|
|
||||||
|
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||||
|
if (agent) agent->track_event("third_cali", js.dump());
|
||||||
|
} catch (...) {}
|
||||||
|
|
||||||
Calib_Params params;
|
Calib_Params params;
|
||||||
params.mode = CalibMode::Calib_Flow_Rate;
|
params.mode = CalibMode::Calib_Flow_Rate;
|
||||||
p->background_process.fff_print()->set_calib_params(params);
|
p->background_process.fff_print()->set_calib_params(params);
|
||||||
|
@ -9266,6 +9297,16 @@ void Plater::calib_flowrate(int pass)
|
||||||
|
|
||||||
void Plater::calib_temp(const Calib_Params ¶ms)
|
void Plater::calib_temp(const Calib_Params ¶ms)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
|
json js;
|
||||||
|
js["cali_type"] = "third_cali_temp";
|
||||||
|
std::string filament_id = wxGetApp().preset_bundle->filaments.get_edited_preset().filament_id;
|
||||||
|
js["filament_id"] = filament_id;
|
||||||
|
|
||||||
|
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||||
|
if (agent) agent->track_event("third_cali", js.dump());
|
||||||
|
} catch (...) {}
|
||||||
|
|
||||||
const auto calib_temp_name = wxString::Format(L"Nozzle temperature test");
|
const auto calib_temp_name = wxString::Format(L"Nozzle temperature test");
|
||||||
if (new_project(false, false, calib_temp_name) == wxID_CANCEL)
|
if (new_project(false, false, calib_temp_name) == wxID_CANCEL)
|
||||||
return;
|
return;
|
||||||
|
@ -9316,6 +9357,16 @@ void Plater::calib_temp(const Calib_Params ¶ms)
|
||||||
|
|
||||||
void Plater::calib_max_vol_speed(const Calib_Params ¶ms)
|
void Plater::calib_max_vol_speed(const Calib_Params ¶ms)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
|
json js;
|
||||||
|
js["cali_type"] = "third_cali_max_flowrate";
|
||||||
|
std::string filament_id = wxGetApp().preset_bundle->filaments.get_edited_preset().filament_id;
|
||||||
|
js["filament_id"] = filament_id;
|
||||||
|
|
||||||
|
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||||
|
if (agent) agent->track_event("third_cali", js.dump());
|
||||||
|
} catch (...) {}
|
||||||
|
|
||||||
const auto calib_vol_speed_name = wxString::Format(L"Max volumetric speed test");
|
const auto calib_vol_speed_name = wxString::Format(L"Max volumetric speed test");
|
||||||
if (new_project(false, false, calib_vol_speed_name) == wxID_CANCEL)
|
if (new_project(false, false, calib_vol_speed_name) == wxID_CANCEL)
|
||||||
return;
|
return;
|
||||||
|
@ -9387,6 +9438,16 @@ void Plater::calib_max_vol_speed(const Calib_Params ¶ms)
|
||||||
|
|
||||||
void Plater::calib_retraction(const Calib_Params ¶ms)
|
void Plater::calib_retraction(const Calib_Params ¶ms)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
|
json js;
|
||||||
|
js["cali_type"] = "third_cali_retraction";
|
||||||
|
std::string filament_id = wxGetApp().preset_bundle->filaments.get_edited_preset().filament_id;
|
||||||
|
js["filament_id"] = filament_id;
|
||||||
|
|
||||||
|
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||||
|
if (agent) agent->track_event("third_cali", js.dump());
|
||||||
|
} catch (...) {}
|
||||||
|
|
||||||
const auto calib_retraction_name = wxString::Format(L"Retraction test");
|
const auto calib_retraction_name = wxString::Format(L"Retraction test");
|
||||||
if (new_project(false, false, calib_retraction_name) == wxID_CANCEL)
|
if (new_project(false, false, calib_retraction_name) == wxID_CANCEL)
|
||||||
return;
|
return;
|
||||||
|
@ -9427,6 +9488,16 @@ void Plater::calib_retraction(const Calib_Params ¶ms)
|
||||||
|
|
||||||
void Plater::calib_VFA(const Calib_Params ¶ms)
|
void Plater::calib_VFA(const Calib_Params ¶ms)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
|
json js;
|
||||||
|
js["cali_type"] = "third_cali_VFA";
|
||||||
|
std::string filament_id = wxGetApp().preset_bundle->filaments.get_edited_preset().filament_id;
|
||||||
|
js["filament_id"] = filament_id;
|
||||||
|
|
||||||
|
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||||
|
if (agent) agent->track_event("third_cali", js.dump());
|
||||||
|
} catch (...) {}
|
||||||
|
|
||||||
const auto calib_vfa_name = wxString::Format(L"VFA test");
|
const auto calib_vfa_name = wxString::Format(L"VFA test");
|
||||||
if (new_project(false, false, calib_vfa_name) == wxID_CANCEL)
|
if (new_project(false, false, calib_vfa_name) == wxID_CANCEL)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -566,6 +566,32 @@ bool CalibUtils::calib_flowrate(int pass, const CalibInfo &calib_info, wxString
|
||||||
if (!process_and_store_3mf(&model, full_config, params, error_message))
|
if (!process_and_store_3mf(&model, full_config, params, error_message))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev) {
|
||||||
|
error_message = _L("Need select printer");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MachineObject *obj_ = dev->get_selected_machine();
|
||||||
|
if (obj_ == nullptr) {
|
||||||
|
error_message = _L("Need select printer");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
json js;
|
||||||
|
if (pass == 1)
|
||||||
|
js["cali_type"] = "cali_flow_rate_1";
|
||||||
|
else if (pass == 2)
|
||||||
|
js["cali_type"] = "cali_flow_rate_2";
|
||||||
|
js["nozzle_diameter"] = nozzle_diameter;
|
||||||
|
js["filament_id"] = calib_info.filament_prest->filament_id;
|
||||||
|
js["printer_type"] = obj_->printer_type;
|
||||||
|
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||||
|
if (agent)
|
||||||
|
agent->track_event("cali", js.dump());
|
||||||
|
} catch (...) {}
|
||||||
|
|
||||||
send_to_print(calib_info, error_message, pass);
|
send_to_print(calib_info, error_message, pass);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -657,6 +683,37 @@ bool CalibUtils::calib_generic_PA(const CalibInfo &calib_info, wxString &error_m
|
||||||
if (!process_and_store_3mf(&model, full_config, params, error_message))
|
if (!process_and_store_3mf(&model, full_config, params, error_message))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev) {
|
||||||
|
error_message = _L("Need select printer");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MachineObject *obj_ = dev->get_selected_machine();
|
||||||
|
if (obj_ == nullptr) {
|
||||||
|
error_message = _L("Need select printer");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
json js;
|
||||||
|
if (params.mode == CalibMode::Calib_PA_Line)
|
||||||
|
js["cali_type"] = "cali_pa_line";
|
||||||
|
else if (params.mode == CalibMode::Calib_PA_Pattern)
|
||||||
|
js["cali_type"] = "cali_pa_pattern";
|
||||||
|
|
||||||
|
const ConfigOptionFloats *nozzle_diameter_config = printer_config.option<ConfigOptionFloats>("nozzle_diameter");
|
||||||
|
assert(nozzle_diameter_config->values.size() > 0);
|
||||||
|
float nozzle_diameter = nozzle_diameter_config->values[0];
|
||||||
|
|
||||||
|
js["nozzle_diameter"] = nozzle_diameter;
|
||||||
|
js["filament_id"] = calib_info.filament_prest->filament_id;
|
||||||
|
js["printer_type"] = obj_->printer_type;
|
||||||
|
NetworkAgent *agent = GUI::wxGetApp().getAgent();
|
||||||
|
if (agent)
|
||||||
|
agent->track_event("cali", js.dump());
|
||||||
|
} catch (...) {}
|
||||||
|
|
||||||
send_to_print(calib_info, error_message);
|
send_to_print(calib_info, error_message);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue