Skip to content

Commit

Permalink
Merge pull request #52 from openUC2/masater_merge
Browse files Browse the repository at this point in the history
adding polarity of homing switch
  • Loading branch information
beniroquai authored Jul 6, 2023
2 parents 46ef6a8 + d1c3bf6 commit 16a2734
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions uc2rest/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,42 @@ def __init__(self, parent):
self.direction = 1
self.speed = 15000
self.timeout = 20000
self.endstoppolarity = 1

def home_x(self, speed = None, direction = None, endposrelease = None, timeout=None, isBlocking=False):
def home_x(self, speed = None, direction = None, endposrelease = None, endstoppolarity=None, timeout=None, isBlocking=False):
# axis = 1 corresponds to 'X'
axis = 1
self.home(axis=axis,
timeout=timeout,
speed = speed,
direction = direction,
endposrelease=endposrelease,
endstoppolarity=endstoppolarity,
isBlocking=isBlocking)

def home_y(self, speed = None, direction = None, endposrelease = None, timeout=None, isBlocking=False):
def home_y(self, speed = None, direction = None, endposrelease = None, endstoppolarity=None, timeout=None, isBlocking=False):
# axis = 2 corresponds to 'Y'
axis = 2
self.home(axis=axis,
timeout=timeout,
speed = speed,
direction = direction,
endposrelease=endposrelease,
endstoppolarity=endstoppolarity,
isBlocking=isBlocking)

def home_z(self, speed = None, direction = None, endposrelease = None, timeout=None, isBlocking=False):
def home_z(self, speed = None, direction = None, endposrelease = None, endstoppolarity=None, timeout=None, isBlocking=False):
# axisa = 3 corresponds to 'Z'
axis = 3
self.home(axis=axis,
timeout=timeout,
speed = speed,
direction = direction,
endposrelease=endposrelease,
endstoppolarity=endstoppolarity,
isBlocking=isBlocking)

def home(self, axis=None, timeout=None, speed=None, direction=None, endposrelease=None, isBlocking=False):
def home(self, axis=None, timeout=None, speed=None, direction=None, endposrelease=None, endstoppolarity=None, isBlocking=False):
'''
axis = 0,1,2,3 or 'A, 'X','Y','Z'
timeout => when to stop homing (it's a while loop on the MCU)
Expand All @@ -58,6 +62,8 @@ def home(self, axis=None, timeout=None, speed=None, direction=None, endposreleas
endposrelease = self.endposrelease
if timeout is None:
timeout = self.timeout
if endstoppolarity is None:
endstoppolarity = self.endstoppolarity

if direction not in [-1,1]:
direction = 1
Expand All @@ -74,7 +80,8 @@ def home(self, axis=None, timeout=None, speed=None, direction=None, endposreleas
"timeout":timeout*1000,
"speed":speed,
"direction":direction,
"endposrelease":endposrelease
"endposrelease":endposrelease,
"endstoppolarity":endstoppolarity
}]
}}

Expand Down

0 comments on commit 16a2734

Please sign in to comment.