mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-15 18:58:03 -06:00
pins: Check if the same pin is referenced via different aliases
Change the update_command() call to use a new PinResolver class. In that new class, verify that the same pin isn't referenced in two different parts of the config using different aliases for the pin. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
df6528715e
commit
3833669c3a
3 changed files with 37 additions and 28 deletions
|
@ -522,15 +522,14 @@ class MCU:
|
|||
self._oid_count,))
|
||||
|
||||
# Resolve pin names
|
||||
mcu = self._serial.msgparser.get_constant('MCU')
|
||||
pnames = pins.get_pin_map(mcu, self._pin_map)
|
||||
updated_cmds = []
|
||||
for cmd in self._config_cmds:
|
||||
try:
|
||||
updated_cmds.append(pins.update_command(cmd, pnames))
|
||||
except:
|
||||
raise pins.error("Unable to translate pin name: %s" % (cmd,))
|
||||
self._config_cmds = updated_cmds
|
||||
mcu_type = self._serial.msgparser.get_constant('MCU')
|
||||
pin_resolver = pins.PinResolver(mcu_type)
|
||||
if self._pin_map is not None:
|
||||
pin_resolver.update_aliases(self._pin_map)
|
||||
for i, cmd in enumerate(self._config_cmds):
|
||||
self._config_cmds[i] = pin_resolver.update_command(cmd)
|
||||
for i, cmd in enumerate(self._init_cmds):
|
||||
self._init_cmds[i] = pin_resolver.update_command(cmd)
|
||||
|
||||
# Calculate config CRC
|
||||
self._config_crc = zlib.crc32('\n'.join(self._config_cmds)) & 0xffffffff
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue