Sync the AMS recommended temperature range with the tray's nozzle variant

This commit is contained in:
SoftFever
2026-10-01 02:54:18 +08:00
parent e1da47a72b
commit 35a4d941b8
7 changed files with 82 additions and 25 deletions
+15 -16
View File
@@ -5696,7 +5696,7 @@ void MachineObject::update_filament_list()
PresetBundle *preset_bundle = Slic3r::GUI::wxGetApp().preset_bundle;
// custom filament
typedef std::map<std::string, std::pair<int, int>> map_pair;
typedef std::map<std::string, std::pair<std::vector<int>, std::vector<int>>> map_pair;
std::map<std::string, map_pair> map_list;
for (auto &pair : m_nozzle_filament_data) {
map_list[pair.second.printer_preset_name] = map_pair{};
@@ -5708,19 +5708,13 @@ void MachineObject::update_filament_list()
for (const std::string &printer_str : printer_strs->values) {
if (map_list.find(printer_str) != map_list.end()) {
auto & filament_list = map_list[printer_str];
ConfigOption *opt_min = const_cast<Preset &>(preset).config.option("nozzle_temperature_range_low");
int min_temp = -1;
if (opt_min) {
ConfigOptionInts *opt_min_ints = dynamic_cast<ConfigOptionInts *>(opt_min);
min_temp = opt_min_ints->get_at(0);
}
ConfigOption *opt_max = const_cast<Preset &>(preset).config.option("nozzle_temperature_range_high");
int max_temp = -1;
if (opt_max) {
ConfigOptionInts *opt_max_ints = dynamic_cast<ConfigOptionInts *>(opt_max);
max_temp = opt_max_ints->get_at(0);
}
filament_list[preset.filament_id] = std::make_pair(min_temp, max_temp);
// Every variant's range, so a change to any of them rechecks the trays
std::vector<int> min_temps{-1}, max_temps{-1};
if (auto *opt_min = preset.config.option<ConfigOptionInts>("nozzle_temperature_range_low"))
min_temps = opt_min->values;
if (auto *opt_max = preset.config.option<ConfigOptionInts>("nozzle_temperature_range_high"))
max_temps = opt_max->values;
filament_list[preset.filament_id] = std::make_pair(min_temps, max_temps);
break;
}
}
@@ -5856,10 +5850,13 @@ void MachineObject::check_ams_filament_valid()
need_checked_filament_id[nozzle_diameter_str].insert(curr_tray->setting_id);
try {
std::string preset_setting_id;
const int extruder_id = ams->GetExtruderId();
bool is_equation = preset_bundle->check_filament_temp_equation_by_printer_type_and_nozzle_for_mas_tray(printer_model, nozzle_diameter_str,
curr_tray->setting_id, curr_tray->tag_uid,
curr_tray->nozzle_temp_min,
curr_tray->nozzle_temp_max, preset_setting_id);
curr_tray->nozzle_temp_max, preset_setting_id,
get_preset_extruder_index(extruder_id),
DevNozzle::ToNozzleVolumeType(m_extder_system->GetNozzleFlowType(extruder_id)));
if (!is_equation) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << " ams filament is not match min max temp and reset, ams_id: " << ams_id << " tray_id"
<< slot_id << "filament_id: " << curr_tray->setting_id;
@@ -5924,7 +5921,9 @@ void MachineObject::check_ams_filament_valid()
this->printer_type),
nozzle_diameter_str, vt_tray.setting_id,
vt_tray.tag_uid, vt_tray.nozzle_temp_min,
vt_tray.nozzle_temp_max, preset_setting_id);
vt_tray.nozzle_temp_max, preset_setting_id,
get_preset_extruder_index(index),
DevNozzle::ToNozzleVolumeType(m_extder_system->GetNozzleFlowType(index)));
if (!is_equation) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__
<< " vt_tray filament is not match min max temp and reset, filament_id: " << vt_tray.setting_id;