FIX: check recommended nozzle temperature

Jira: XXXX

Change-Id: I4dbb274cf27ef9c6d20a8479b29af1069652b2bc
This commit is contained in:
maosheng.wei 2023-11-27 11:14:19 +08:00 committed by Lane.Wei
parent 594a189108
commit 1bff6b33ce
3 changed files with 43 additions and 0 deletions

View File

@ -50,6 +50,38 @@ void ConfigManipulation::toggle_line(const std::string& opt_key, const bool togg
cb_toggle_line(opt_key, toggle);
}
void ConfigManipulation::check_nozzle_recommended_temperature_range(DynamicPrintConfig *config) {
if (is_msg_dlg_already_exist)
return;
int temperature_range_low = config->has("nozzle_temperature_range_low") ?
config->opt_int("nozzle_temperature_range_low", (unsigned int)0) :
0;
int temperature_range_high = config->has("nozzle_temperature_range_high") ?
config->opt_int("nozzle_temperature_range_high", (unsigned int)0) :
0;
if (temperature_range_low != 0 && temperature_range_high != 0) {
wxString msg_text;
bool need_check = false;
if (temperature_range_low < 190 || temperature_range_high > 300) {
msg_text += _L("The recommended minimum temperature is less than 190 degree or the recommended maximum temperature is greater than 300 degree.\n");
need_check = true;
}
if (temperature_range_low > temperature_range_high) {
msg_text += _L("The recommended minimum temperature cannot be higher than the recommended minimum temperature.\n");
need_check = true;
}
if (need_check) {
msg_text += _L("Please check.\n");
MessageDialog dialog(m_msg_dlg_parent, msg_text, "", wxICON_WARNING | wxOK);
is_msg_dlg_already_exist = true;
dialog.ShowModal();
is_msg_dlg_already_exist = false;
}
}
}
void ConfigManipulation::check_nozzle_temperature_range(DynamicPrintConfig *config)
{
if (is_msg_dlg_already_exist)

View File

@ -74,6 +74,7 @@ public:
void apply_null_fff_config(DynamicPrintConfig *config, std::vector<std::string> const &keys, std::map<ObjectBase*, ModelConfig*> const & configs);
//BBS: FFF filament nozzle temperature range
void check_nozzle_recommended_temperature_range(DynamicPrintConfig *config);
void check_nozzle_temperature_range(DynamicPrintConfig* config);
void check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config);
void check_filament_max_volumetric_speed(DynamicPrintConfig *config);

View File

@ -2903,6 +2903,16 @@ void TabFilament::build()
line.append_option(optgroup->get_option("nozzle_temperature_range_high"));
optgroup->append_line(line);
optgroup->m_on_change = [this, optgroup](t_config_option_key opt_key, boost::any value) {
DynamicPrintConfig &filament_config = wxGetApp().preset_bundle->filaments.get_edited_preset().config;
update_dirty();
if (!m_postpone_update_ui && (opt_key == "nozzle_temperature_range_low" || opt_key == "nozzle_temperature_range_high")) {
m_config_manipulation.check_nozzle_recommended_temperature_range(&filament_config);
}
on_value_change(opt_key, value);
};
optgroup = page->new_optgroup(L("Print temperature"), L"param_temperature");
optgroup->append_single_option_line("chamber_temperatures","chamber-temperature");