diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-01-10 18:34:42 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-01-10 19:26:06 -0500 |
commit | 3833669c3a41a26e944ffe891cc259ceaf2b9de0 (patch) | |
tree | 5a692dad035fba835d582f2755b0cc8ad463cdb7 /klippy/console.py | |
parent | df6528715e86305d77456efb8b76dad734ffda9f (diff) | |
download | kutter-3833669c3a41a26e944ffe891cc259ceaf2b9de0.tar.gz kutter-3833669c3a41a26e944ffe891cc259ceaf2b9de0.tar.xz kutter-3833669c3a41a26e944ffe891cc259ceaf2b9de0.zip |
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>
Diffstat (limited to 'klippy/console.py')
-rwxr-xr-x | klippy/console.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/klippy/console.py b/klippy/console.py index c862ba9e..cd7facfd 100755 --- a/klippy/console.py +++ b/klippy/console.py @@ -55,8 +55,8 @@ class KeyboardReader: self.clocksync.connect(self.ser) self.ser.handle_default = self.handle_default self.mcu_freq = self.ser.msgparser.get_constant_float('CLOCK_FREQ') - mcu = self.ser.msgparser.get_constant('MCU') - self.pins = pins.get_pin_map(mcu) + mcu_type = self.ser.msgparser.get_constant('MCU') + self.pins = pins.PinResolver(mcu_type, validate_aliases=False) self.reactor.unregister_timer(self.connect_timer) self.output("="*20 + " connected " + "="*20) return self.reactor.NEVER @@ -71,8 +71,7 @@ class KeyboardReader: self.eval_globals['freq'] = self.mcu_freq self.eval_globals['clock'] = self.clocksync.get_clock(eventtime) def command_PINS(self, parts): - mcu = self.ser.msgparser.get_constant('MCU') - self.pins = pins.get_pin_map(mcu, parts[1]) + self.pins.update_aliases(parts[1]) def command_SET(self, parts): val = parts[2] try: @@ -156,7 +155,7 @@ class KeyboardReader: self.output("Eval: %s" % (line,)) if self.pins is not None: try: - line = pins.update_command(line, self.pins).strip() + line = self.pins.update_command(line).strip() except: self.output("Unable to map pin: %s" % (line,)) return None |