FIX: update the calibration dialog

jira: [STUDIO-9769] [STUDIO-9547]
Change-Id: I29149a978b86c27b244690083e0c3bb96566e60b
This commit is contained in:
xin.zhang 2025-01-11 18:00:25 +08:00 committed by lane.wei
parent 6aee70b967
commit 329807156a
5 changed files with 57 additions and 10 deletions

View File

@ -41,7 +41,9 @@
"support_print_without_sd": true,
"support_flow_calibration": true,
"support_build_plate_marker_detect": true,
"support_lidar_calibration": true,
"support_lidar_calibration": false,
"support_nozzle_offset_calibration": true,
"support_high_tempbed_calibration": true,
"support_ai_monitoring": true,
"support_first_layer_inspect": false,
"support_chamber_temp_edit": true,

View File

@ -48,18 +48,20 @@ CalibrationDialog::CalibrationDialog(Plater *plater)
cali_step_select_title->SetBackgroundColour(BG_COLOR);
cali_left_sizer->Add(cali_step_select_title, 0, wxLEFT, FromDIP(15));
select_xcam_cali = create_check_option(_L("Nozzle offset calibration"), cali_left_panel, _L("Nozzle offset calibration"), "xcam_cali");
select_xcam_cali = create_check_option(_L("Micro lidar calibration"), cali_left_panel, _L("Micro lidar calibration"), "xcam_cali");
select_bed_leveling = create_check_option(_L("Bed leveling"), cali_left_panel, _L("Bed leveling"), "bed_leveling");
select_vibration = create_check_option(_L("Vibration compensation"), cali_left_panel, _L("Vibration compensation"), "vibration");
select_motor_noise = create_check_option(_L("Motor noise cancellation"), cali_left_panel, _L("Motor noise cancellation"), "motor_noise");
select_nozzle_cali = create_check_option(_L("Nozzle offset calibration"), cali_left_panel, _L("Nozzle offset calibration"), "nozzle_cali");
select_heatbed_cali = create_check_option(_L("High-temperature Heatbed Calibration"), cali_left_panel, _L("High-temperature Heatbed Calibration"), "bed_cali");
cali_left_sizer->Add(0, FromDIP(18), 0, wxEXPAND, 0);
cali_left_sizer->Add(select_xcam_cali, 0, wxLEFT, FromDIP(15));
cali_left_sizer->Add(select_bed_leveling, 0, wxLEFT, FromDIP(15));
cali_left_sizer->Add(select_vibration, 0, wxLEFT, FromDIP(15));
cali_left_sizer->Add(select_motor_noise, 0, wxLEFT, FromDIP(15));
cali_left_sizer->Add(select_nozzle_cali, 0, wxLEFT, FromDIP(15));
cali_left_sizer->Add(select_heatbed_cali, 0, wxLEFT, FromDIP(15));
cali_left_sizer->Add(0, FromDIP(30), 0, wxEXPAND, 0);
auto cali_left_text_top = new wxStaticText(cali_left_panel, wxID_ANY, _L("Calibration program"), wxDefaultPosition, wxDefaultSize, 0);
@ -236,6 +238,22 @@ void CalibrationDialog::update_cali(MachineObject *obj)
m_checkbox_list["motor_noise"]->SetValue(false);
}
if (obj->is_support_nozzle_offset_cali) {
select_nozzle_cali->Show();
} else {
select_nozzle_cali->Hide();
m_checkbox_list["nozzle_cali"]->SetValue(false);
}
if (obj->is_support_high_tempbed_cali)
{
select_heatbed_cali->Show();
}
else
{
select_heatbed_cali->Hide();
m_checkbox_list["bed_cali"]->SetValue(false);
}
if (obj->is_calibration_running() || obj->is_calibration_done()) {
if (obj->is_calibration_done()) {
@ -272,6 +290,16 @@ void CalibrationDialog::update_cali(MachineObject *obj)
}
m_calibration_flow->DeleteAllItems();
m_calibration_btn->SetLabel(_L("Start Calibration"));
if (!m_checkbox_list["vibration"]->GetValue() && !m_checkbox_list["bed_leveling"]->GetValue() &&
!m_checkbox_list["xcam_cali"]->GetValue() && !m_checkbox_list["motor_noise"]->GetValue() &&
!m_checkbox_list["nozzle_cali"]->GetValue() && !m_checkbox_list["bed_cali"]->GetValue())
{
m_calibration_btn->Disable();
m_calibration_btn->SetLabel(_L("No step selected"));
}
else {
m_calibration_btn->Enable();
}
}
if (!obj->is_calibration_running() && !m_checkbox_list["vibration"]->GetValue() && !m_checkbox_list["bed_leveling"]->GetValue() &&
!m_checkbox_list["xcam_cali"]->GetValue() && !m_checkbox_list["motor_noise"]->GetValue()) {
@ -309,7 +337,9 @@ void CalibrationDialog::on_start_calibration(wxMouseEvent &event)
m_checkbox_list["vibration"]->GetValue(),
m_checkbox_list["bed_leveling"]->GetValue(),
m_checkbox_list["xcam_cali"]->GetValue(),
m_checkbox_list["motor_noise"]->GetValue()
m_checkbox_list["motor_noise"]->GetValue(),
m_checkbox_list["nozzle_cali"]->GetValue(),
m_checkbox_list["bed_cali"]->GetValue()
);
}
}

View File

@ -43,7 +43,8 @@ private:
wxWindow* select_bed_leveling { nullptr };
wxWindow* select_vibration { nullptr };
wxWindow* select_motor_noise { nullptr };
wxWindow* select_nozzle_cali{ nullptr };
wxWindow* select_heatbed_cali{ nullptr };
wxWindow* create_check_option(wxString title, wxWindow *parent, wxString tooltip, std::string param);
public:
@ -53,7 +54,7 @@ public:
StepIndicator *m_calibration_flow;
Button * m_calibration_btn;
MachineObject *m_obj;
MachineObject *m_obj = nullptr;
std::vector<int> last_stage_list_info;
int m_state{0};

View File

@ -2461,7 +2461,7 @@ bool MachineObject::is_support_command_calibration()
return true;
}
int MachineObject::command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali, bool motor_noise)
int MachineObject::command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali, bool motor_noise, bool nozzle_cali, bool bed_cali)
{
if (!is_support_command_calibration()) {
// fixed gcode file
@ -2474,7 +2474,9 @@ int MachineObject::command_start_calibration(bool vibration, bool bed_leveling,
json j;
j["print"]["command"] = "calibration";
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
j["print"]["option"]= (motor_noise ? 1 << 3 : 0)
j["print"]["option"]= (bed_cali ? 1 << 5 : 0)
+ (nozzle_cali ? 1 << 4 : 0)
+ (motor_noise ? 1 << 3 : 0)
+ (vibration ? 1 << 2 : 0)
+ (bed_leveling ? 1 << 1 : 0)
+ (xcam_cali ? 1 << 0 : 0);
@ -3363,6 +3365,16 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
}
}
if (jj.contains("support_nozzle_offset_calibration") && jj["support_nozzle_offset_calibration"].is_boolean())
{
is_support_nozzle_offset_cali = jj["support_nozzle_offset_calibration"].get<bool>();
}
if (jj.contains("support_high_tempbed_calibration") && jj["support_high_tempbed_calibration"].is_boolean())
{
is_support_high_tempbed_cali = jj["support_high_tempbed_calibration"].get<bool>();
}
if (jj.contains("support_build_plate_marker_detect")) {
if (jj["support_build_plate_marker_detect"].is_boolean()) {
is_support_build_plate_marker_detect = jj["support_build_plate_marker_detect"].get<bool>();

View File

@ -973,6 +973,8 @@ public:
bool is_support_mqtt_alive {false};
bool is_support_tunnel_mqtt{false};
bool is_support_motor_noise_cali{false};
bool is_support_nozzle_offset_cali{ false };
bool is_support_high_tempbed_cali{ false };
bool is_support_wait_sending_finish{false};
bool is_support_user_preset{false};
//bool is_support_p1s_plus{false};
@ -1123,7 +1125,7 @@ public:
int command_extruder_control(int nozzle_id, double val);
// calibration printer
bool is_support_command_calibration();
int command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali, bool motor_noise);
int command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali, bool motor_noise, bool nozzle_cali, bool bed_cali);
// PA calibration
int command_start_pa_calibration(const X1CCalibInfos& pa_data, int mode = 0); // 0: automatic mode; 1: manual mode. default: automatic mode