Fix Creality Hi CFS filament sync over Moonraker (#15857)

The Creality Hi runs Moonraker but reports its CFS in the `box` printer object, which the Moonraker agent didn't read, so filament sync found no slots. The agent now queries `box` when it finds no lane data or Happy Hare, and the parser lives in `Utils/CrealityCfs.cpp`. Creality material IDs map to filament types, with the K2 family's `same_material` list as a fallback for branded spools.

`update_filament_multi_color()` no longer stops at the first slot without a multi-colour list. It uses the slot's own colour instead, so the list stays aligned with the filament list and selecting a later filament no longer writes past its end.

The CrealityPrintAgent fallback no longer syncs a preset of a different material when no base preset of the reported type exists.

The K2 Plus `same_material` fallback is from mattjanus.

Co-authored-by: mattjanus <18539984+mattjanus@users.noreply.github.com>
This commit is contained in:
Rui Valimandmattjanus authored and GitHub committed 2026-10-28 08:50:51 -05:00
1 parent 4720370149
commit d67e0d8dc4
9 files changed
+313 -13

No files matched your search

+8 -1
View File
@@ -5067,9 +5067,16 @@ unsigned int PresetBundle::sync_ams_list(std::vector<std::pair<DynamicPrintConfi
void PresetBundle::update_filament_multi_color()
{
const auto &single_colors = project_config.option<ConfigOptionStrings>("filament_colour")->values;
std::vector<std::string> exsit_multi_colors;
for (auto &fil_item : ams_multi_color_filment){
if (fil_item.empty()) break;
// Orca: placeholder slots that sync_ams_list() pushes as {} carry no multi-colour list.
// Fall back to the slot's own colour so the list stays aligned with filament_colour.
if (fil_item.empty()) {
const size_t idx = exsit_multi_colors.size();
exsit_multi_colors.push_back(idx < single_colors.size() ? single_colors[idx] : std::string());
continue;
}
if (fil_item.size() == 1)
exsit_multi_colors.push_back(fil_item[0]);
else {