diff --git a/klippy/chipmisc.py b/klippy/chipmisc.py index 575f0664..f28361a9 100644 --- a/klippy/chipmisc.py +++ b/klippy/chipmisc.py @@ -10,13 +10,6 @@ import pins # Output pins ###################################################################### -class PrinterStaticDigitalOut: - def __init__(self, printer, config): - pin_list = [pin.strip() for pin in config.get('pins').split(',')] - for pin_desc in pin_list: - mcu_pin = pins.setup_pin(printer, 'digital_out', pin_desc) - mcu_pin.setup_start_value(1, 1, True) - PIN_MIN_TIME = 0.100 class PrinterPin: @@ -80,8 +73,6 @@ class PrinterPin: ###################################################################### def add_printer_objects(printer, config): - for s in config.get_prefix_sections('static_digital_output '): - printer.add_object(s.section, PrinterStaticDigitalOut(printer, s)) for s in config.get_prefix_sections('digital_output '): printer.add_object('pin' + s.section[14:], PrinterPin(printer, s)) for s in config.get_prefix_sections('static_pwm_output '): diff --git a/klippy/extras/static_digital_output.py b/klippy/extras/static_digital_output.py new file mode 100644 index 00000000..bd494f6f --- /dev/null +++ b/klippy/extras/static_digital_output.py @@ -0,0 +1,17 @@ +# Set the state of a list of digital output pins +# +# Copyright (C) 2017-2018 Kevin O'Connor +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +class PrinterStaticDigitalOut: + def __init__(self, config): + printer = config.get_printer() + ppins = printer.lookup_object('pins') + pin_list = [pin.strip() for pin in config.get('pins').split(',')] + for pin_desc in pin_list: + mcu_pin = ppins.setup_pin('digital_out', pin_desc) + mcu_pin.setup_start_value(1, 1, True) + +def load_config_prefix(config): + return PrinterStaticDigitalOut(config)