frappy_psi.trinamic: fix handling with no limit switches

This commit is contained in:
2026-06-05 15:45:54 +02:00
parent a58bec0201
commit 775566d57a
2 changed files with 10 additions and 5 deletions
+1
View File
@@ -24,6 +24,7 @@ Mod('drv',
encoder_tolerance=3.6,
free_wheeling=0.1,
power_down_delay=0.1,
has_limit_switches=False,
)
Mod('transducer',
+9 -5
View File
@@ -159,7 +159,7 @@ class Motor(PersistentMixin, HasIO, Drivable):
has_home = Parameter('enable home and activate pullup resistor', BoolType(), export=True,
default=False, group='more')
has_limit_switches = Parameter('enable limit switches and activate pullup resistor',
BoolType(), default=False, group='motorparam')
BoolType(), value=False, readonly=False, group='motorparam')
disable_right_switch = writable('disable right limit switch', BoolType(), group='motorparam')
disable_left_switch = writable('disable left limit switch', BoolType(), group='motorparam')
has_inputs = Parameter('inputs are polled', BoolType(), group='more', default=False)
@@ -505,10 +505,14 @@ class Motor(PersistentMixin, HasIO, Drivable):
self.write_pullup_inputs(True)
def write_has_limit_switches(self, value):
self.has_inputs = True
self.write_pullup_inputs(True)
self.write_disable_left_switch(False)
self.write_disable_right_switch(False)
if value:
self.has_inputs = True
self.write_pullup_inputs(True)
self.write_disable_left_switch(False)
self.write_disable_right_switch(False)
else:
self.write_disable_left_switch(True)
self.write_disable_right_switch(True)
@Command(FloatRange())
def set_zero(self, value):