rpi_temperature: Don't read min_temp/max_temp directly from config
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
b911db4c0d
commit
23f547169c
|
@ -2069,14 +2069,6 @@ CPU temperature from Raspberry Pi.
|
||||||
# parameters.
|
# parameters.
|
||||||
#sensor_type:
|
#sensor_type:
|
||||||
# Must be "rpi_temperature".
|
# Must be "rpi_temperature".
|
||||||
min_temp: -40
|
|
||||||
max_temp: 85
|
|
||||||
# The maximum safe range of temperatures (in Celsius) that the
|
|
||||||
# RPi must remain within. This controls a safety feature
|
|
||||||
# implemented in the micro-controller code - should the measured
|
|
||||||
# temperature ever fall outside this range then the micro-controller
|
|
||||||
# will go into a shutdown state. Set this range just wide
|
|
||||||
# enough so that reasonable temperatures do not result in an error.
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## [heater_generic]
|
## [heater_generic]
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
RPI_REPORT_TIME = 1.0
|
RPI_REPORT_TIME = 1.0
|
||||||
KELVIN_TO_CELSIUS = -273.15
|
|
||||||
PROC_TEMP_FILE = "/sys/class/thermal/thermal_zone0/temp"
|
PROC_TEMP_FILE = "/sys/class/thermal/thermal_zone0/temp"
|
||||||
|
|
||||||
class RPiTemperature:
|
class RPiTemperature:
|
||||||
|
@ -16,13 +15,7 @@ class RPiTemperature:
|
||||||
self.reactor = self.printer.get_reactor()
|
self.reactor = self.printer.get_reactor()
|
||||||
self.name = config.get_name().split()[-1]
|
self.name = config.get_name().split()[-1]
|
||||||
|
|
||||||
self.temp = 0.0
|
self.temp = self.min_temp = self.max_temp = 0.0
|
||||||
self.file_handle = None
|
|
||||||
|
|
||||||
self.min_temp = config.getfloat('min_temp', -40,
|
|
||||||
minval=KELVIN_TO_CELSIUS)
|
|
||||||
self.max_temp = config.getfloat('max_temp', 85,
|
|
||||||
above=self.min_temp)
|
|
||||||
|
|
||||||
self.printer.add_object("rpi_temperature " + self.name, self)
|
self.printer.add_object("rpi_temperature " + self.name, self)
|
||||||
self.sample_timer = self.reactor.register_timer(
|
self.sample_timer = self.reactor.register_timer(
|
||||||
|
@ -45,7 +38,8 @@ class RPiTemperature:
|
||||||
|
|
||||||
|
|
||||||
def setup_minmax(self, min_temp, max_temp):
|
def setup_minmax(self, min_temp, max_temp):
|
||||||
pass
|
self.min_temp = min_temp
|
||||||
|
self.max_temp = max_temp
|
||||||
|
|
||||||
def setup_callback(self, cb):
|
def setup_callback(self, cb):
|
||||||
self._callback = cb
|
self._callback = cb
|
||||||
|
|
Loading…
Reference in New Issue