mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-22 03:49:18 +02:00
Fix Bambu Lab spool detection in Spoolman sync and AMS cards
The spool detection only checked tray_uuid and tag_uid, but some Bambu Lab
spools have RFID read issues causing these to be missing while still having
valid tray_info_idx (Bambu filament preset ID like "GFA00").
Backend changes (backend/app/services/spoolman.py):
- Add tray_info_idx to AMSTray dataclass
- Parse tray_info_idx from raw MQTT data in parse_ams_tray()
- Check tray_info_idx first in is_bambu_lab_spool() - most reliable indicator
- Bambu Lab presets start with "GF" (GFA00, GFB00, GFL00, etc.)
- Fall back to tray_uuid then tag_uid for unique spool identification
- Add warning when Bambu spool detected but no unique ID for Spoolman
Backend changes (backend/app/api/routes/spoolman.py):
- Update /sync/{printer_id} and /sync-all to pass tray_info_idx
- Guard against empty spool_tag when adding to tracking set
Frontend changes (frontend/src/pages/PrintersPage.tsx):
- Add isBambuLabSpool() helper with same detection logic as backend
- Update all 4 vendor detection locations in AMS cards to use new helper
Detection priority (same on frontend and backend):
1. tray_info_idx starts with "GF" (Bambu preset ID)
2. tray_uuid is valid 32-char hex (non-zero)
3. tag_uid is valid 16-char hex (non-zero)
This commit is contained in:
@@ -213,7 +213,7 @@ async def sync_printer_ams(
|
||||
location = client.convert_ams_slot_to_location(ams_id, tray.tray_id)
|
||||
|
||||
# Skip non-Bambu Lab spools (SpoolEase/third-party) - track as skipped
|
||||
if not client.is_bambu_lab_spool(tray.tray_uuid, tray.tag_uid):
|
||||
if not client.is_bambu_lab_spool(tray.tray_uuid, tray.tag_uid, tray.tray_info_idx):
|
||||
skipped.append(
|
||||
SkippedSpool(
|
||||
location=location,
|
||||
@@ -230,7 +230,8 @@ async def sync_printer_ams(
|
||||
if tray.tray_uuid and tray.tray_uuid != "00000000000000000000000000000000"
|
||||
else tray.tag_uid
|
||||
)
|
||||
current_tray_uuids.add(spool_tag.upper())
|
||||
if spool_tag:
|
||||
current_tray_uuids.add(spool_tag.upper())
|
||||
|
||||
try:
|
||||
sync_result = await client.sync_ams_tray(tray, printer.name)
|
||||
@@ -342,7 +343,7 @@ async def sync_all_printers(db: AsyncSession = Depends(get_db)):
|
||||
location = f"{printer.name} - {client.convert_ams_slot_to_location(ams_id, tray.tray_id)}"
|
||||
|
||||
# Skip non-Bambu Lab spools (SpoolEase/third-party) - track as skipped
|
||||
if not client.is_bambu_lab_spool(tray.tray_uuid, tray.tag_uid):
|
||||
if not client.is_bambu_lab_spool(tray.tray_uuid, tray.tag_uid, tray.tray_info_idx):
|
||||
all_skipped.append(
|
||||
SkippedSpool(
|
||||
location=location,
|
||||
@@ -359,7 +360,8 @@ async def sync_all_printers(db: AsyncSession = Depends(get_db)):
|
||||
if tray.tray_uuid and tray.tray_uuid != "00000000000000000000000000000000"
|
||||
else tray.tag_uid
|
||||
)
|
||||
printer_tray_uuids[printer.name].add(spool_tag.upper())
|
||||
if spool_tag:
|
||||
printer_tray_uuids[printer.name].add(spool_tag.upper())
|
||||
|
||||
try:
|
||||
sync_result = await client.sync_ams_tray(tray, printer.name)
|
||||
|
||||
Reference in New Issue
Block a user