Commit Graph
4 Commits
Author SHA1 Message Date
HanifKoh c77020e654 Keep a Loaded Creality CFS Spool the Printer Cannot Name (#17034)
A K2 SE lists a loaded spool whose RFID tag the firmware does not know
with only its colour: vendor, type and name blank, state 2. The printer
shows the spool, but parse_cfs_response skipped every material with a
blank vendor and type regardless of state, so the sync dialog never
offered that slot. No firmware has been seen marking an empty slot that
way; empty slots carry state 0 and no colour.

Skip a non-zero state entry only when its colour is blank too. The slot
then shows in the sync dialog as an unread tray, like a Bambu tray with
an unknown spool: mapping it yields Generic PLA in the default colour.
The preset matcher returns no preset for an empty type instead of
scanning every preset for nothing.

The sync code for Moonraker printers assumes every tray either carries
a filament id or is a placeholder for an empty slot; an existing tray
with neither shifts the entries of the trays after it in an overwrite
sync. So a tray that resolved to no preset is published as a placeholder
as well: the overwrite sync keeps the project filament in that position,
as it does for an empty slot, and the tray stays visible in its colour.

Read the box and material fields through the null-safe JSON helpers the
K1 parser already uses, so a null or mistyped field reads as blank
instead of throwing out of the sync.

Tests: parse the reporter's boxsInfo payload and check that the unnamed
spool is listed, a truly blank entry is still skipped, a null field
reads as blank, and an empty type matches no preset; an overwrite sync
with such a placeholder between loaded slots keeps every slot's colour.
2026-11-01 03:14:28 +08:00
Rui Valimandmattjanus d67e0d8dc4 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>
2026-10-28 08:50:51 -05:00
HanifKoh 84657ff11e Add Missing Includes Across the Remaining Sources and Tests (#16071)
* Ignore Clipper, libpng, mcut and Boost.Polygon Internals in clang-tidy

Each only works through a wrapper or umbrella header: libslic3r/clipper.hpp or clipper_z.hpp configure Clipper before including it, png.h pulls in libpng's config headers, and Boost.Polygon's headers only compile through polygon.hpp or voronoi.hpp.

* Ignore minilzo's Config Headers in clang-tidy

lzoconf.h and lzodefs.h are internal to minilzo.h, which is what the code includes.

* Add Missing Includes Across the Remaining Sources and Tests

Covers src/slic3r/Utils, src/slic3r/plugin, src/slic3r/Config, src/libvgcode, src/dev-utils, src/OrcaSlicer.cpp and tests/, the directories left after src/slic3r/GUI and src/libslic3r. Generated with clang-tidy misc-include-cleaner. libvgcode's own headers are included by relative path as in the rest of that library, and Catch2 and pybind11 with angle brackets as elsewhere in the repo.

* Make the GUI and Test Headers Compile on Their Own

Each now includes, or forward-declares, what it uses instead of relying on what its includers happened to include first. Headers that only compile on one platform, or that nothing built includes, are left alone.

* Keep Windows and nanosvg Setup Ahead of the Added Includes

OrcaSlicer.cpp and several tests set _WIN32_WINNT, WIN32_LEAN_AND_MEAN or NOMINMAX before including Windows.h, and the profile validator defines NANOSVG_IMPLEMENTATION before any libslic3r header. The added includes had landed above those blocks, which broke the Windows build.

* Add the GUI Includes the First Pass Missed

Covers headers that only became editable once they compiled on their own, and wx symbols whose suggested header changed as the clang-tidy ignore list grew after the src/slic3r/GUI pass.

* Keep the Added Test Includes Below the NOMINMAX Guard

test_marchingsquares.cpp and test_texture_displacement.cpp had includes inside #ifndef NOMINMAX, which the tests inherit as defined on Windows from libslic3r, so those were skipped there. .clang-tidy also ignores the MSVC STL and UCRT internals, Boost.Multiprecision's fwd.hpp and CPython's Windows include directory, as in #16068.
2026-10-03 13:45:21 +08:00
SoftFever df101ead91 fix more issues 2026-09-04 00:29:52 +08:00