mirror of https://github.com/Desuuuu/klipper.git
mcu: Raise a config error on an invalid pin name in the config file
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
ce7e7c4048
commit
3806ed882a
|
@ -34,6 +34,7 @@ Printer is shutdown
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class ConfigWrapper:
|
class ConfigWrapper:
|
||||||
|
error = ConfigParser.Error
|
||||||
def __init__(self, printer, section):
|
def __init__(self, printer, section):
|
||||||
self.printer = printer
|
self.printer = printer
|
||||||
self.section = section
|
self.section = section
|
||||||
|
|
|
@ -399,8 +399,14 @@ class MCU:
|
||||||
pnames = pins.mcu_to_pins(mcu)
|
pnames = pins.mcu_to_pins(mcu)
|
||||||
else:
|
else:
|
||||||
pnames = pins.map_pins(pin_map, mcu)
|
pnames = pins.map_pins(pin_map, mcu)
|
||||||
self._config_cmds = [pins.update_command(c, pnames)
|
updated_cmds = []
|
||||||
for c in self._config_cmds]
|
for cmd in self._config_cmds:
|
||||||
|
try:
|
||||||
|
updated_cmds.append(pins.update_command(cmd, pnames))
|
||||||
|
except:
|
||||||
|
raise self._config.error("Unable to translate pin name: %s" % (
|
||||||
|
cmd,))
|
||||||
|
self._config_cmds = updated_cmds
|
||||||
|
|
||||||
# Calculate config CRC
|
# Calculate config CRC
|
||||||
self._config_crc = zlib.crc32('\n'.join(self._config_cmds)) & 0xffffffff
|
self._config_crc = zlib.crc32('\n'.join(self._config_cmds)) & 0xffffffff
|
||||||
|
|
Loading…
Reference in New Issue