mirror of
https://github.com/cjfranko/NTP-Timeturner.git
synced 2025-11-08 10:22:02 +00:00
Update test_ltc_serial.py
handles dropframe
This commit is contained in:
parent
04d03b9cbd
commit
fb233880d1
1 changed files with 6 additions and 4 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue