Updated the sync utilities
This commit is contained in:
2
utils/macmaster.py
Normal file → Executable file
2
utils/macmaster.py
Normal file → Executable file
@ -24,7 +24,7 @@ class MasterMACS():
|
||||
def receive(self):
|
||||
buf = self._socke.recv(35, socket.MSG_WAITALL)
|
||||
if len(buf) < 35:
|
||||
raise EOFException('Master MACS returned only %d bytes, 30 expected' % len(buf))
|
||||
raise EOFException('Master MACS returned only %d bytes, 35 expected' % len(buf))
|
||||
idx = buf.find(0x0D)
|
||||
ackbyte = buf[idx-1]
|
||||
if ackbyte == 0x06:
|
||||
|
@ -6,6 +6,7 @@ from a MasterMAC motor controller.
|
||||
Mark Koennecke, February 2023
|
||||
"""
|
||||
import sys
|
||||
import time
|
||||
|
||||
from macmaster import MasterMACS
|
||||
|
||||
@ -33,6 +34,7 @@ def pretty_line(newlist, comma_list):
|
||||
def transact(command):
|
||||
global mac
|
||||
mac.send(command)
|
||||
time.sleep(.1)
|
||||
return mac.receive()
|
||||
|
||||
def fix_line(par_list, index_list):
|
||||
@ -40,18 +42,23 @@ def fix_line(par_list, index_list):
|
||||
addridx = index_list.index('ADDR')
|
||||
motNo = int(par_list[addridx])
|
||||
ack, reply = transact('%dR24' % motNo)
|
||||
idx = reply.find('=')
|
||||
lowlim = reply[idx+1:]
|
||||
lowidx = index_list.index('DLLM')
|
||||
par_list[lowidx] = lowlim.strip()
|
||||
if ack == 'NO':
|
||||
idx = reply.find('=')
|
||||
lowlim = reply[idx+1:]
|
||||
lowidx = index_list.index('DLLM')
|
||||
par_list[lowidx] = lowlim.strip()
|
||||
ack, reply = transact('%dR23' % motNo)
|
||||
idx = reply.find('=')
|
||||
highlim = reply[idx+1:]
|
||||
highidx = index_list.index('DHLM')
|
||||
par_list[highidx] = highlim.strip()
|
||||
# speed = transact('Q%d03' % motNo)
|
||||
# speedidx = index_list['VELO']
|
||||
# par_list[speedidx] = speed.trim()
|
||||
if ack == 'NO':
|
||||
idx = reply.find('=')
|
||||
highlim = reply[idx+1:]
|
||||
highidx = index_list.index('DHLM')
|
||||
par_list[highidx] = highlim.strip()
|
||||
ack, reply = transact('%dR05' % motNo)
|
||||
if ack == 'NO':
|
||||
idx = reply.find('=')
|
||||
speed = reply[idx+1:]
|
||||
speedidx = index_list.index('VELO')
|
||||
par_list[speedidx] = speed.strip()
|
||||
return par_list
|
||||
|
||||
def scan_substitution_file(filename):
|
||||
|
Reference in New Issue
Block a user