mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-18 03:54:17 +02:00
Fix stale AMS slot data and empty slot button visibility (#784)
Some printers (e.g. H2D) only send {id, state} in incremental MQTT
tray updates — no tray_type, tray_color, or other fields. When
filament is unloaded (state changes from 11 to 10), the old tray
data persisted indefinitely because the merge logic only updates
fields present in the incoming message.
Backend:
- Detect tray state != 11 without tray_type in incremental updates
and clear stale tray data (bambu_mqtt.py)
- Expose tray `state` field via REST API and WebSocket broadcasts
(printer.py schema, printers.py route, printer_manager.py)
- Include AMS tray content in WebSocket dedup key so load/unload
transitions trigger broadcasts (main.py)
Frontend:
- Add `state` to AMSTray interface (client.ts)
- Show configure/assign buttons for state=10 (spool present, not
loaded) but hide for state=9 (truly empty) on AMS/HT slots
- Hide fill level bar on empty slots
Tests:
- 5 new tests covering state-based clearing, preservation, reload,
and idempotency
This commit is contained in:
@@ -129,6 +129,7 @@ export interface AMSTray {
|
||||
nozzle_temp_max: number | null; // Max nozzle temperature
|
||||
drying_temp: number | null; // RFID-recommended drying temp
|
||||
drying_time: number | null; // RFID-recommended drying time (hours)
|
||||
state: number | null; // AMS tray state: 9=empty, 10=spool present not loaded, 11=loaded
|
||||
}
|
||||
|
||||
export interface AMSUnit {
|
||||
|
||||
Reference in New Issue
Block a user