mirror of https://github.com/Desuuuu/klipper.git
pins: Improve pin description checks
Make sure whitespace isn't in the pin description. Also make sure an alias doesn't map to an invalid pin. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
c263f76f9f
commit
a94146b554
|
@ -30,6 +30,8 @@ class PinResolver:
|
|||
if alias in self.aliases and self.aliases[alias] != pin:
|
||||
raise error("Alias %s mapped to %s - can't alias to %s" % (
|
||||
alias, self.aliases[alias], pin))
|
||||
if [c for c in '^~!:' if c in pin] or ''.join(pin.split()) != pin:
|
||||
raise error("Invalid pin alias '%s'\n" % (pin,))
|
||||
if pin in self.aliases:
|
||||
pin = self.aliases[pin]
|
||||
self.aliases[alias] = pin
|
||||
|
@ -79,7 +81,7 @@ class PrinterPins:
|
|||
chip_name, pin = [s.strip() for s in desc.split(':', 1)]
|
||||
if chip_name not in self.chips:
|
||||
raise error("Unknown pin chip name '%s'" % (chip_name,))
|
||||
if [c for c in '^~!: ' if c in pin]:
|
||||
if [c for c in '^~!:' if c in pin] or ''.join(pin.split()) != pin:
|
||||
format = ""
|
||||
if can_pullup:
|
||||
format += "[^~] "
|
||||
|
|
Loading…
Reference in New Issue