aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-07-24 14:12:00 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-07-24 14:12:00 -0400
commit7510efe8272a2412f9b67d3623bb8592b610c05c (patch)
tree0ef2b837308ae515da8d2d64fef7ab32fc914dc3 /klippy
parent270080cd4c771abcd0d8b378a7e71331faeefb7e (diff)
downloadkutter-7510efe8272a2412f9b67d3623bb8592b610c05c.tar.gz
kutter-7510efe8272a2412f9b67d3623bb8592b610c05c.tar.xz
kutter-7510efe8272a2412f9b67d3623bb8592b610c05c.zip
spi_temperature: Use setup_minmax() to set the temperature range
Use setup_minmax() instead of directly reading the min/max temperature from the config. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/extras/spi_temperature.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/klippy/extras/spi_temperature.py b/klippy/extras/spi_temperature.py
index 3e465f22..16831866 100644
--- a/klippy/extras/spi_temperature.py
+++ b/klippy/extras/spi_temperature.py
@@ -25,16 +25,11 @@ class error(Exception):
class SensorBase:
error = error
def __init__(self, config):
- self.min_temp = config.getfloat('min_temp', minval=0., default=0.)
- self.max_temp = config.getfloat('max_temp', above=self.min_temp)
self._callback = None
- sensor_pin = config.get('sensor_pin')
- adc_range = [self.calc_adc(self.min_temp),
- self.calc_adc(self.max_temp)]
- self.min_sample_value = min(adc_range)
- self.max_sample_value = max(adc_range)
+ self.min_sample_value = self.max_sample_value = 0
self._report_clock = 0
ppins = config.get_printer().lookup_object('pins')
+ sensor_pin = config.get('sensor_pin')
pin_params = ppins.lookup_pin('digital_out', sensor_pin)
self.mcu = mcu = pin_params['chip']
pin = pin_params['pin']
@@ -58,7 +53,9 @@ class SensorBase:
"thermocouple_result", oid)
mcu.add_config_object(self)
def setup_minmax(self, min_temp, max_temp):
- pass
+ adc_range = [self.calc_adc(min_temp), self.calc_adc(max_temp)]
+ self.min_sample_value = min(adc_range)
+ self.max_sample_value = max(adc_range)
def setup_callback(self, cb):
self._callback = cb
def get_report_time_delta(self):