fix(filament): suppress stale slot profile when AMS material family changes #88
Reference in New Issue
Block a user
No description provided.
Delete Branch "walterioo/KX-Bridge-Release:fix/stale-slot-profile-material-guard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The per-slot filament profile override (config.ini
[filament_profiles]) storesonly vendor + name and is sticky: swapping the physical filament updates the AMS
colour and type live, but the saved profile persists. Real case (KX1): a slot
that held "KINGROON PETG Basic" kept showing and sending PETG in the device panel
and the OrcaSlicer lane hint after yellow PLA was loaded — and it survived
restarts, since the override lives in config.ini.
Fix — non-destructive suppression
The override is now applied only while its material family still matches the
material currently loaded in the AMS. PLA / PLA+ / PLA SILK / PLA MATTE are one
family, so within-family swaps never invalidate a valid profile (this also guards
against an over-strict material compare). On a family change the slot falls back
to the generic default; the override is not deleted, so reloading the
original material reactivates it. The profile's material is resolved from the
Orca filament library; when it is unknown we do not suppress (fail-safe).
Wired into the three resolution sites:
handle_kx_filament_slots— the device panel_build_lane_data— the AMS array sent to OrcaSlicer_build_mmu_object—gate_filament_name(Happy-Hare path)Tests
13 new TDD tests (
tests/test_slot_profile_material_guard.py): unit coverage forthe family reduction and the effective-profile resolution, plus in-process
integration for the panel endpoint and the print path. Validated against the live
bridge that user filament profiles resolve their material type correctly, so the
guard fires in production.
A per-slot filament profile override (config.ini [filament_profiles]) stores only {vendor, name, id} and is sticky: swapping the physical filament updates the AMS colour + type live, but the saved profile persisted. Loading yellow PLA into a slot that held "KINGROON PETG Basic" kept showing/sending PETG in the panel and the OrcaSlicer lane hint, and survived restarts (config.ini). Resolve the effective profile per slot as the saved override only when its material *family* still matches the loaded AMS material — PLA / PLA+ / PLA SILK / PLA MATTE are one family, so within-family swaps never invalidate a valid profile (guards against the earlier over-strict material compare). On a family change the override is suppressed (slot falls back to the generic default) but NOT deleted, so re-loading the original material reactivates it. Profile material is resolved from the Orca filament library; unknown → never suppress. Wired into the three resolution sites: handle_kx_filament_slots (panel), _build_lane_data (OrcaSlicer AMS array), _build_mmu_object (gate_filament_name). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>