aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/multi_pin.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-07-26 09:44:45 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-07-26 09:44:45 -0400
commit273a98d39a88a372c8a2c816622e7df1f777e77d (patch)
tree2e8d4253f901a093d745127d97fd2464098d9266 /klippy/extras/multi_pin.py
parent7a9553b38a39398226d95b7569a0b889b8cdb10a (diff)
downloadkutter-273a98d39a88a372c8a2c816622e7df1f777e77d.tar.gz
kutter-273a98d39a88a372c8a2c816622e7df1f777e77d.tar.xz
kutter-273a98d39a88a372c8a2c816622e7df1f777e77d.zip
pins: Explicitly pass can_invert and can_pullup to lookup_pin()
Don't pass pin_type to lookup_pin() - instead, if a pin can be inverted or can have a pullup, then the caller must explicitly specify that when calling lookup_pin(). This simplifies the code for the cases where it is not valid to invert or pullup. Explicitly pass the pin_type to setup_pin() and have ppins.setup_pin() apply default pullup and invert flags. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/multi_pin.py')
-rw-r--r--klippy/extras/multi_pin.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/klippy/extras/multi_pin.py b/klippy/extras/multi_pin.py
index f378d400..efa9676a 100644
--- a/klippy/extras/multi_pin.py
+++ b/klippy/extras/multi_pin.py
@@ -15,21 +15,21 @@ class PrinterMultiPin:
self.pin_type = None
self.pin_list = [pin.strip() for pin in config.get('pins').split(',')]
self.mcu_pins = []
- def setup_pin(self, pin_params):
+ def setup_pin(self, pin_type, pin_params):
ppins = self.printer.lookup_object('pins')
pin_name = pin_params['pin']
pin = self.printer.lookup_object('multi_pin ' + pin_name, None)
if pin is not self:
if pin is None:
raise ppins.error("multi_pin %s not configured" % (pin_name,))
- return pin.setup_pin(pin_params)
+ return pin.setup_pin(pin_type, pin_params)
if self.pin_type is not None:
raise ppins.error("Can't setup multi_pin %s twice" % (pin_name,))
- self.pin_type = pin_params['type']
+ self.pin_type = pin_type
invert = ""
if pin_params['invert']:
invert = "!"
- self.mcu_pins = [ppins.setup_pin(self.pin_type, invert + pin_desc)
+ self.mcu_pins = [ppins.setup_pin(pin_type, invert + pin_desc)
for pin_desc in self.pin_list]
return self
def get_mcu(self):