Files
Lam Wei Lun ffef1c2294 Fix six defects in the Orca printer agent's command path (#18063)
* Fix six defects in the Orca printer agent's command path

The requests the agent sends for print.gcode_file and files.* took their
sequence_id from a counter seeded with system_clock nanoseconds, which is 19
digits. The Cloud relay accepts 1 to 16 digits and drops the rest without an
error, so a print started from the Storage tab on a cloud-reached printer
simply did nothing. They now draw from PrinterSequenceIds, the process-wide
counter that stays inside the 20000-29999 band the protocol reserves for this
app.

OrcaFilesPanel hardcoded connection_type = "lan", so a file printed from the
printer's own storage went over the LAN even when the printer was reached
through the Cloud, and start_sdcard_print would publish into whichever LAN
session happened to be open. The panel now passes the printer's real
transport. route_send also refuses a LAN send whose dev_id is not the live
session's, instead of publishing it into another printer's request topic, and
holds the connection across the send so a racing disconnect cannot free it.

command_set_nozzle always sent extruder_index 0. The call carries no tool
index and cannot infer one, so it is now refused when the capability manifest
reports more than one toolhead. An unknown count keeps the old behaviour,
which is right for the single-tool case it was written for.

command_ams_refresh_rfid discarded ams_id. The wire field tray_id is the flat
index 4 * ams_id + slot_id; it is now encoded, and a negative slot is refused
even when the caller passes an already-flat index, since the printer only
checks the result for being non-negative.

command_set_bed ignored whether the printer accepts set_bed_temp, and always
sent it. It now follows the advertised capability and falls back to M140 when
a manifest was received that omits it. The Bambu fun-flags bit that used to
be the only signal is never set by an Orca printer, so honouring it would have
broken bed heating.

bind() and request_bind_ticket() sat on the interface defaults, which return
success with an empty ticket, so the sign-in URL went out ending in &ticket=.
OrcaSonar is paired on the printer itself, so both now report failure and the
caller uses its plain URL.

Tests: six cases in tests/slic3rutils/test_orca_printer_agent.cpp, one per
fix, covering the request number's band and length, the LAN refusal, the flat
RFID index and its negative-slot guard, both bed paths, the multi-tool nozzle
refusal, and the binding failures.

Not built or run in this environment.

* Drop the Orca agent's nozzle override instead of guarding it

The previous commit guarded command_set_nozzle by refusing when the
capability manifest reported more than one toolhead. That was treating the
symptom: the call carries no tool index, but it also does not need one.

The interface default already builds print.gcode_line with M104, and
OrcaSonar runs that line verbatim (adapter.go, print.gcode_line), so it
works with no override at all. From the GUI the call is reachable only on a
single-tool printer: StatusPanel.cpp:4903 sends it only for a field typed
TEMP_OF_NORMAL_TYPE, which update_temp_ctrl sets in its nozzle_num == 1
branch alone. Two-tool and N-tool printers go through command_set_nozzle_new
with an explicit tool. So the override never fired, and the guard protected
nothing.

Removing it also removes what existed only for it: the tool_count field, the
topology loop that counted tools, and the test that covered the refusal.
The topology tools array is still parsed for the nozzle-diameter cache.

Supersedes the third fix of the previous commit.
2026-12-01 17:22:48 +08:00
..
2026-10-15 16:06:50 +08:00
2026-10-06 13:08:46 +08:00