Commit Graph
2 Commits
Author SHA1 Message Date
HanifKoh fbc50d3d3a Start a Creality Print Job From the Spool Holder When No CFS Slot Is Mapped (#16794)
CrealityPrint::start_print() chose between the plain opGcodeFile start and the
colorMatch + multiColorPrint pair by the model id alone, and inside the
multi-colour branch it fell back to the plain start only when a filament was
mapped onto box 0. A K1-family printer reports the same model id with and
without a CFS, and without one it never answers the boxsInfo query, so the send
dialog had no slots to map and the printer received a colorMatch with an empty
list followed by multiColorPrint. The job printed, but the firmware flagged
"no material" (materialStatus 1) for its whole duration. The same happened on
any CFS-capable model whenever the boxsInfo query failed.

Treat an empty mapping like a mapping onto the spool holder and send the plain
start with enableSelfTest, which is what Creality Print does when the printer
lists no colours. The command building moves into start_print_commands(), a
pure function, so the decision is unit-tested. Every plain start now reads the
printer's answer best-effort before closing, as the non-CFS start already did,
so the close frame never follows the command in the same burst.

Fixes #16695.
2026-10-26 15:27:20 +08:00
Kris Austin 2054242884 Fix Creality print host hanging on a printer that stops answering (#16772)
ws_connect(), query_boxes_info() and start_print() set expires_after()
deadlines, then made synchronous Beast calls. Beast only applies those
deadlines to async operations, so none of them fired. A printer that
accepted the websocket and then stopped answering blocked the caller
forever. That froze the GUI thread when the Creality send dialog opened
or the sidebar synced filaments, and left uploads stuck after the file
arrived.

Run every websocket call as an async operation on the local io_context,
so the deadlines apply. run_until_done() and the per-address connect
loop move from MoonrakerPrinterAgent.cpp into AsioUtils.hpp, and both
files share them. Each resolved address gets its own connect deadline,
and start_print() gets a reply deadline for its commands. A start-print
timeout shows the translated timeout message that HTTP timeouts already
use, now shared through PrintHost::timed_out_message(), and other
websocket errors drop Boost's source location.

The websocket port and deadlines move into a protected ws_settings
member, so the tests can use a local port and short deadlines. The new
tests run CrealityPrint against a fake printer that goes silent before
or after the handshake.
2026-10-24 22:01:15 -05:00