diff options
Diffstat (limited to 'klippy/extras/gcode_button.py')
-rw-r--r-- | klippy/extras/gcode_button.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/klippy/extras/gcode_button.py b/klippy/extras/gcode_button.py index 669edfb4..de280c98 100644 --- a/klippy/extras/gcode_button.py +++ b/klippy/extras/gcode_button.py @@ -5,6 +5,7 @@ # This file may be distributed under the terms of the GNU GPLv3 license. import logging + class GCodeButton: def __init__(self, config): self.printer = config.get_printer() @@ -13,12 +14,13 @@ class GCodeButton: self.last_state = 0 buttons = self.printer.load_object(config, "buttons") if config.get('analog_range', None) is None: - buttons.register_buttons([self.pin], self.button_callback) + buttons.register_debounce_button(self.pin, self.button_callback + , config) else: 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) + buttons.register_debounce_adc_button(self.pin, amin, amax, pullup, + self.button_callback, config) gcode_macro = self.printer.load_object(config, 'gcode_macro') self.press_template = gcode_macro.load_template(config, 'press_gcode') self.release_template = gcode_macro.load_template(config, |