ds18b20: Don't propagate incorrect temperature on a fault
Just log an error on a fault. Remove the host check for min/max temperature as the micro-controller code already implements that check. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
2dc20c011d
commit
d61d3ade23
|
@ -45,12 +45,10 @@ class DS18B20:
|
||||||
def _handle_ds18b20_response(self, params):
|
def _handle_ds18b20_response(self, params):
|
||||||
temp = params['value'] / 1000.0
|
temp = params['value'] / 1000.0
|
||||||
|
|
||||||
if params["fault"] != 0:
|
if params["fault"]:
|
||||||
temp = 0 # read error! report 0C and don't check temp range
|
logging.info("ds18b20 reports fault %d (temp=%0.1f)",
|
||||||
elif temp < self.min_temp or temp > self.max_temp:
|
params["fault"], temp)
|
||||||
self.printer.invoke_shutdown(
|
return
|
||||||
"DS18B20 temperature %0.1f outside range of %0.1f:%.01f"
|
|
||||||
% (temp, self.min_temp, self.max_temp))
|
|
||||||
|
|
||||||
next_clock = self._mcu.clock32_to_clock64(params['next_clock'])
|
next_clock = self._mcu.clock32_to_clock64(params['next_clock'])
|
||||||
last_read_clock = next_clock - self._report_clock
|
last_read_clock = next_clock - self._report_clock
|
||||||
|
|
Loading…
Reference in New Issue