diff --git a/scripts/led-matrix-viz.py b/scripts/led-matrix-viz.py index 19d2dab..a67deca 100644 --- a/scripts/led-matrix-viz.py +++ b/scripts/led-matrix-viz.py @@ -104,10 +104,17 @@ def main(): pass while b";" in buf: - msg, buf = buf.split(b";", 1) - msg = msg.decode().strip() + raw_msg, buf = buf.split(b";", 1) + msg = raw_msg.decode().strip() parts = msg.split() - if len(parts) >= 3 and parts[0] == "midi": + if not parts: + continue + if parts[0] != "midi": + print(f"[viz] skipping: {msg!r}", flush=True) + continue + if len(parts) < 3: + print(f"[viz] too short: {parts}", flush=True) + continue status = int(parts[1]) note = int(parts[2]) vel = int(parts[3]) if len(parts) >= 4 else 0