From d161d667412c9a096a52b1e0b156c49158d857d3 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 22 Nov 2016 12:37:37 -0500 Subject: mcu: Handle adc initialization entirely in mcu code Don't expose the ADC initialization to the gcode and heater code - instead, register a callback within the MCU_adc class and call it directly from the MCU class after configuration completes. Signed-off-by: Kevin O'Connor --- klippy/heater.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'klippy/heater.py') diff --git a/klippy/heater.py b/klippy/heater.py index 06bc0cd1..b7987936 100644 --- a/klippy/heater.py +++ b/klippy/heater.py @@ -47,14 +47,12 @@ class PrinterHeater: max_adc = self.calc_adc(self.config.getfloat('min_temp')) self.mcu_adc.set_minmax( SAMPLE_TIME, SAMPLE_COUNT, minval=min_adc, maxval=max_adc) - self.mcu_adc.set_adc_callback(self.adc_callback) + self.mcu_adc.set_adc_callback(REPORT_TIME, self.adc_callback) control_algo = self.config.get('control', 'watermark') algos = {'watermark': ControlBangBang, 'pid': ControlPID} self.control = algos[control_algo](self, self.config) if self.printer.mcu.output_file_mode: self.can_extrude = True - def run(self): - self.mcu_adc.query_analog_in(REPORT_TIME) def set_pwm(self, read_time, value): if value: if self.target_temp <= 0.: -- cgit v1.2.3-70-g09d2