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
This commit is contained in:
hu.wang 2023-08-15 19:24:37 +08:00 committed by Lane.Wei
parent eb7f53d6c1
commit b281285a2d
10 changed files with 55 additions and 13 deletions

View File

@ -16,8 +16,9 @@
"FUNC_ALTER_RESOLUTION": false,
"FUNC_PRINT_ALL": false,
"FUNC_EXTRUSION_CALI": true,
"FUNC_VIRTUAL_TYAY": 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,
@ -42,9 +43,10 @@
"FUNC_PRINT_WITHOUT_SD": false,
"FUNC_ALTER_RESOLUTION": false,
"FUNC_PRINT_ALL": false,
"FUNC_VIRTUAL_TYAY": true,
"FUNC_MOTOR_NOISE_CALI": false,
"FUNC_PROMPT_SOUND": false,
"FUNC_EXTRUSION_CALI": true,
"FUNC_PROMPT_SOUND": false
"FUNC_VIRTUAL_TYAY": true
},
"camera_resolution": [ "720p" ],
"bed_temperature_limit": 100,
@ -61,6 +63,7 @@
"FUNC_EXTRUSION_CALI": false,
"FUNC_LOCAL_TUNNEL": false,
"FUNC_CHAMBER_TEMP": false,
"FUNC_MOTOR_NOISE_CALI": false,
"FUNC_PROMPT_SOUND": false
},
"model_id": "BL-P002",
@ -76,6 +79,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

@ -12,6 +12,7 @@
"remote": "enabled"
}
},
"support_motor_noise_cali":false,
"support_tunnel_mqtt":false,
"support_mqtt_alive":false,
"support_command_ams_switch":false,

View File

@ -12,6 +12,7 @@
"remote": "enabled"
}
},
"support_motor_noise_cali":false,
"support_tunnel_mqtt":false,
"support_mqtt_alive":false,
"support_command_ams_switch":false,

View File

@ -8,6 +8,7 @@
"local": "local"
}
},
"support_motor_noise_cali":false,
"support_tunnel_mqtt":false,
"support_mqtt_alive":false,
"support_command_ams_switch":false,

View File

@ -8,6 +8,7 @@
"local": "local"
}
},
"support_motor_noise_cali":false,
"support_tunnel_mqtt":false,
"support_mqtt_alive":false,
"support_command_ams_switch":false,

View File

@ -18,7 +18,7 @@
"support_prompt_sound":true,
"support_ams_humidity":false,
"support_auto_recovery_step_loss":true,
"support_auto_leveling":true,
"support_auto_leveling":false,
"support_update_remain":false,
"support_timelapse":true,
"support_filament_backup":true,

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;
}
@ -218,6 +219,29 @@ 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_support_auto_leveling){
select_bed_leveling->Show();
}else{
select_bed_leveling->Hide();
m_checkbox_list["bed_leveling"]->SetValue(false);
}
if (obj->is_support_motor_noise_cali) {
select_motor_noise->Show();
} else {
select_motor_noise->Hide();
m_checkbox_list["motor_noise"]->SetValue(false);
}
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()) {
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()) {
@ -283,7 +307,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

@ -1990,7 +1990,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
@ -2003,7 +2003,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());
@ -2857,6 +2858,12 @@ int MachineObject::parse_json(std::string payload)
}
}
if (jj.contains("support_motor_noise_cali")) {
if (jj["support_motor_noise_cali"].is_boolean()) {
is_support_motor_noise_cali = jj["support_motor_noise_cali"].get<bool>();
}
}
if (jj.contains("support_timelapse")) {
if (jj["support_timelapse"].is_boolean()) {
is_support_timelapse = jj["support_timelapse"].get<bool>();

View File

@ -714,6 +714,7 @@ public:
bool is_support_command_ams_switch{false};
bool is_support_mqtt_alive {false};
bool is_support_tunnel_mqtt{false};
bool is_support_motor_noise_cali{false};
int nozzle_max_temperature = -1;
int bed_temperature_limit = -1;
@ -817,7 +818,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