From 87f6e62f268becb4b7e232316d5f7647a95c7aa7 Mon Sep 17 00:00:00 2001 From: thysson2701 Date: Sun, 28 Jun 2026 18:14:55 +0200 Subject: [PATCH] =?UTF-8?q?fix(moonraker):=20re-resolve=20host=20on=20user?= =?UTF-8?q?=E2=86=92user=20preset=20switch=20for=20AMS=20sync?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two Moonraker user presets on different ports (:7125, :7126) share the same printer agent type. switch_printer_agent() only called select_machine() when the agent *type* changed — not when the host changed within the same agent. A user→user preset switch therefore left the MachineObject pointing at the first connected printer, causing AMS sync to always query the wrong host. Fix: when the agent type stays the same (and is not the BBL agent), also call select_machine() so the host is re-resolved from the current preset and set_selected_machine() reconnects to the correct Moonraker instance. Fixes: AMS Sync locked to first printer in multi-printer sessions (SirPeroples) --- src/slic3r/GUI/GUI_App.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 04d745a2c74..4dc95102150 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -3564,6 +3564,11 @@ void GUI_App::switch_printer_agent() // Auto-switch MachineObject select_machine(effective_agent_id); + } else if (effective_agent_id != BBL_PRINTER_AGENT_ID) { + // Same agent type but host may have changed (e.g. user→user preset switch between + // two Moonraker instances on different ports). select_machine() re-resolves the host + // from the current preset and reconnects if the MachineObject differs. + select_machine(effective_agent_id); } }