From 60bb29be2f247d00cbf901e61d310ef2ba8ccc64 Mon Sep 17 00:00:00 2001 From: maziggy Date: Sun, 1 Feb 2026 13:57:21 +0100 Subject: [PATCH] Fix external spool AMS mapping causing "Failed to get AMS mapping table" (Issue #213) When printing with external spool holder (no AMS connected), the printer reported error [0700-8012] "Failed to get AMS mapping table". Root cause: The ams_mapping2 calculation for external spool (tray_id=254) was incorrectly computing ams_id=63, slot_id=2 instead of the required ams_id=255, slot_id=254. The fix adds special handling for external spool tray IDs (254 for main nozzle, 255 for deputy nozzle) which use ams_id=255 with slot_id matching the tray_id. Fixes #213 --- backend/app/services/bambu_mqtt.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/app/services/bambu_mqtt.py b/backend/app/services/bambu_mqtt.py index d1bb21299..ece44bb81 100644 --- a/backend/app/services/bambu_mqtt.py +++ b/backend/app/services/bambu_mqtt.py @@ -2033,10 +2033,15 @@ class BambuMQTTClient: for tray_id in ams_mapping: # Ensure tray_id is an integer (may be string from JSON) tray_id = int(tray_id) if tray_id is not None else -1 - if tray_id == -1 or tray_id == 255: + if tray_id == -1: + # Unmapped filament slot ams_mapping2.append({"ams_id": 255, "slot_id": 255}) + elif tray_id >= 254: + # External spool: 254 = main nozzle, 255 = deputy nozzle + # External spools use ams_id=255 with slot_id matching tray_id + ams_mapping2.append({"ams_id": 255, "slot_id": tray_id}) else: - # Global tray ID = (ams_id * 4) + slot_id + # Regular AMS tray: Global tray ID = (ams_id * 4) + slot_id ams_id = tray_id // 4 slot_id = tray_id % 4 ams_mapping2.append({"ams_id": ams_id, "slot_id": slot_id})