From 81013ba5c8638dd42932bd893e1b3115b1b98041 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 19 Jan 2018 22:22:17 -0500 Subject: klippy: Add access methods and avoid peeking into the printer classes Add get_reactor(), lookup_object(), lookup_module_objects(), and set_rollover_info() to the main Printer class so that callers do not need to peek into the class' members. Similarly, add get_printer() and get_name() methods to the ConfigWrapper class. Signed-off-by: Kevin O'Connor --- klippy/heater.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'klippy/heater.py') diff --git a/klippy/heater.py b/klippy/heater.py index e3bbe78e..8dff7dbc 100644 --- a/klippy/heater.py +++ b/klippy/heater.py @@ -1,6 +1,6 @@ # Printer heater support # -# Copyright (C) 2016,2017 Kevin O'Connor +# Copyright (C) 2016-2018 Kevin O'Connor # # This file may be distributed under the terms of the GNU GPLv3 license. import math, logging, threading @@ -106,7 +106,7 @@ class PrinterHeater: error = error def __init__(self, printer, config): self.printer = printer - self.name = config.section + self.name = config.get_name() sensor_params = config.getchoice('sensor_type', Sensors) self.sensor = sensor_params['class'](config, sensor_params) self.min_temp = config.getfloat('min_temp', minval=0.) @@ -326,7 +326,7 @@ class ControlAutoTune: midpoint_pos = sorted(cycle_times)[len(cycle_times)/2][1] Kp, Ki, Kd = self.calc_pid(midpoint_pos) logging.info("Autotune: final: Kp=%f Ki=%f Kd=%f", Kp, Ki, Kd) - gcode = self.heater.printer.objects['gcode'] + gcode = self.heater.printer.lookup_object('gcode') gcode.respond_info( "PID parameters: pid_Kp=%.3f pid_Ki=%.3f pid_Kd=%.3f\n" "To use these parameters, update the printer config file with\n" -- cgit v1.2.3-70-g09d2