FIX: sync some differences from master

and cherry pick I6d6b337176bb1dd9e99b51b67065e103d054201d
jira: none

Change-Id: I0902ab2986ec1b604eeb67062e886f9fe2151b6a
(cherry picked from commit 90291d550b96de31c9c50814b19d88a453c57290)
This commit is contained in:
zhimin.zeng 2025-09-10 14:28:45 +08:00 committed by Noisyfox
parent a941895fe7
commit 14716da0c3
4 changed files with 92 additions and 66 deletions

View file

@ -970,6 +970,7 @@ void PressureAdvanceWizard::on_cali_save()
if (save_page->is_all_failed()) {
MessageDialog msg_dlg(nullptr, _L("The failed test result has been dropped."), wxEmptyString, wxOK);
msg_dlg.ShowModal();
back_preset_info(curr_obj, true);
show_step(start_step);
return;
}
@ -1383,6 +1384,7 @@ void FlowRateWizard::on_cali_save()
if (save_page->is_all_failed()) {
MessageDialog msg_dlg(nullptr, _L("The failed test result has been dropped."), wxEmptyString, wxOK);
msg_dlg.ShowModal();
back_preset_info(curr_obj, true);
show_step(start_step);
return;
}
@ -1762,6 +1764,7 @@ void MaxVolumetricSpeedWizard::on_cali_save()
MessageDialog msg_dlg(nullptr, _L("Max volumetric speed calibration result has been saved to preset."), wxEmptyString, wxOK);
msg_dlg.ShowModal();
back_preset_info(curr_obj, true);
show_step(start_step);
}

View file

@ -270,7 +270,7 @@ void CalibrationCaliPage::update(MachineObject* obj)
enable_cali = false;
}
} else {
assert(false);
//assert(false);
}
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_CALI_NEXT, enable_cali);
}

View file

@ -260,7 +260,12 @@ void CaliPASaveAutoPanel::sync_cali_result(const std::vector<PACalibResult>& cal
}
preset_names = default_naming(preset_names);
for (auto& item : cali_result) {
std::vector<PACalibResult> sorted_cali_result = cali_result;
std::sort(sorted_cali_result.begin(), sorted_cali_result.end(), [this](const PACalibResult &left, const PACalibResult& right) {
return left.tray_id < right.tray_id;
});
for (auto &item : sorted_cali_result) {
bool result_failed = false;
if (item.confidence != 0) {
result_failed = true;

View file

@ -42,6 +42,9 @@ static std::string MachineBedTypeString[7] = {
"pct",
};
static wxString nozzle_not_set_text = _L("The printer nozzle information has not been set.\nPlease configure it before proceeding with the calibration.");
static wxString nozzle_volume_type_not_match_text = _L("The nozzle type does not match the actual printer nozzle type.\nPlease click the Sync button above and restart the calibration.");
std::vector<std::string> not_support_auto_pa_cali_filaments = {
"GFU03", // TPU 90A
"GFU04" // TPU 85A
@ -836,6 +839,7 @@ void CalibUtils::set_for_auto_pa_model_and_config(const std::vector<CalibInfo> &
_wall_generator->value = PerimeterGeneratorType::Arachne;
print_config.option<ConfigOptionBool>("enable_prime_tower")->value = false;
print_config.option<ConfigOptionBool>("enable_wrapping_detection")->value = false;
auto get_new_filament_id = [&sorted_calib_infos](int index) -> int {
for (size_t i = 0; i < sorted_calib_infos.size(); ++i) {
@ -1361,13 +1365,6 @@ bool CalibUtils::check_printable_status_before_cali(const MachineObject *obj, co
}
bool is_multi_extruder = obj->is_multi_extruders();
std::vector<NozzleFlowType> nozzle_volume_types;
if (is_multi_extruder) {
for (const DevExtder& extruder : obj->GetExtderSystem()->GetExtruders()) {
nozzle_volume_types.emplace_back(extruder.GetNozzleFlowType());
}
}
Preset *printer_preset = get_printer_preset(obj);
for (const auto &cali_info : cali_infos.calib_datas) {
@ -1383,7 +1380,14 @@ bool CalibUtils::check_printable_status_before_cali(const MachineObject *obj, co
return false;
}
if (is_approx(double(cali_info.nozzle_diameter), 0.2) && !obj->is_series_x()) {
error_message = wxString::Format(_L("The nozzle diameter of %s extruder is 0.2mm which does not support automatic Flow Dynamics calibration."), name);
return false;
}
float diameter = obj->GetExtderSystem()->GetNozzleDiameter(extruder_id);
NozzleFlowType nozzle_volume_type = obj->GetExtderSystem()->GetNozzleFlowType(extruder_id);
if (!is_approx(cali_info.nozzle_diameter, diameter)) {
if (is_multi_extruder)
error_message = wxString::Format(_L("The currently selected nozzle diameter of %s extruder does not match the actual nozzle diameter.\n"
@ -1394,18 +1398,21 @@ bool CalibUtils::check_printable_status_before_cali(const MachineObject *obj, co
return false;
}
if (is_multi_extruder) {
if (nozzle_volume_types[cali_info.extruder_id] == NozzleFlowType::NONE_FLOWTYPE) {
if (nozzle_volume_type == NozzleFlowType::NONE_FLOWTYPE) {
if (is_multi_extruder)
error_message = wxString::Format(_L("Printer %s nozzle information has not been set. Please configure it before proceeding with the calibration."), name);
return false;
}
else
error_message = nozzle_not_set_text;
return false;
}
if (NozzleVolumeType(nozzle_volume_types[cali_info.extruder_id] - 1) != cali_info.nozzle_volume_type) {
if (NozzleVolumeType(nozzle_volume_type - 1) != cali_info.nozzle_volume_type) {
if (is_multi_extruder)
error_message = wxString::Format(_L("The currently selected nozzle type of %s extruder does not match the actual printer nozzle type.\n"
"Please click the Sync button above and restart the calibration."), name);
return false;
}
"Please click the Sync button above and restart the calibration."), name);
else
error_message = nozzle_volume_type_not_match_text;
return false;
}
}
return true;
@ -1421,61 +1428,72 @@ bool CalibUtils::check_printable_status_before_cali(const MachineObject *obj, co
if (cali_infos.empty())
return true;
float cali_diameter = cali_infos[0].nozzle_diameter;
int extruder_id = cali_infos[0].extruder_id;
bool is_multi_extruder = obj->is_multi_extruders();
std::vector<NozzleFlowType> nozzle_volume_types;
if (is_multi_extruder) {
const auto& extders = obj->GetExtderSystem()->GetExtruders();
for (const DevExtder &extruder : extders) {
nozzle_volume_types.emplace_back(extruder.GetNozzleFlowType());
}
}
Preset *printer_preset = get_printer_preset(obj);
for (const auto &cali_info : cali_infos) {
if (cali_infos[0].params.mode == CalibMode::Calib_Auto_PA_Line && !is_support_auto_pa_cali(cali_info.filament_prest->filament_id)) {
wxString name = _L("left");
if (cali_info.extruder_id == 0) {
name = _L("right");
}
if (cali_info.params.mode == CalibMode::Calib_Auto_PA_Line && !is_support_auto_pa_cali(cali_info.filament_prest->filament_id)) {
error_message = _L("TPU 90A/TPU 85A is too soft and does not support automatic Flow Dynamics calibration.");
return false;
}
if (!is_approx(cali_diameter, cali_info.nozzle_diameter)) {
error_message = _L("Automatic calibration only supports cases where the left and right nozzle diameters are identical.");
if (is_approx(double(cali_info.nozzle_diameter), 0.2) && !obj->is_series_x()) {
error_message = wxString::Format(_L("The nozzle diameter of %s extruder is 0.2mm which does not support automatic Flow Dynamics calibration."), name);
return false;
}
}
if (extruder_id >= obj->GetExtderSystem()->GetExtruders().size()) {
error_message = _L("The number of printer extruders and the printer selected for calibration does not match.");
return false;
}
float cali_diameter = cali_info.nozzle_diameter;
int extruder_id = cali_info.extruder_id;
if (extruder_id >= obj->GetExtderSystem()->GetTotalExtderSize()) {
error_message = _L("The number of printer extruders and the printer selected for calibration does not match.");
return false;
}
float diameter = obj->GetExtderSystem()->GetNozzleDiameter(extruder_id);
bool is_multi_extruder = obj->is_multi_extruders();
std::vector<NozzleFlowType> nozzle_volume_types;
if (is_multi_extruder) {
for (auto &extruder : obj->GetExtderSystem()->GetExtruders()) { nozzle_volume_types.emplace_back(extruder.GetNozzleFlowType()); }
}
for (const auto &cali_info : cali_infos) {
wxString name = _L("left");
if (cali_info.extruder_id == 0) { name = _L("right"); }
float diameter = obj->GetExtderSystem()->GetNozzleDiameter(extruder_id);
NozzleFlowType nozzle_volume_type = nozzle_volume_types[cali_info.extruder_id];
if (!is_approx(cali_info.nozzle_diameter, diameter)) {
if (is_multi_extruder)
error_message = wxString::Format(_L("The currently selected nozzle diameter of %s extruder does not match the actual nozzle diameter.\n"
"Please click the Sync button above and restart the calibration."),
name);
"Please click the Sync button above and restart the calibration."), name);
else
error_message = _L("The nozzle diameter does not match the actual printer nozzle diameter.\n"
"Please click the Sync button above and restart the calibration.");
return false;
}
if (is_multi_extruder) {
if (nozzle_volume_types[cali_info.extruder_id] == NozzleFlowType::NONE_FLOWTYPE) {
if (nozzle_volume_type == NozzleFlowType::NONE_FLOWTYPE) {
if (is_multi_extruder)
error_message = wxString::Format(_L("Printer %s nozzle information has not been set. Please configure it before proceeding with the calibration."), name);
return false;
}
else
error_message = nozzle_not_set_text;
return false;
}
if (NozzleVolumeType(nozzle_volume_types[cali_info.extruder_id] - 1) != cali_info.nozzle_volume_type) {
if (NozzleVolumeType(nozzle_volume_type - 1) != cali_info.nozzle_volume_type) {
if (is_multi_extruder)
error_message = wxString::Format(_L("The currently selected nozzle type of %s extruder does not match the actual printer nozzle type.\n"
"Please click the Sync button above and restart the calibration."),
name);
return false;
}
"Please click the Sync button above and restart the calibration."), name);
else
error_message = nozzle_volume_type_not_match_text;
return false;
}
}
return true;
}
@ -1489,20 +1507,15 @@ bool CalibUtils::check_printable_status_before_cali(const MachineObject* obj, co
const ConfigOptionFloats *nozzle_diameter_config = cali_info.printer_prest->config.option<ConfigOptionFloats>("nozzle_diameter");
float nozzle_diameter = nozzle_diameter_config->values[0];
float diameter = obj->GetExtderSystem()->GetNozzleDiameter(cali_info.extruder_id);
bool is_multi_extruder = obj->is_multi_extruders();
std::vector<NozzleFlowType> nozzle_volume_types;
if (is_multi_extruder) {
for (const DevExtder& extruder : obj->GetExtderSystem()->GetExtruders()) {
nozzle_volume_types.emplace_back(extruder.GetNozzleFlowType());
}
}
wxString name = _L("left");
if (cali_info.extruder_id == 0) {
name = _L("right");
}
float diameter = obj->GetExtderSystem()->GetNozzleDiameter(cali_info.extruder_id);
NozzleFlowType nozzle_volume_type = obj->GetExtderSystem()->GetNozzleFlowType(cali_info.extruder_id);
if (!is_approx(nozzle_diameter, diameter)) {
if (is_multi_extruder)
error_message = wxString::Format(_L("The currently selected nozzle diameter of %s extruder does not match the actual nozzle diameter.\n"
@ -1513,17 +1526,22 @@ bool CalibUtils::check_printable_status_before_cali(const MachineObject* obj, co
return false;
}
if (is_multi_extruder) {
if (nozzle_volume_types[cali_info.extruder_id] == NozzleFlowType::NONE_FLOWTYPE) {
error_message = wxString::Format(_L("Printer %s nozzle information has not been set. Please configure it before proceeding with the calibration."), name);
return false;
}
if (NozzleVolumeType(nozzle_volume_types[cali_info.extruder_id] - 1) != cali_info.nozzle_volume_type) {
if (nozzle_volume_type == NozzleFlowType::NONE_FLOWTYPE) {
if (is_multi_extruder)
error_message = wxString::Format(_L("Printer %s nozzle information has not been set. Please configure it before proceeding with the calibration."), name);
else
error_message = nozzle_not_set_text;
return false;
}
if (NozzleVolumeType(nozzle_volume_type - 1) != cali_info.nozzle_volume_type) {
if (is_multi_extruder)
error_message = wxString::Format(_L("The currently selected nozzle type of %s extruder does not match the actual printer nozzle type.\n"
"Please click the Sync button above and restart the calibration."), name);
return false;
}
"Please click the Sync button above and restart the calibration."), name);
else
error_message = nozzle_volume_type_not_match_text;
return false;
}
return true;