Skip to content

Commit c6dc498

Browse files
authored
Merge pull request #92 from openUC2/mergemaster
adding homing a, minor issue
2 parents 7cae7c2 + 8626bea commit c6dc498

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

uc2rest/UC2Client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,4 @@ def setDebugging(self, debug=False):
196196
self.serial.DEBUG = debug
197197

198198
def close(self):
199-
self.serial.closeDevice()
199+
self.serial.close()

uc2rest/home.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ def home_z(self, speed = None, direction = None, endposrelease = None, endstoppo
4444
endstoppolarity=endstoppolarity,
4545
isBlocking=isBlocking)
4646

47+
def home_a(self, speed = None, direction = None, endposrelease = None, endstoppolarity=None, timeout=None, isBlocking=False):
48+
# axis = 0 corresponds to 'A'
49+
axis = 0
50+
self.home(axis=axis,
51+
timeout=timeout,
52+
speed = speed,
53+
direction = direction,
54+
endposrelease=endposrelease,
55+
endstoppolarity=endstoppolarity,
56+
isBlocking=isBlocking)
57+
4758
def home(self, axis=None, timeout=None, speed=None, direction=None, endposrelease=None, endstoppolarity=None, isBlocking=False):
4859
'''
4960
axis = 0,1,2,3 or 'A, 'X','Y','Z'

uc2rest/mserial.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,11 +409,11 @@ def sendMessage(self, command, nResponses=1, timeout = 20):
409409
self._logger.debug("It takes too long to get a response, we will resend the last command: "+str(self.commands[identifier]))
410410
try:
411411
ERROR="We have a queue, so after a while we need to resend the wrong command!"
412+
iRetry += 1
412413
raise Exception(ERROR)
413414
self.serialdevice.write(json.dumps(self.commands[identifier]).encode('utf-8'))
414415
t0 = time.time()
415416
time.sleep(0.1)
416-
iRetry += 1
417417
except Exception as e:
418418
self._logger.error("Failed to write the line in serial: "+str(e))
419419

@@ -430,6 +430,9 @@ def closeSerial(self):
430430
self.stop()
431431
self.running = False
432432

433+
def close(self):
434+
self.closeSerial()
435+
433436
def reconnect(self, baudrate=None):
434437
self._logger.debug("Reconnecting to the serial device")
435438
self.running = False

0 commit comments

Comments
 (0)