diff --git a/dimensions_cli_client.py b/dimensions_cli_client.py index 9cd6e8b..56c6263 100644 --- a/dimensions_cli_client.py +++ b/dimensions_cli_client.py @@ -311,17 +311,36 @@ def portal_mode(server_ip, port): def on_tag_remove(tag: TagInfo): print(f"[-] TAG REMOVED from {tag.pad.name} pad") + # Check if removed tag had a cycle effect (affects all pads) + removed_key = active_pads.get(tag.pad.value) + was_cycle = False + if removed_key is not None: + config = TAG_COLORS.get(removed_key, DEFAULT_TAG_COLOR) + was_cycle = config.get('effect', 'solid') == 'cycle' + # Remove from active tracking if tag.pad.value in active_pads: del active_pads[tag.pad.value] - # Stop any effects and turn off ONLY this pad's LED (not all pads!) if reader: # Stop cycle effect if running (it uses all pads) reader.stop_cycle_effect() - # Stop individual pad effect and turn off + # Stop individual pad effect and turn off the removed pad reader.stop_effect(tag.pad) reader.set_pad_color(tag.pad, COLORS['OFF']) + + # If a cycle effect was running, restore all other pads + if was_cycle: + for pad_enum in [Pad.CENTER, Pad.LEFT, Pad.RIGHT]: + if pad_enum == tag.pad: + continue # Already handled above + if pad_enum.value in active_pads: + # Pad has an active tag - re-apply its theme + apply_tag_color(pad_enum, active_pads[pad_enum.value]) + else: + # No tag on this pad - turn it off + reader.stop_effect(pad_enum) + reader.set_pad_color(pad_enum, COLORS['OFF']) def on_connect(): print("✓ Portal connected and initialized")