mirror of
https://github.com/cjfranko/NTP-Timeturner.git
synced 2025-11-08 18:32:02 +00:00
feat: add mock Teensy support with entrypoint and LTC generator
Co-authored-by: aider (openai/gpt-5) <aider@aider.chat>
This commit is contained in:
parent
ddbdf8cb72
commit
f855cac040
4 changed files with 76 additions and 0 deletions
43
scripts/ltc_gen.sh
Normal file
43
scripts/ltc_gen.sh
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
# Simple LTC-like line generator to feed into a PTY for development.
|
||||
# It outputs lines like: "LOCK HH:MM:SS;FF 25.00"
|
||||
# Configure frames-per-second via LTC_FPS environment variable (23,24,25,29,30 supported).
|
||||
FPS="${LTC_FPS:-25}"
|
||||
|
||||
case "$FPS" in
|
||||
23) PERIOD="0.0417083"; RATE_STR="23.98" ;;
|
||||
24) PERIOD="0.0416667"; RATE_STR="24.00" ;;
|
||||
25) PERIOD="0.0400000"; RATE_STR="25.00" ;;
|
||||
29) PERIOD="0.0333667"; RATE_STR="29.97" ;;
|
||||
30) PERIOD="0.0333333"; RATE_STR="30.00" ;;
|
||||
*) PERIOD="0.0400000"; RATE_STR="25.00"; FPS="25" ;;
|
||||
esac
|
||||
|
||||
h=12
|
||||
m=0
|
||||
s=0
|
||||
f=0
|
||||
|
||||
while true; do
|
||||
printf "LOCK %02d:%02d:%02d;%02d %s\r\n" "$h" "$m" "$s" "$f" "$RATE_STR"
|
||||
|
||||
# increment frame
|
||||
f=$((f+1))
|
||||
if [ "$f" -ge "$FPS" ]; then
|
||||
f=0
|
||||
s=$((s+1))
|
||||
if [ "$s" -ge 60 ]; then
|
||||
s=0
|
||||
m=$((m+1))
|
||||
if [ "$m" -ge 60 ]; then
|
||||
m=0
|
||||
h=$(( (h + 1) % 24 ))
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# sleep to approximate frame cadence
|
||||
sleep "$PERIOD"
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue