NEW:[STUDIO-4016] Support motor noise cali for N1

Calibrated motor noise option, N1 supported.
And when none of the calibration options are selected, the start calibration button turns gray

Change-Id: I991034a13001f840016475171c33218ddc812d35
(cherry picked from commit 7224ccd2a114d553b6234a7d8616d253bef0ced4)
This commit is contained in:
hu.wang 2023-08-15 19:24:37 +08:00 committed by Lane.Wei
parent 09b6f4d8fd
commit 2cf9ee1dc5
5 changed files with 51 additions and 12 deletions

View file

@ -16,7 +16,9 @@
"FUNC_ALTER_RESOLUTION": false,
"FUNC_PRINT_ALL": false,
"FUNC_EXTRUSION_CALI": true,
"FUNC_PROMPT_SOUND": false
"FUNC_MOTOR_NOISE_CALI": false,
"FUNC_PROMPT_SOUND": false,
"FUNC_VIRTUAL_TYAY": true
},
"camera_resolution": [ "720p" ],
"bed_temperature_limit": 100,
@ -41,7 +43,9 @@
"FUNC_PRINT_WITHOUT_SD": false,
"FUNC_ALTER_RESOLUTION": false,
"FUNC_PRINT_ALL": false,
"FUNC_PROMPT_SOUND": false
"FUNC_MOTOR_NOISE_CALI": false,
"FUNC_PROMPT_SOUND": false,
"FUNC_VIRTUAL_TYAY": true
},
"camera_resolution": [ "720p" ],
"bed_temperature_limit": 100,
@ -58,7 +62,7 @@
"FUNC_FIRSTLAYER_INSPECT": false,
"FUNC_AI_MONITORING": false,
"FUNC_BUILDPLATE_MARKER_DETECT": false,
"FUNC_FLOW_CALIBRATION": false,
"FUNC_FLOW_CALIBRATION": true,
"FUNC_MONITORING": false,
"FUNC_MEDIA_FILE": false,
"FUNC_VIRTUAL_CAMERA": false,
@ -67,7 +71,8 @@
"FUNC_CHAMBER_FAN": false,
"FUNC_AUX_FAN": false,
"FUNC_UPDATE_REMAIN": false,
"FUNC_EXTRUSION_CALI": false
"FUNC_EXTRUSION_CALI": false,
"FUNC_AUTO_LEVELING": false
},
"printer_arch" : "i3",
"camera_resolution": [ "720p" ],
@ -84,6 +89,7 @@
"FUNC_CHAMBER_TEMP": false,
"FUNC_VIRTUAL_TYAY": true,
"FUNC_EXTRUSION_CALI": false,
"FUNC_MOTOR_NOISE_CALI": false,
"FUNC_PROMPT_SOUND": false
},
"model_id": "BL-P002",
@ -99,6 +105,7 @@
"FUNC_VIRTUAL_TYAY": true,
"FUNC_EXTRUSION_CALI": false,
"FUNC_LOCAL_TUNNEL": false,
"FUNC_MOTOR_NOISE_CALI": false,
"FUNC_PROMPT_SOUND": false
},
"model_id": "BL-P001",

View file

@ -50,16 +50,16 @@ CalibrationDialog::CalibrationDialog(Plater *plater)
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("Resonance frequency identification"), cali_left_panel, _L("Resonance frequency identification"), "vibration");
select_vibration = create_check_option(_L("Vibration compensation"), cali_left_panel, _L("Vibration compensation"), "vibration");
select_motor_noise = create_check_option(_L("Motor noise"), cali_left_panel, _L("Motor noise cancellation"), "motor_noise");
m_checkbox_list["xcam_cali"]->SetValue(true);
m_checkbox_list["bed_leveling"]->SetValue(true);
m_checkbox_list["vibration"]->SetValue(true);
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(0, FromDIP(30), 0, wxEXPAND, 0);
auto cali_left_text_top = new wxStaticText(cali_left_panel, wxID_ANY, _L("Calibration program"), wxDefaultPosition, wxDefaultSize, 0);
@ -208,6 +208,7 @@ wxWindow* CalibrationDialog::create_check_option(wxString title, wxWindow* paren
text->Bind(wxEVT_LEFT_DOWN, [this, check](wxMouseEvent&) { check->SetValue(check->GetValue() ? false : true); });
m_checkbox_list[param] = check;
m_checkbox_list[param]->SetValue(true);
return checkbox;
}
@ -219,6 +220,30 @@ void CalibrationDialog::update_cali(MachineObject *obj)
select_xcam_cali->Show();
} else {
select_xcam_cali->Hide();
m_checkbox_list["xcam_cali"]->SetValue(false);
}
if(obj->is_function_supported(PrinterFunction::FUNC_AUTO_LEVELING)){
select_bed_leveling->Show();
}else{
select_bed_leveling->Hide();
m_checkbox_list["bed_leveling"]->SetValue(false);
}
if (obj->is_function_supported(PrinterFunction::FUNC_MOTOR_NOISE_CALI)) {
select_motor_noise->Show();
} else {
select_motor_noise->Hide();
m_checkbox_list["motor_noise"]->SetValue(false);
}
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_calibration_btn->Disable();
m_calibration_btn->SetLabel(_L("No step selected"));
return ;
} else {
m_calibration_btn->Enable();
}
if (obj->is_calibration_running() || obj->is_calibration_done()) {
@ -284,7 +309,8 @@ void CalibrationDialog::on_start_calibration(wxMouseEvent &event)
m_obj->command_start_calibration(
m_checkbox_list["vibration"]->GetValue(),
m_checkbox_list["bed_leveling"]->GetValue(),
m_checkbox_list["xcam_cali"]->GetValue()
m_checkbox_list["xcam_cali"]->GetValue(),
m_checkbox_list["motor_noise"]->GetValue()
);
}
}

View file

@ -42,6 +42,7 @@ private:
wxWindow* select_xcam_cali { nullptr };
wxWindow* select_bed_leveling { nullptr };
wxWindow* select_vibration { nullptr };
wxWindow* select_motor_noise { nullptr };
wxWindow* create_check_option(wxString title, wxWindow *parent, wxString tooltip, std::string param);

View file

@ -2107,7 +2107,7 @@ bool MachineObject::is_support_command_calibration()
return true;
}
int MachineObject::command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali)
int MachineObject::command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali, bool motor_noise)
{
if (!is_support_command_calibration()) {
// fixed gcode file
@ -2120,7 +2120,8 @@ 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"] = (vibration ? 1 << 2 : 0)
j["print"]["option"]= (motor_noise ? 1 << 3 : 0)
+ (vibration ? 1 << 2 : 0)
+ (bed_leveling ? 1 << 1 : 0)
+ (xcam_cali ? 1 << 0 : 0);
return this->publish_json(j.dump());
@ -2738,6 +2739,9 @@ bool MachineObject::is_function_supported(PrinterFunction func)
case FUNC_FILAMENT_BACKUP:
func_name = "FUNC_FILAMENT_BACKUP";
break;
case FUNC_MOTOR_NOISE_CALI:
func_name = "FUNC_MOTOR_NOISE_CALI";
break;
default:
return true;
}

View file

@ -111,6 +111,7 @@ enum PrinterFunction {
FUNC_VIRTUAL_TYAY,
FUNC_PRINT_ALL,
FUNC_FILAMENT_BACKUP,
FUNC_MOTOR_NOISE_CALI,
FUNC_MAX
};
@ -830,7 +831,7 @@ public:
// calibration printer
bool is_support_command_calibration();
int command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali);
int command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali, bool motor_noise);
// PA calibration
int command_start_pa_calibration(const X1CCalibInfos& pa_data, int mode = 0); // 0: automatic mode; 1: manual mode. default: automatic mode