Change time setting scripts to use new watch model setup

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