From fb233880d172ce2087e3d93c552de6e8a8ed64a5 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright <85807217+cjfranko@users.noreply.github.com> Date: Mon, 7 Jul 2025 19:58:42 +0100 Subject: [PATCH] Update test_ltc_serial.py handles dropframe --- test_ltc_serial.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test_ltc_serial.py b/test_ltc_serial.py index 0b529aa..464a52b 100644 --- a/test_ltc_serial.py +++ b/test_ltc_serial.py @@ -1,12 +1,14 @@ import serial import re -# Adjust this as needed +# Adjust as needed SERIAL_PORT = "/dev/ttyACM0" BAUD_RATE = 115200 -# Case-insensitive pattern for: [LOCK] 10:00:00:00 | 25.00fps or FPS -ltc_pattern = re.compile(r"\[(LOCK|FREE)\]\s+(\d{2}:\d{2}:\d{2}:\d{2})\s+\|\s+([\d.]+fps)", re.IGNORECASE) +# Updated pattern to match drop-frame (;) and non-drop (:) timecode +ltc_pattern = re.compile( + r"\[(LOCK|FREE)\]\s+(\d{2}:\d{2}:\d{2}[:;]\d{2})\s+\|\s+([\d.]+fps)", re.IGNORECASE +) def main(): print(f"🔌 Connecting to serial port: {SERIAL_PORT} @ {BAUD_RATE} baud") @@ -18,7 +20,7 @@ def main(): match = ltc_pattern.match(line) if match: status, timecode, framerate = match.groups() - framerate = framerate.upper() # Standardise to FPS + framerate = framerate.upper() if status == "LOCK": print(f"🔒 {status:<4} | ⏱ {timecode} | 🎞 {framerate}") else: