diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-08-19 15:01:55 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-08-21 18:08:11 -0400 |
commit | 8f85786b3fc0341b966a127406e21b32d98338d3 (patch) | |
tree | a2713360a0dc6ea7b8b015f63e6eee96e8da4c00 | |
parent | 7f82dcb442596959c667d0ed8f19e39af3f94b0d (diff) | |
download | kutter-8f85786b3fc0341b966a127406e21b32d98338d3.tar.gz kutter-8f85786b3fc0341b966a127406e21b32d98338d3.tar.xz kutter-8f85786b3fc0341b966a127406e21b32d98338d3.zip |
gcode_button: Use config.getfloatlist() for analog_range config option
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | klippy/extras/gcode_button.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/klippy/extras/gcode_button.py b/klippy/extras/gcode_button.py index 764ba4a9..669edfb4 100644 --- a/klippy/extras/gcode_button.py +++ b/klippy/extras/gcode_button.py @@ -12,14 +12,10 @@ class GCodeButton: self.pin = config.get('pin') self.last_state = 0 buttons = self.printer.load_object(config, "buttons") - analog_range = config.get('analog_range', None) - if analog_range is None: + if config.get('analog_range', None) is None: buttons.register_buttons([self.pin], self.button_callback) else: - try: - amin, amax = map(float, analog_range.split(',')) - except: - raise config.error("Unable to parse analog_range") + amin, amax = config.getfloatlist('analog_range', count=2) pullup = config.getfloat('analog_pullup_resistor', 4700., above=0.) buttons.register_adc_button(self.pin, amin, amax, pullup, self.button_callback) |