Apply the print dialog's Box mapping on Qidi printers (#16723)

With printer agents on, the Qidi agent now uses the Box slot picked for each filament in the print dialog. After the upload it writes `SAVE_VARIABLE VARIABLE=value_t<n> VALUE="'slot<m>'"` for each mapped filament, which the firmware's T<n> macros read. Then it starts the print through `/printer/print/start`, because the Max 4, Q2, Q2C and Plus 5 only open prints from the copy that Moonraker's print start makes.

- `MoonrakerPrinterAgent::start_local_print` now ends with a virtual `print_uploaded_file()`. The default still sends `SDCARD_PRINT_FILE`, so other Moonraker agents are unchanged.
- Box units show as "Qidi Box 1", "Qidi Box 2". Agents can set an optional `display_name` on an AMS unit.
- New agent flag `native_device_tab`. Qidi sets it to false, so its native Device and Calibration tabs are hidden and the web page becomes the Device tab.
- The Moonraker agent retries its first connection with the status stream's backoff. A disconnect, a newer connection or closing the app stops the retries.
- The print dialog fetches filament data itself for agents that only send it when asked, so the slot picker shows the Box units without a sidebar sync.
- Agent printers show their address in the print dialog's printer list instead of "(LAN)". Bambu printers keep "(LAN)".
- A single nozzle whose size the printer hasn't reported shows no size instead of "Unknown".
This commit is contained in:
TheLegendTubaGuy authored and GitHub committed 2026-10-27 10:47:06 -05:00
1 parent af16875afb
commit b6ca378b23
19 files changed
+331 -44

No files matched your search

+22
View File
@@ -65,6 +65,28 @@ TEST_CASE("AMS tray placeholder state follows the latest status", "[DevFilaSyste
CHECK_FALSE(tray->is_slot_placeholder);
}
TEST_CASE("An AMS unit is shown under the name its status gives it", "[DevFilaSystem]")
{
MachineObject obj(nullptr, nullptr, "test", "test_dev", "127.0.0.1");
const json named = json::parse(R"({
"ams": { "ams": [ { "id": "0", "info": "00000001", "display_name": "Qidi Box 1", "tray": [] } ] }
})");
DevFilaSystemParser::ParseV1_0(named, &obj, obj.GetFilaSystem().get(), false);
DevAms* ams = obj.GetFilaSystem()->GetAmsById("0");
REQUIRE(ams != nullptr);
CHECK(ams->GetDisplayName().ToStdString() == "Qidi Box 1");
// Without a name the unit falls back to its type: an AMS (info type 1) with id 0 is AMS-1
const json unnamed = json::parse(R"({
"ams": { "ams": [ { "id": "0", "info": "00000001", "tray": [] } ] }
})");
DevFilaSystemParser::ParseV1_0(unnamed, &obj, obj.GetFilaSystem().get(), false);
CHECK(ams->GetDisplayName().ToStdString() == "AMS-1");
}
TEST_CASE("Switch-bound AMS trays map to the left extruder", "[DevMapping]")
{
MachineObject obj(nullptr, nullptr, "test", "test_dev", "127.0.0.1");