feat(ams): name the expected slot when a paused print hits an AMS runout (#2587)

The firmware's runout HMS text says "insert into the same AMS slot", which is
wrong under AMS Filament Backup: the firmware won't re-accept the depleted slot
and advances to the next compatible one. Bambuddy parsed print.ams.tray_now only
and dropped tray_tar/tray_pre, so the expected slot never reached the UI.

Capture tray_tar/tray_pre on PrinterState and, while paused, resolve them to
global tray IDs (expected_tray/previous_tray) on both the REST and WebSocket
status payloads via a shared resolver: single-AMS passthrough, multi-AMS
snow-mapping resolution, AMS-HT/external passthrough, and an honest null when the
slot can't be placed. The AMS graphic highlights the expected slot (amber) and
the ran-out slot (red); the HMS modal re-describes runout codes to name both,
falling back to "check the printer" when unresolved. Runout copy translated in
all 11 locales.

Reporter @Jostxxl confirmed tray_pre=1/tray_tar=2 during the pause (ran out in
Slot 2, printer expected Slot 3).
This commit is contained in:
maziggy
2026-07-18 13:06:01 +02:00
parent 8d618678a2
commit e77e10896f
27 changed files with 778 additions and 153 deletions
+8
View File
@@ -522,6 +522,14 @@ export interface PrinterStatus {
fila_switch: FilaSwitchState | null;
// Currently loaded tray (global tray ID, 255 = no filament loaded, 254 = external spool)
tray_now: number;
// Runout / filament-replacement guidance (#2587). Populated only while PAUSED.
// Global tray IDs (ams_id*4+slot, 128-135 = AMS-HT, 254 = external), matching
// the same numbering as tray_now so the AMS graphic can highlight them.
// expected_tray = the slot the firmware now expects filament in (null = idle,
// not paused, or unresolvable → "check the printer").
// previous_tray = the slot that ran out (null = unknown).
expected_tray: number | null;
previous_tray: number | null;
// AMS status for filament change tracking (0=idle, 1=filament_change, 2=rfid_identifying, 3=assist, 4=calibration)
ams_status_main: number;
// AMS sub-status for filament change step (when main=1): 4=retraction, 6=load verification, 7=purge