mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-18 21:47:39 +02:00
feat: dual external spool support, AMS slot model filtering & pre-population
Backend: - Add dual external spool support for H2D (vt_tray as list: Ext-L/Ext-R) - Add cloud filament ID map endpoint (/cloud/filament-id-map) - Fix RFID spool data erased by periodic AMS updates (skip tag matcher for RFID-tagged trays) - Fix AMS slot config overwrites RFID spool state - Fix K-profile selection corrupts existing profiles on X1C/P1S - Resolve K-profiles filament name via cloud filament ID map - Update print scheduler and usage tracker for dual external spools Frontend: - Add printer model filtering to ConfigureAmsSlotModal (cloud/local/builtin presets filtered by @BBL model suffix and compatible_printers) - Add pre-population for configured slots (preset, color, K-profile) - Add K-Profiles view with accurate filament name resolution - Internationalize all ConfigureAmsSlotModal strings (en/de/fr/it/ja — 21 keys) - Add 5 new ConfigureAmsSlotModal tests (model filtering, pre-selection, color pre-population, i18n) - Update PrintersPage for dual external spool rendering Docs: - Update CHANGELOG, README, website features, and wiki AMS docs
This commit is contained in:
@@ -502,7 +502,7 @@ def printer_state_to_dict(state: PrinterState, printer_id: int | None = None, mo
|
||||
"""
|
||||
# Parse AMS data from raw_data
|
||||
ams_units = []
|
||||
vt_tray = None
|
||||
vt_tray = []
|
||||
raw_data = state.raw_data or {}
|
||||
|
||||
# Build K-profile lookup map: cali_idx -> k_value
|
||||
@@ -578,37 +578,40 @@ def printer_state_to_dict(state: PrinterState, printer_id: int | None = None, mo
|
||||
}
|
||||
)
|
||||
|
||||
# Parse virtual tray (external spool)
|
||||
# Parse virtual tray (external spool) — now a list
|
||||
if "vt_tray" in raw_data:
|
||||
vt_data = raw_data["vt_tray"]
|
||||
vt_tag_uid = vt_data.get("tag_uid")
|
||||
if vt_tag_uid in ("", "0000000000000000"):
|
||||
vt_tag_uid = None
|
||||
vt_tray_uuid = vt_data.get("tray_uuid")
|
||||
if vt_tray_uuid in ("", "00000000000000000000000000000000"):
|
||||
vt_tray_uuid = None
|
||||
for vt_data in raw_data["vt_tray"]:
|
||||
vt_tag_uid = vt_data.get("tag_uid")
|
||||
if vt_tag_uid in ("", "0000000000000000"):
|
||||
vt_tag_uid = None
|
||||
vt_tray_uuid = vt_data.get("tray_uuid")
|
||||
if vt_tray_uuid in ("", "00000000000000000000000000000000"):
|
||||
vt_tray_uuid = None
|
||||
|
||||
# Get K value for vt_tray
|
||||
vt_k_value = vt_data.get("k")
|
||||
vt_cali_idx = vt_data.get("cali_idx")
|
||||
if vt_k_value is None and vt_cali_idx is not None and vt_cali_idx in kprofile_map:
|
||||
vt_k_value = kprofile_map[vt_cali_idx]
|
||||
# Get K value for vt_tray
|
||||
vt_k_value = vt_data.get("k")
|
||||
vt_cali_idx = vt_data.get("cali_idx")
|
||||
if vt_k_value is None and vt_cali_idx is not None and vt_cali_idx in kprofile_map:
|
||||
vt_k_value = kprofile_map[vt_cali_idx]
|
||||
|
||||
vt_tray = {
|
||||
"id": 254,
|
||||
"tray_color": vt_data.get("tray_color"),
|
||||
"tray_type": vt_data.get("tray_type"),
|
||||
"tray_sub_brands": vt_data.get("tray_sub_brands"),
|
||||
"tray_id_name": vt_data.get("tray_id_name"),
|
||||
"tray_info_idx": vt_data.get("tray_info_idx"),
|
||||
"remain": vt_data.get("remain", 0),
|
||||
"k": vt_k_value,
|
||||
"cali_idx": vt_cali_idx,
|
||||
"tag_uid": vt_tag_uid,
|
||||
"tray_uuid": vt_tray_uuid,
|
||||
"nozzle_temp_min": vt_data.get("nozzle_temp_min"),
|
||||
"nozzle_temp_max": vt_data.get("nozzle_temp_max"),
|
||||
}
|
||||
tray_id = int(vt_data.get("id", 254))
|
||||
vt_tray.append(
|
||||
{
|
||||
"id": tray_id,
|
||||
"tray_color": vt_data.get("tray_color"),
|
||||
"tray_type": vt_data.get("tray_type"),
|
||||
"tray_sub_brands": vt_data.get("tray_sub_brands"),
|
||||
"tray_id_name": vt_data.get("tray_id_name"),
|
||||
"tray_info_idx": vt_data.get("tray_info_idx"),
|
||||
"remain": vt_data.get("remain", 0),
|
||||
"k": vt_k_value,
|
||||
"cali_idx": vt_cali_idx,
|
||||
"tag_uid": vt_tag_uid,
|
||||
"tray_uuid": vt_tray_uuid,
|
||||
"nozzle_temp_min": vt_data.get("nozzle_temp_min"),
|
||||
"nozzle_temp_max": vt_data.get("nozzle_temp_max"),
|
||||
}
|
||||
)
|
||||
|
||||
# Get ams_extruder_map from raw_data (populated by MQTT handler from AMS info field)
|
||||
ams_extruder_map = raw_data.get("ams_extruder_map", {})
|
||||
|
||||
Reference in New Issue
Block a user