mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-21 10:15:04 +02:00
Redesign SpoolBuddy dashboard: inline spool cards, full-screen AMS assign modal, filament ID normalization
- Replace TagDetectedModal with inline SpoolInfoCard/UnknownTagCard
in dashboard right panel (known spools show assign/sync/close,
unknown tags show add-to-inventory/link/close)
- Rewrite AssignToAmsModal as full-screen overlay reusing AmsUnitCard,
with AMS-HT and external slot support, single assignSpool API call
- Remove printer selector from assign modal (uses top bar selection)
- Extract filament_id <-> setting_id conversion to shared utility
(backend/app/utils/filament_ids.py), used by inventory + cloud routes
- Normalize slicer_filament in assign_spool to derive proper
tray_info_idx and setting_id for MQTT (was sending setting_id="")
- Rename SpoolBuddy top bar status label "Online" -> "Backend"
- Remove weightStable guard from sync weight button
This commit is contained in:
@@ -38,6 +38,7 @@ from backend.app.services.bambu_cloud import (
|
||||
BambuCloudError,
|
||||
get_cloud_service,
|
||||
)
|
||||
from backend.app.utils.filament_ids import filament_id_to_setting_id
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -503,32 +504,8 @@ async def _enrich_from_local_presets(
|
||||
return result
|
||||
|
||||
|
||||
def _filament_id_to_setting_id(filament_id: str) -> str:
|
||||
"""
|
||||
Convert filament_id to setting_id format for Bambu Cloud API.
|
||||
|
||||
Printers report filament_id (e.g., GFA00, GFG02) but the API expects
|
||||
setting_id format which has an "S" inserted after "GF" (e.g., GFSA00, GFSG02).
|
||||
|
||||
User presets (starting with "P") and already-correct IDs are returned unchanged.
|
||||
"""
|
||||
if not filament_id:
|
||||
return filament_id
|
||||
|
||||
# User presets start with "P" - leave unchanged
|
||||
if filament_id.startswith("P"):
|
||||
return filament_id
|
||||
|
||||
# Official Bambu presets: GFx## -> GFSx##
|
||||
# Check if it matches the filament_id pattern (GF followed by letter and digits)
|
||||
if filament_id.startswith("GF") and len(filament_id) >= 4:
|
||||
# Check if it's already a setting_id (has S after GF)
|
||||
if filament_id[2] == "S":
|
||||
return filament_id
|
||||
# Insert "S" after "GF": GFA00 -> GFSA00
|
||||
return f"GFS{filament_id[2:]}"
|
||||
|
||||
return filament_id
|
||||
# _filament_id_to_setting_id is now imported from backend.app.utils.filament_ids
|
||||
_filament_id_to_setting_id = filament_id_to_setting_id
|
||||
|
||||
|
||||
@router.post("/filament-info")
|
||||
|
||||
@@ -30,6 +30,7 @@ from backend.app.schemas.spool import (
|
||||
SpoolUpdate,
|
||||
)
|
||||
from backend.app.schemas.spool_usage import SpoolUsageHistoryResponse
|
||||
from backend.app.utils.filament_ids import normalize_slicer_filament
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -733,8 +734,7 @@ async def assign_spool(
|
||||
tray_type = spool.material
|
||||
tray_sub_brands = f"{spool.material} {spool.subtype}" if spool.subtype else spool.material
|
||||
tray_color = spool.rgba or "FFFFFFFF"
|
||||
tray_info_idx = spool.slicer_filament or ""
|
||||
setting_id = ""
|
||||
tray_info_idx, setting_id = normalize_slicer_filament(spool.slicer_filament)
|
||||
|
||||
# Resolve tray_info_idx for the MQTT command.
|
||||
# Priority:
|
||||
|
||||
Reference in New Issue
Block a user