Browse Source

Fix external spool ams_mapping2 slot_id (Issue #213)

The ams_mapping2 format was incorrectly using the tray_id (254/255) as
the slot_id for external spools. The printer expects slot_id to be the
actual slot index (0 for main nozzle, 1 for deputy nozzle), not the
tray_id value.

Before: {"ams_id": 255, "slot_id": 254}  <- invalid slot index
After:  {"ams_id": 255, "slot_id": 0}    <- correct slot index

This caused prints using external spool to fail immediately with error
code 07FF_8007.

Closes #213
maziggy 3 months ago
parent
commit
234693a306
1 changed files with 3 additions and 2 deletions
  1. 3 2
      backend/app/services/bambu_mqtt.py

+ 3 - 2
backend/app/services/bambu_mqtt.py

@@ -2038,8 +2038,9 @@ class BambuMQTTClient:
                         ams_mapping2.append({"ams_id": 255, "slot_id": 255})
                         ams_mapping2.append({"ams_id": 255, "slot_id": 255})
                     elif tray_id >= 254:
                     elif tray_id >= 254:
                         # External spool: 254 = main nozzle, 255 = deputy nozzle
                         # 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})
+                        # For ams_mapping2, slot_id is 0 (main) or 1 (deputy), not the tray_id
+                        external_slot = 0 if tray_id == 254 else 1
+                        ams_mapping2.append({"ams_id": 255, "slot_id": external_slot})
                     else:
                     else:
                         # Regular AMS tray: Global tray ID = (ams_id * 4) + slot_id
                         # Regular AMS tray: Global tray ID = (ams_id * 4) + slot_id
                         ams_id = tray_id // 4
                         ams_id = tray_id // 4