FIX: incorrect flush volume after sync ams

jira: NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I44d031b1fdcc02adbfc4346314f5001c56a941b8
This commit is contained in:
xun.zhang 2025-04-09 19:33:54 +08:00 committed by lane.wei
parent 27ef0b1bef
commit e854174bc0
1 changed files with 6 additions and 0 deletions

View File

@ -2044,6 +2044,7 @@ unsigned int PresetBundle::sync_ams_list(std::vector<std::pair<DynamicPrintConfi
if (valid_index >= 0 && valid_index < ams_filament_presets.size()) { if (valid_index >= 0 && valid_index < ams_filament_presets.size()) {
exist_colors[i] = ams_filament_colors[valid_index]; exist_colors[i] = ams_filament_colors[valid_index];
exist_filament_presets[i] = ams_filament_presets[valid_index]; exist_filament_presets[i] = ams_filament_presets[valid_index];
ams_multi_color_filment[i] = { ams_filament_colors[valid_index] };
} else { } else {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "check error: array bound (mapping exist)"; BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "check error: array bound (mapping exist)";
} }
@ -2063,6 +2064,11 @@ unsigned int PresetBundle::sync_ams_list(std::vector<std::pair<DynamicPrintConfi
ams_multi_color_filment[i] = std::vector<std::string>(); ams_multi_color_filment[i] = std::vector<std::string>();
} }
} }
else {
ams_filament_colors[i] = "";
ams_filament_presets[i] = "";
ams_multi_color_filment[i] = std::vector<std::string>();
}
} }
//delete redundant color //delete redundant color
ams_filament_colors.erase(std::remove_if(ams_filament_colors.begin(), ams_filament_colors.end(), [](std::string &value) { return value.empty(); }), ams_filament_colors.erase(std::remove_if(ams_filament_colors.begin(), ams_filament_colors.end(), [](std::string &value) { return value.empty(); }),