mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-11 16:57:55 -06:00
query_adc: Add a new module to help query and debug analog pins
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
124ba12485
commit
0bfb655f66
5 changed files with 50 additions and 0 deletions
|
@ -107,6 +107,8 @@ class MCU_ADC_buttons:
|
|||
self.mcu_adc = ppins.setup_pin('adc', self.pin)
|
||||
self.mcu_adc.setup_minmax(ADC_SAMPLE_TIME, ADC_SAMPLE_COUNT)
|
||||
self.mcu_adc.setup_adc_callback(ADC_REPORT_TIME, self.adc_callback)
|
||||
query_adc = printer.lookup_object('query_adc')
|
||||
query_adc.register_adc('adc_button:' + pin.strip(), self.mcu_adc)
|
||||
|
||||
def setup_button(self, min_value, max_value, callback):
|
||||
self.min_value = min(self.min_value, min_value)
|
||||
|
@ -205,6 +207,7 @@ class RotaryEncoder:
|
|||
class PrinterButtons:
|
||||
def __init__(self, config):
|
||||
self.printer = config.get_printer()
|
||||
self.printer.try_load_module(config, 'query_adc')
|
||||
self.mcu_buttons = {}
|
||||
self.adc_buttons = {}
|
||||
def register_adc_button(self, pin, min_val, max_val, pullup, callback):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue