Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions hardwarelibrary/motion/sutterdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class SutterDevice(LinearMotionDevice):
replyDataLength=1, unpackingMask='<c'),
"GET_POSITION": DataCommand(name="GET_POSITION", prefix=b'C',
data=pack('<cc', b'C', b'\r'),
replyDataLength=14, unpackingMask='<xlllx',
responseFormat='<clllc',
responseFields=('header', 'x', 'y', 'z', 'terminator')),
replyDataLength=13, unpackingMask='<lllx',
responseFormat='<lllc',
responseFields=('x', 'y', 'z', 'terminator')),
"HOME": DataCommand(name="HOME", prefix=b'H',
data=pack('<cc', b'H', b'\r'),
replyDataLength=1, unpackingMask='<c'),
Expand Down Expand Up @@ -172,8 +172,7 @@ def process_command(self, name, params, endPointIndex):
self.zSteps = params['z']
return b'\r'
elif name == 'GET_POSITION':
return {'header': b'c', 'x': self.xSteps,
'y': self.ySteps, 'z': self.zSteps,
return {'x': self.xSteps, 'y': self.ySteps, 'z': self.zSteps,
'terminator': b'\r'}
elif name == 'HOME':
self.xSteps = self.ySteps = self.zSteps = 0
Expand Down
4 changes: 2 additions & 2 deletions hardwarelibrary/tests/testSutterSerialPort.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def testMoveGet(self):

payload = bytearray('c',encoding='utf-8')
self.port.writeData(payload)
data = self.port.readData(length=1 + 4*3 + 1)
(x,y,z) = unpack("<xlllx", data)
data = self.port.readData(length=4*3 + 1)
(x,y,z) = unpack("<lllx", data)
self.assertTrue( x == 1)
self.assertTrue( y == 2)
self.assertTrue( z == 3)
Expand Down