FIX: the extruder diameter check fault

jira: [none]
Change-Id: Ib5719996b0b660bb68ab20c7c38cc6b2ce3a9286
This commit is contained in:
xin.zhang 2025-01-07 20:09:42 +08:00 committed by lane.wei
parent cb1138f66f
commit 0bbc185b71
3 changed files with 14 additions and 10 deletions

View File

@ -246,8 +246,8 @@
"92"
],
"physical_extruder_map" : [
"0",
"1"
"1",
"0"
],
"printable_area": [
"0x0",

View File

@ -1260,6 +1260,12 @@ std::vector<int> PartPlate::get_extruders_without_support(bool conside_custom_gc
}
/* -1 is invalid, return physical extruder idx*/
/* machine has 1 extruder*/
/* logical extruder: 1-unique*/
/* physical extruder: 0-unique*/
/* machine have 2 extruders*/
/* logical extruder: 1-left, 2-right*/
/* physical extruder: 0-right, 1-left*/
int PartPlate::get_physical_extruder_by_filament_id(const DynamicConfig& g_config, int idx) const
@ -1270,16 +1276,14 @@ int PartPlate::get_physical_extruder_by_filament_id(const DynamicConfig& g_confi
return -1;
}
int logical_ext_idx = filament_map[idx - 1];
switch (logical_ext_idx)
const auto the_map = g_config.option<ConfigOptionInts>("physical_extruder_map");
if (!the_map)
{
case 1: return 1;
case 2: return 0;
default: break;
return -1;
}
assert(0);
return -1;
int zero_base_logical_idx = filament_map[idx - 1] - 1;
return the_map->values[zero_base_logical_idx];
}
std::vector<int> PartPlate::get_used_filaments()

View File

@ -1993,7 +1993,7 @@ bool SelectMachineDialog::is_same_nozzle_diameters(float& tag_nozzle_diameter) c
auto used_filament_idxs = cur_plate->get_used_filaments();/*the index is started from 1*/
for (int used_filament_idx : used_filament_idxs)
{
int used_nozzle_idx = cur_plate->get_physical_extruder_by_filament_id(preset_bundle->project_config, used_filament_idx);
int used_nozzle_idx = cur_plate->get_physical_extruder_by_filament_id(preset_bundle->full_config(), used_filament_idx);
if (used_nozzle_idx == -1)
{
assert(0);