FIX: wrong filament map in layer filament

1.Should calculate cost if filament used in that layer is 1,because
we should consider the last filament used in previous layer

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I5838af77f1d73bfa07c65bd6ee12ae352dc3b571
This commit is contained in:
xun.zhang 2024-07-25 20:59:10 +08:00 committed by lane.wei
parent 1d4ce2bad5
commit 0756b51eb2
1 changed files with 9 additions and 1 deletions

View File

@ -192,11 +192,19 @@ std::vector<unsigned int> get_extruders_order(const std::vector<std::vector<floa
bool use_forcast = false,
float* cost = nullptr)
{
if (curr_layer_extruders.size() <= 1) {
if (curr_layer_extruders.empty()) {
if (cost)
*cost = 0;
return curr_layer_extruders;
}
if (curr_layer_extruders.size() == 1) {
if (cost) {
*cost = 0;
if (start_extruder_id)
*cost = wipe_volumes[*start_extruder_id][curr_layer_extruders[0]];
}
return curr_layer_extruders;
}
if (use_forcast)
return solve_extruder_order_with_forcast(wipe_volumes, curr_layer_extruders, next_layer_extruders, start_extruder_id, cost);