FIX: 1. the status of ams item is not correct

2. fix the status cali button of stat page is sometimes incorrect
3. when the nozzle volume type is not the same as printer, prompt user to sync
4. fix the incorrect nozzle volume type of cali preset page
jira: STUDIO-8856 STUDIO-8832

Change-Id: I83569f41533681b3d2f68d7b86be68955bd957f1
(cherry picked from commit 9dffa8d00281e06b24c29d818064e1c55418333d)
This commit is contained in:
zhimin.zeng 2024-11-19 14:44:05 +08:00 committed by Noisyfox
parent e273cf9cf2
commit 0b014edecd
7 changed files with 36 additions and 20 deletions

View file

@ -61,7 +61,7 @@ std::map<int, TrayInfo> get_cached_selected_filament_for_multi_extruder(MachineO
bool is_pa_params_valid(const Calib_Params& params)
{
if (params.start < MIN_PA_K_VALUE || params.end > MAX_PA_K_VALUE || params.step < EPSILON || params.end < params.start + params.step) {
if (params.start <= MIN_PA_K_VALUE || params.end >= MAX_PA_K_VALUE || params.step < EPSILON || params.end < params.start + params.step) {
MessageDialog msg_dlg(nullptr,
wxString::Format(_L("Please input valid values:\nStart value: >= %.1f\nEnd value: <= %.1f\nEnd value: > Start value\nValue step: >= %.3f"), MIN_PA_K_VALUE, MAX_PA_K_VALUE, MIN_PA_K_VALUE_STEP),
wxEmptyString, wxICON_WARNING | wxOK);

View file

@ -1789,7 +1789,10 @@ void CalibrationPresetPage::init_with_machine(MachineObject* obj)
if (obj->is_multi_extruders()) {
for (int i = 0; i < m_comboBox_nozzle_volume_types.size(); ++i) {
m_comboBox_nozzle_volume_types[i]->Show();
m_comboBox_nozzle_volume_types[i]->SetSelection(obj->m_extder_data.extders[i].current_nozzle_flow_type);
if (obj->m_extder_data.extders[i].current_nozzle_flow_type != NozzleFlowType::NONE_FLOWTYPE)
m_comboBox_nozzle_volume_types[i]->SetSelection(obj->m_extder_data.extders[i].current_nozzle_flow_type - 1);
else
m_comboBox_nozzle_volume_types[i]->SetSelection(0);
}
if (!obj->is_main_extruder_on_left() && m_main_extruder_on_left) {

View file

@ -147,7 +147,7 @@ void CalibrationPAStartPage::on_reset_page()
void CalibrationPAStartPage::on_device_connected(MachineObject* obj)
{
//enable all button
// enable all button
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, true);
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true);
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);

View file

@ -18,7 +18,7 @@ ExtrusionCalibration::ExtrusionCalibration(wxWindow *parent, wxWindowID id)
wxGetApp().UpdateDlgDarkUI(this);
}
void ExtrusionCalibration::init_bitmaps()
void ExtrusionCalibration::init_bitmaps()
{
auto lan = wxGetApp().app_config->get_language_code();
if (lan == "zh-cn") {
@ -211,7 +211,7 @@ void ExtrusionCalibration::create()
cali_sizer->Add(m_button_cali, 0, wxRIGHT | wxALIGN_CENTRE_VERTICAL, FromDIP(10));
cali_sizer->Add(m_cali_cancel, 0, wxRIGHT | wxALIGN_CENTRE_VERTICAL, FromDIP(10));
cali_sizer->Add(m_button_next_step, 0, wxRIGHT | wxALIGN_CENTRE_VERTICAL, FromDIP(10));
step_1_sizer->Add(cali_sizer, 0, wxEXPAND);
step_1_sizer->Add(0, EXTRUSION_CALIBRATION_WIDGET_GAP, 0, 0);
@ -377,7 +377,7 @@ void ExtrusionCalibration::open_bitmap(wxMouseEvent& event) {
return;
}
void ExtrusionCalibration::input_value_finish()
void ExtrusionCalibration::input_value_finish()
{
;
}
@ -414,7 +414,7 @@ void ExtrusionCalibration::show_info(bool show, bool is_error, wxString text)
void ExtrusionCalibration::update()
{
if (obj) {
if (obj->is_in_extrusion_cali()) {
if (obj->is_in_extrusion_cali()) {
show_info(true, false, wxString::Format(_L("Calibrating... %d%%"), obj->mc_print_percent));
m_cali_cancel->Show();
m_cali_cancel->Enable();
@ -510,7 +510,7 @@ bool ExtrusionCalibration::check_k_validation(wxString k_text)
;
}
if (k < MIN_PA_K_VALUE || k > MAX_PA_K_VALUE)
if (k <= MIN_PA_K_VALUE || k >= MAX_PA_K_VALUE)
return false;
return true;
}
@ -534,7 +534,7 @@ bool ExtrusionCalibration::check_k_n_validation(wxString k_text, wxString n_text
catch (...) {
;
}
if (k < MIN_PA_K_VALUE || k > MAX_PA_K_VALUE)
if (k <= MIN_PA_K_VALUE || k >= MAX_PA_K_VALUE)
return false;
if (n < 0.6 || n > 2.0)
return false;
@ -613,13 +613,13 @@ void ExtrusionCalibration::on_click_next(wxCommandEvent& event)
set_step(2);
}
bool ExtrusionCalibration::Show(bool show)
{
bool ExtrusionCalibration::Show(bool show)
{
if (show) {
m_k_val->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(20)));
m_n_val->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(20)));
}
return DPIDialog::Show(show);
return DPIDialog::Show(show);
}
void ExtrusionCalibration::update_combobox_filaments()
@ -809,7 +809,7 @@ void ExtrusionCalibration::update_filament_info()
bed_temp_int = get_bed_temp(&filament_it->config);
wxString bed_temp_text = wxString::Format("%d", bed_temp_int);
m_bed_temp->GetTextCtrl()->SetValue(bed_temp_text);
// update max flow speed
ConfigOption* opt_flow_speed = filament_it->config.option("filament_max_volumetric_speed");
if (opt_flow_speed) {

View file

@ -8432,6 +8432,17 @@ bool Plater::priv::check_ams_status_impl()
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
if (preset_bundle && preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle) == obj->printer_type) {
bool is_same_as_printer = true;
auto nozzle_volumes_values = preset_bundle->project_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type")->values;
assert(obj->m_extder_data.extders.size() == 2 && nozzle_volumes_values.size() == 2);
if (obj->m_extder_data.extders.size() == 2 && nozzle_volumes_values.size() == 2) {
NozzleVolumeType right_nozzle_type = NozzleVolumeType(obj->m_extder_data.extders[0].current_nozzle_flow_type - 1);
NozzleVolumeType left_nozzle_type = NozzleVolumeType(obj->m_extder_data.extders[1].current_nozzle_flow_type - 1);
NozzleVolumeType preset_left_type = NozzleVolumeType(nozzle_volumes_values[0]);
NozzleVolumeType preset_right_type = NozzleVolumeType(nozzle_volumes_values[1]);
is_same_as_printer = (left_nozzle_type == preset_left_type && right_nozzle_type == preset_right_type);
}
std::vector<std::map<int, int>> ams_count_info;
ams_count_info.resize(2);
int deputy_4 = 0, main_4 = 0, deputy_1 = 0, main_1 = 0;
@ -8461,9 +8472,8 @@ bool Plater::priv::check_ams_status_impl()
right_1 = main_1;
}
bool is_same_as_printer = false;
if (!preset_bundle->extruder_ams_counts.empty() && !preset_bundle->extruder_ams_counts.front().empty()) {
is_same_as_printer = preset_bundle->extruder_ams_counts[0][4] == left_4
is_same_as_printer &= preset_bundle->extruder_ams_counts[0][4] == left_4
&& preset_bundle->extruder_ams_counts[0][1] == left_1
&& preset_bundle->extruder_ams_counts[1][4] == right_4
&& preset_bundle->extruder_ams_counts[1][1] == right_1;

View file

@ -918,11 +918,14 @@ void AMSLib::render_generic_text(wxDC &dc)
if (m_info.material_name.empty()) {
show_k_value = false;
}
else if (m_obj && m_obj->is_multi_extruders() && m_info.cali_idx == -1) {
show_k_value = false;
}
else if (m_info.cali_idx == -1 || (m_obj && (CalibUtils::get_selected_calib_idx(m_obj->pa_calib_tab, m_info.cali_idx) == -1))) {
get_default_k_n_value(m_info.filament_id, m_info.k, m_info.n);
if (m_obj && m_obj->is_multi_extruders())
show_k_value = false;
else
get_default_k_n_value(m_info.filament_id, m_info.k, m_info.n);
}
else if (abs(m_info.k) < EPSILON) {
show_k_value = false;
}
auto tmp_lib_colour = m_info.material_colour;

View file

@ -288,7 +288,7 @@ bool CalibUtils::validate_input_k_value(wxString k_text, float* output_value)
;
}
if (k_value < 0 || k_value > 0.3) {
if (k_value <= MIN_PA_K_VALUE || k_value >= MAX_PA_K_VALUE) {
*output_value = default_k;
return false;
}