From 775566d57a9bab95a3740f54bfb35aaffe3e3729 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Fri, 5 Jun 2026 15:45:54 +0200 Subject: [PATCH] frappy_psi.trinamic: fix handling with no limit switches --- cfg/uniax_cfg.py | 1 + frappy_psi/trinamic.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cfg/uniax_cfg.py b/cfg/uniax_cfg.py index 927ad90f..a7c703e1 100644 --- a/cfg/uniax_cfg.py +++ b/cfg/uniax_cfg.py @@ -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', diff --git a/frappy_psi/trinamic.py b/frappy_psi/trinamic.py index 0a63161d..1d5a1adf 100644 --- a/frappy_psi/trinamic.py +++ b/frappy_psi/trinamic.py @@ -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):