FIX: fix a bug of calibration

Change-Id: I1ef30271c42f0468fd00fb5b6ca49abe1b647cd6
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2023-07-07 10:11:18 +08:00 committed by Lane.Wei
parent 94c4ef6105
commit 80e4578921
8 changed files with 42 additions and 50 deletions

View file

@ -432,8 +432,7 @@ void PressureAdvanceWizard::on_cali_start()
return; return;
} }
if (curr_obj->printer_type == "BL-P001" if (curr_obj->get_printer_series() == PrinterSeries::SERIES_X1) {
|| curr_obj->printer_type == "BL-P002") {
X1CCalibInfos calib_infos; X1CCalibInfos calib_infos;
for (auto& item : selected_filaments) { for (auto& item : selected_filaments) {
int nozzle_temp = -1; int nozzle_temp = -1;
@ -472,8 +471,7 @@ void PressureAdvanceWizard::on_cali_start()
msg_dlg.ShowModal(); msg_dlg.ShowModal();
} }
} }
else if (curr_obj->printer_type == "C11" else if (curr_obj->get_printer_series() == PrinterSeries::SERIES_P1P) {
|| curr_obj->printer_type == "C12") {
if (selected_filaments.empty()) { if (selected_filaments.empty()) {
BOOST_LOG_TRIVIAL(warning) << "CaliPreset: selected filaments is empty"; BOOST_LOG_TRIVIAL(warning) << "CaliPreset: selected filaments is empty";
return; return;
@ -502,8 +500,7 @@ void PressureAdvanceWizard::on_cali_start()
void PressureAdvanceWizard::on_cali_save() void PressureAdvanceWizard::on_cali_save()
{ {
if (curr_obj) { if (curr_obj) {
if (curr_obj->printer_type == "BL-P001" if (curr_obj->get_printer_series() == PrinterSeries::SERIES_X1) {
|| curr_obj->printer_type == "BL-P002") {
if (m_cali_method == CalibrationMethod::CALI_METHOD_AUTO) { if (m_cali_method == CalibrationMethod::CALI_METHOD_AUTO) {
std::vector<PACalibResult> new_pa_cali_results; std::vector<PACalibResult> new_pa_cali_results;
auto save_page = static_cast<CalibrationPASavePage*>(save_step->page); auto save_page = static_cast<CalibrationPASavePage*>(save_step->page);
@ -528,8 +525,7 @@ void PressureAdvanceWizard::on_cali_save()
CalibUtils::set_PA_calib_result({ new_pa_cali_result }); CalibUtils::set_PA_calib_result({ new_pa_cali_result });
} }
} }
else if (curr_obj->printer_type == "C11" else if (curr_obj->get_printer_series() == PrinterSeries::SERIES_P1P) {
|| curr_obj->printer_type == "C12") {
auto save_page = static_cast<CalibrationPASavePage*>(save_step->page); auto save_page = static_cast<CalibrationPASavePage*>(save_step->page);
float new_k_value = 0.0f; float new_k_value = 0.0f;
float new_n_value = 0.0f; float new_n_value = 0.0f;

View file

@ -13,9 +13,9 @@ CalibrationStyle get_cali_style(MachineObject* obj)
{ {
if (!obj) return CalibrationStyle::CALI_STYLE_DEFAULT; if (!obj) return CalibrationStyle::CALI_STYLE_DEFAULT;
if (obj->printer_type == "BL-P001" || obj->printer_type == "BL-P002") if (obj->get_printer_series() == PrinterSeries::SERIES_X1)
return CalibrationStyle::CALI_STYLE_X1; return CalibrationStyle::CALI_STYLE_X1;
else if (obj->printer_type == "C11" || obj->printer_type == "C12") else if (obj->get_printer_series() == PrinterSeries::SERIES_P1P)
return CalibrationStyle::CALI_STYLE_P1P; return CalibrationStyle::CALI_STYLE_P1P;
return CalibrationStyle::CALI_STYLE_DEFAULT; return CalibrationStyle::CALI_STYLE_DEFAULT;
@ -57,15 +57,15 @@ CalibrationFilamentMode get_cali_filament_mode(MachineObject* obj, CalibMode mod
if (mode == CalibMode::Calib_PA_Line) { if (mode == CalibMode::Calib_PA_Line) {
if (obj->printer_type == "BL-P001" || obj->printer_type == "BL-P002") if (obj->get_printer_series() == PrinterSeries::SERIES_X1)
return CalibrationFilamentMode::CALI_MODEL_MULITI; return CalibrationFilamentMode::CALI_MODEL_MULITI;
else if (obj->printer_type == "C11" || obj->printer_type == "C12") else if (obj->get_printer_series() == PrinterSeries::SERIES_P1P)
return CalibrationFilamentMode::CALI_MODEL_SINGLE; return CalibrationFilamentMode::CALI_MODEL_SINGLE;
} }
else if (mode == CalibMode::Calib_Flow_Rate) { else if (mode == CalibMode::Calib_Flow_Rate) {
if (obj->printer_type == "BL-P001" || obj->printer_type == "BL-P002") if (obj->get_printer_series() == PrinterSeries::SERIES_X1)
return CalibrationFilamentMode::CALI_MODEL_SINGLE; return CalibrationFilamentMode::CALI_MODEL_SINGLE;
else if (obj->printer_type == "C11" || obj->printer_type == "C12") else if (obj->get_printer_series() == PrinterSeries::SERIES_P1P)
return CalibrationFilamentMode::CALI_MODEL_SINGLE; return CalibrationFilamentMode::CALI_MODEL_SINGLE;
} }
@ -109,7 +109,7 @@ CalibMode get_obj_calibration_mode(const MachineObject* obj, CalibrationMethod&
return CalibMode::Calib_Flow_Rate; return CalibMode::Calib_Flow_Rate;
} }
if (obj->printer_type == "C11" || obj->printer_type == "C12") { if (obj->get_printer_series() == PrinterSeries::SERIES_P1P) {
if (boost::contains(obj->subtask_name, "auto_filament_cali")) { if (boost::contains(obj->subtask_name, "auto_filament_cali")) {
method = CalibrationMethod::CALI_METHOD_AUTO; method = CalibrationMethod::CALI_METHOD_AUTO;
return CalibMode::Calib_PA_Line; return CalibMode::Calib_PA_Line;

View file

@ -1112,7 +1112,7 @@ bool CalibrationPresetPage::need_check_sdcard(MachineObject* obj)
if (!obj) return false; if (!obj) return false;
bool need_check = false; bool need_check = false;
if (obj->printer_type == "BL-P001" || obj->printer_type == "BL-P002") { if (obj->get_printer_series() == PrinterSeries::SERIES_X1) {
if (m_cali_mode == CalibMode::Calib_Flow_Rate && m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) { if (m_cali_mode == CalibMode::Calib_Flow_Rate && m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) {
need_check = true; need_check = true;
} }
@ -1121,7 +1121,7 @@ bool CalibrationPresetPage::need_check_sdcard(MachineObject* obj)
need_check = true; need_check = true;
} }
} }
else if (obj->printer_type == "C11" || obj->printer_type == "C12") { else if (obj->get_printer_series() == PrinterSeries::SERIES_P1P) {
if (m_cali_mode == CalibMode::Calib_Flow_Rate && m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) { if (m_cali_mode == CalibMode::Calib_Flow_Rate && m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) {
need_check = true; need_check = true;
} }

View file

@ -733,9 +733,8 @@ void CalibrationPASavePage::sync_cali_result(MachineObject* obj)
} }
} }
void CalibrationPASavePage::show_panels(CalibrationMethod method, const std::string& printer_type) { void CalibrationPASavePage::show_panels(CalibrationMethod method, const PrinterSeries printer_ser) {
if (printer_type == "BL-P001" if (printer_ser == PrinterSeries::SERIES_X1) {
|| printer_type == "BL-P002") {
if (method == CalibrationMethod::CALI_METHOD_MANUAL) { if (method == CalibrationMethod::CALI_METHOD_MANUAL) {
m_manual_panel->Show(); m_manual_panel->Show();
m_auto_panel->Show(false); m_auto_panel->Show(false);
@ -746,8 +745,7 @@ void CalibrationPASavePage::show_panels(CalibrationMethod method, const std::str
} }
m_p1p_panel->Show(false); m_p1p_panel->Show(false);
} }
else if (printer_type == "C11" else if (printer_ser == PrinterSeries::SERIES_P1P) {
|| printer_type == "C12") {
m_auto_panel->Show(false); m_auto_panel->Show(false);
m_manual_panel->Show(false); m_manual_panel->Show(false);
m_p1p_panel->Show(); m_p1p_panel->Show();
@ -764,7 +762,7 @@ void CalibrationPASavePage::set_cali_method(CalibrationMethod method)
{ {
CalibrationWizardPage::set_cali_method(method); CalibrationWizardPage::set_cali_method(method);
if (curr_obj) { if (curr_obj) {
show_panels(method, curr_obj->printer_type); show_panels(method, curr_obj->get_printer_series());
} }
} }
@ -772,7 +770,7 @@ void CalibrationPASavePage::on_device_connected(MachineObject* obj)
{ {
curr_obj = obj; curr_obj = obj;
if (curr_obj) if (curr_obj)
show_panels(m_cali_method, curr_obj->printer_type); show_panels(m_cali_method, curr_obj->get_printer_series());
} }
void CalibrationPASavePage::update(MachineObject* obj) void CalibrationPASavePage::update(MachineObject* obj)
@ -788,7 +786,7 @@ void CalibrationPASavePage::update(MachineObject* obj)
bool CalibrationPASavePage::Show(bool show) { bool CalibrationPASavePage::Show(bool show) {
if (show) { if (show) {
if (curr_obj) { if (curr_obj) {
show_panels(m_cali_method, curr_obj->printer_type); show_panels(m_cali_method, curr_obj->get_printer_series());
sync_cali_result(curr_obj); sync_cali_result(curr_obj);
} }
} }

View file

@ -172,7 +172,7 @@ public:
bool get_manual_result(PACalibResult& result) { return m_manual_panel->get_result(result); } bool get_manual_result(PACalibResult& result) { return m_manual_panel->get_result(result); }
bool get_p1p_result(float* k, float* n) { return m_p1p_panel->get_result(k, n); } bool get_p1p_result(float* k, float* n) { return m_p1p_panel->get_result(k, n); }
void show_panels(CalibrationMethod method, const std::string& printer_type); void show_panels(CalibrationMethod method, const PrinterSeries printer_ser);
void on_device_connected(MachineObject* obj); void on_device_connected(MachineObject* obj);

View file

@ -122,7 +122,7 @@ void CalibrationPAStartPage::on_device_connected(MachineObject* obj)
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true); m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true);
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true); m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);
if (obj->printer_type == "BL-P001" || obj->printer_type == "BL-P002") { if (obj->get_printer_series() == PrinterSeries::SERIES_X1) {
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, true); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, true);
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true);
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);
@ -138,7 +138,7 @@ void CalibrationPAStartPage::on_device_connected(MachineObject* obj)
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false); m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false);
} }
} }
else if (obj->printer_type == "C11" || obj->printer_type == "C12") { else if (obj->get_printer_series() == PrinterSeries::SERIES_P1P) {
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false);
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false);
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);
@ -225,7 +225,7 @@ void CalibrationFlowRateStartPage::on_device_connected(MachineObject* obj)
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true); m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true);
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true); m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);
if (obj->printer_type == "BL-P001" || obj->printer_type == "BL-P002") { if (obj->get_printer_series() == PrinterSeries::SERIES_X1) {
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false);
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true);
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);
@ -237,7 +237,7 @@ void CalibrationFlowRateStartPage::on_device_connected(MachineObject* obj)
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false); m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false);
} }
} }
else if (obj->printer_type == "C11" || obj->printer_type == "C12") { else if (obj->get_printer_series() == PrinterSeries::SERIES_P1P) {
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false);
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false);
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);

View file

@ -418,6 +418,16 @@ bool MachineObject::is_high_printer_type()
return this->printer_type == "BL-P001" || this->printer_type == "BL-P002"; return this->printer_type == "BL-P001" || this->printer_type == "BL-P002";
} }
PrinterSeries MachineObject::get_printer_series() const
{
if (printer_type == "BL-P001" || printer_type == "BL-P0002")
return PrinterSeries::SERIES_X1;
else if (printer_type == "C11")
return PrinterSeries::SERIES_P1P;
else
return PrinterSeries::SERIES_P1P;
}
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),
@ -1441,26 +1451,6 @@ void MachineObject::parse_version_func()
is_support_mqtt_alive = ota_version->second.sw_ver.compare("01.03.50.01") >= 0; is_support_mqtt_alive = ota_version->second.sw_ver.compare("01.03.50.01") >= 0;
} }
} }
} else if (printer_type == "C12") {
is_support_ai_monitoring = true;
is_cloud_print_only = true;
local_camera_proto = 1;
if (ota_version != module_vers.end()) {
is_support_tunnel_mqtt = (ota_version->second.sw_ver.compare("01.03.50.01") >= 0 ||
(esp32_version != module_vers.end() && esp32_version->second.sw_ver.compare("01.05.15.00") >= 0));
is_support_remote_tunnel = ota_version->second.sw_ver.compare("01.03.50.01") >= 0;
if (lifecycle == PrinterFirmwareType::FIRMWARE_TYPE_PRODUCTION) {
is_support_mqtt_alive = ota_version->second.sw_ver.compare("01.03.50.01") >= 0;
}
else if (lifecycle == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) {
is_support_mqtt_alive = ota_version->second.sw_ver.compare("00.06.03.51") >= 0;
}
else {
is_support_mqtt_alive = ota_version->second.sw_ver.compare("01.03.50.01") >= 0;
}
}
} }
} }

View file

@ -51,6 +51,13 @@ using namespace nlohmann;
namespace Slic3r { namespace Slic3r {
enum PrinterSeries {
SERIES_X1 = 0,
SERIES_P1P,
SERIES_UNKNOWN,
};
enum PRINTING_STAGE { enum PRINTING_STAGE {
PRINTING_STAGE_PRINTING = 0, PRINTING_STAGE_PRINTING = 0,
PRINTING_STAGE_BED_LEVELING, PRINTING_STAGE_BED_LEVELING,
@ -438,6 +445,7 @@ public:
//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 */
PrinterSeries get_printer_series() const;
std::string printer_thumbnail_img; std::string printer_thumbnail_img;
std::string monitor_upgrade_printer_img; std::string monitor_upgrade_printer_img;