mirror of https://github.com/Desuuuu/klipper.git
tmc_uart: Use config.getlist() for select_pins config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
31564f3b43
commit
fe1b2f5124
|
@ -1,6 +1,6 @@
|
|||
# Helper code for communicating with TMC stepper drivers via UART
|
||||
#
|
||||
# Copyright (C) 2018-2019 Kevin O'Connor <kevin@koconnor.net>
|
||||
# Copyright (C) 2018-2021 Kevin O'Connor <kevin@koconnor.net>
|
||||
#
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
import logging
|
||||
|
@ -16,7 +16,7 @@ class MCU_analog_mux:
|
|||
self.cmd_queue = cmd_queue
|
||||
ppins = mcu.get_printer().lookup_object("pins")
|
||||
select_pin_params = [ppins.lookup_pin(spd, can_invert=True)
|
||||
for spd in select_pins_desc.split(',')]
|
||||
for spd in select_pins_desc]
|
||||
self.oids = [self.mcu.create_oid() for pp in select_pin_params]
|
||||
self.pins = [pp['pin'] for pp in select_pin_params]
|
||||
self.pin_values = tuple([-1 for pp in select_pin_params])
|
||||
|
@ -32,7 +32,7 @@ class MCU_analog_mux:
|
|||
def get_instance_id(self, select_pins_desc):
|
||||
ppins = self.mcu.get_printer().lookup_object("pins")
|
||||
select_pin_params = [ppins.parse_pin(spd, can_invert=True)
|
||||
for spd in select_pins_desc.split(',')]
|
||||
for spd in select_pins_desc]
|
||||
for pin_params in select_pin_params:
|
||||
if pin_params['chip'] != self.mcu:
|
||||
raise self.mcu.get_printer().config_error(
|
||||
|
@ -188,8 +188,8 @@ class MCU_TMC_uart_bitbang:
|
|||
# Lookup a (possibly shared) tmc uart
|
||||
def lookup_tmc_uart_bitbang(config, max_addr):
|
||||
ppins = config.get_printer().lookup_object("pins")
|
||||
rx_pin_params = ppins.lookup_pin(
|
||||
config.get('uart_pin'), can_pullup=True, share_type="tmc_uart_rx")
|
||||
rx_pin_params = ppins.lookup_pin(config.get('uart_pin'), can_pullup=True,
|
||||
share_type="tmc_uart_rx")
|
||||
tx_pin_desc = config.get('tx_pin', None)
|
||||
if tx_pin_desc is None:
|
||||
tx_pin_params = rx_pin_params
|
||||
|
@ -197,7 +197,7 @@ def lookup_tmc_uart_bitbang(config, max_addr):
|
|||
tx_pin_params = ppins.lookup_pin(tx_pin_desc, share_type="tmc_uart_tx")
|
||||
if rx_pin_params['chip'] is not tx_pin_params['chip']:
|
||||
raise ppins.error("TMC uart rx and tx pins must be on the same mcu")
|
||||
select_pins_desc = config.get('select_pins', None)
|
||||
select_pins_desc = config.getlist('select_pins', None)
|
||||
addr = config.getint('uart_address', 0, minval=0, maxval=max_addr)
|
||||
mcu_uart = rx_pin_params.get('class')
|
||||
if mcu_uart is None:
|
||||
|
|
Loading…
Reference in New Issue