From 53565a8652e83d39390e676f32e33e727dbf97a2 Mon Sep 17 00:00:00 2001 From: Chris Frankland-Wright <85807217+cjfranko@users.noreply.github.com> Date: Mon, 7 Jul 2025 20:23:28 +0100 Subject: [PATCH] final test_ltc_serial.py --- test_ltc_serial.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/test_ltc_serial.py b/test_ltc_serial.py index d1b84bf..278d272 100644 --- a/test_ltc_serial.py +++ b/test_ltc_serial.py @@ -1,8 +1,3 @@ -# -*- coding: utf-8 -*- -import sys -if hasattr(sys.stdout, "reconfigure"): - sys.stdout.reconfigure(encoding='utf-8') - import serial import re @@ -16,10 +11,10 @@ ltc_pattern = re.compile( ) def main(): - print(f"šŸ”Œ Connecting to serial port: {SERIAL_PORT} @ {BAUD_RATE} baud") + print(f"[INFO] Connecting to serial port: {SERIAL_PORT} @ {BAUD_RATE} baud") try: with serial.Serial(SERIAL_PORT, BAUD_RATE, timeout=1) as ser: - print("šŸ“” Listening for LTC messages...\n") + print("[INFO] Listening for LTC messages...\n") while True: line = ser.readline().decode(errors='ignore').strip() match = ltc_pattern.match(line) @@ -27,16 +22,16 @@ def main(): status, timecode, framerate = match.groups() framerate = framerate.upper() if status == "LOCK": - print(f"šŸ”’ {status:<4} | ā± {timecode} | šŸŽž {framerate}") + print(f"[LOCK] {status:<4} | Timecode: {timecode} | Rate: {framerate}") else: - print(f"🟔 {status:<4} | ā± {timecode} | šŸŽž {framerate}") + print(f"[FREE] {status:<4} | Timecode: {timecode} | Rate: {framerate}") else: if line: - print(f"āš ļø Unrecognised line: {line}") + print(f"[WARN] Unrecognised line: {line}") except serial.SerialException as e: - print(f"āŒ Serial error: {e}") + print(f"[ERROR] Serial error: {e}") except KeyboardInterrupt: - print("\nšŸ›‘ Stopped by user.") + print("\n[EXIT] Stopped by user.") if __name__ == "__main__": main()