Scripts to set time on Datalink model 70 and 150

This commit is contained in:
Simon Larsson
2021-08-13 16:46:32 +02:00
parent 335cc484f7
commit 423ddfca88
2 changed files with 80 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
# Sends current time to Datalink model 150
import sys
import pytimex
print("Looking for blaster...")
try:
port = sys.argv[1]
except:
port = "/dev/ttyACM0"
# Initialize blaster
blaster = pytimex.Blaster(port)
# Setup data to be sent
d = pytimex.TimexData(model=pytimex.WatchModels.DL150)
# Setup two timezones
d.setTimezone(1, +2, 24, "cet")
d.setTimezone(2, 0, 24, "utc")
d.sendTime = True
# Offset adjustment
d.secondsOffset=3
# Get data to be transferred
data = bytes(d)
print("Sending data...")
# Send synchronization bytes (0x55 and 0xAA)
blaster.send_sync(times55sync=40, timesAAsync=16)
# Blast data
for databyte in data:
blaster.blast(databyte)
print("Done!")
+41
View File
@@ -0,0 +1,41 @@
# Sends current time to Datalink model 70
import sys
import pytimex
print("Looking for blaster...")
try:
port = sys.argv[1]
except:
port = "/dev/ttyACM0"
# Initialize blaster
blaster = pytimex.Blaster(port)
# Setup data to be sent
d = pytimex.TimexData(model=pytimex.WatchModels.DL70)
# Setup two timezones
d.setTimezone(1, +2, 24, "cet")
d.setTimezone(2, 0, 24, "utc")
d.sendTime = True
# Offset adjustment
# The model 70 seems to need a bit more sync than
# the 150, so add a bit more offset
d.secondsOffset=4
# Get data to be transferred
data = bytes(d)
print("Sending data...")
# Send synchronization bytes (0x55 and 0xAA)
blaster.send_sync(times55sync=180, timesAAsync=16)
# Blast data
for databyte in data:
blaster.blast(databyte)
print("Done!")