Skip to content

Commit b7e2965

Browse files
committed
qtvcp -ACTION: add error return function to touchplate_touchoff
if there was an error no return function was called, only (optionally) if it returned successfully. Now a function to be called on an error can be optionally defined.
1 parent bae6052 commit b7e2965

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

docs/src/gui/qtvcp-libraries.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,9 @@ ACTION.BEEP_START():
376376
377377
ACTION.SET_DISPLAY_MESSAGE(string)
378378
ACTION.SET_ERROR_MESSAGE(string)
379+
380+
ACTION.TOUCHPLATE_TOUCHOFF(search_vel, probe_vel, max_probe,
381+
z_offset, retract_distance, z_safe_travel, rtn_method=None, error_rtn = None)
379382
----
380383

381384
== `Tool`

lib/python/qtvcp/qt_action.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,9 +763,11 @@ def SET_TEMPARARY_MESSAGE(self, msg):
763763
STATUS.emit('error', STATUS.TEMPARARY_MESSAGE, msg)
764764

765765
def TOUCHPLATE_TOUCHOFF(self, search_vel, probe_vel, max_probe,
766-
z_offset, retract_distance, z_safe_travel, rtn_method=None):
766+
z_offset, retract_distance, z_safe_travel, rtn_method=None, error_rtn = None):
767+
767768
# if not none will be called with returned data
768769
self._touchoff_return = rtn_method
770+
self._touchoff_error_return = error_rtn
769771

770772
if self.proc is not None:
771773
return 0
@@ -999,7 +1001,11 @@ def parse_line(self, line):
9991001
# remove preceding text 'ERROR'
10001002
s = line[line.find('ERROR')+6:]
10011003
s = s[s.find(']')+1:]
1002-
self.SET_ERROR_MESSAGE(s)
1004+
if self._touchoff_return is None:
1005+
self.SET_ERROR_MESSAGE(s)
1006+
else:
1007+
self._touchoff_error_return(s)
1008+
10031009
elif "DEBUG" in line: # must set DEBUG level on LOG in top of this file
10041010
LOG.debug(line[line.find('DEBUG')+6:])
10051011

@@ -1012,6 +1018,7 @@ def touchoff_finished(self, exitCode, exitStatus):
10121018
STATUS.unblock_error_polling()
10131019
# clean up return method variable
10141020
self._touchoff_return = None
1021+
self._touchoff_error_return = None
10151022

10161023
#------- boiler code
10171024

0 commit comments

Comments
 (0)