menu_keys: Use config.getfloatlist() for analog_range_ config options
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
ab023bb61d
commit
58dedb6b16
|
@ -44,17 +44,13 @@ class MenuKeys:
|
||||||
if pin is None:
|
if pin is None:
|
||||||
return
|
return
|
||||||
buttons = self.printer.lookup_object("buttons")
|
buttons = self.printer.lookup_object("buttons")
|
||||||
analog_range = config.get('analog_range_' + name, None)
|
if config.get('analog_range_' + name, None) is None:
|
||||||
if analog_range is None:
|
|
||||||
if push_only:
|
if push_only:
|
||||||
buttons.register_button_push(pin, callback)
|
buttons.register_button_push(pin, callback)
|
||||||
else:
|
else:
|
||||||
buttons.register_buttons([pin], callback)
|
buttons.register_buttons([pin], callback)
|
||||||
return
|
return
|
||||||
try:
|
amin, amax = config.getfloatlist('analog_range_' + name, count=2)
|
||||||
amin, amax = map(float, analog_range.split(','))
|
|
||||||
except:
|
|
||||||
raise config.error("Unable to parse analog_range_" + name)
|
|
||||||
pullup = config.getfloat('analog_pullup_resistor', 4700., above=0.)
|
pullup = config.getfloat('analog_pullup_resistor', 4700., above=0.)
|
||||||
if push_only:
|
if push_only:
|
||||||
buttons.register_adc_button_push(pin, amin, amax, pullup, callback)
|
buttons.register_adc_button_push(pin, amin, amax, pullup, callback)
|
||||||
|
|
Loading…
Reference in New Issue