aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/gcode_button.py
diff options
context:
space:
mode:
Diffstat (limited to 'klippy/extras/gcode_button.py')
-rw-r--r--klippy/extras/gcode_button.py8
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)