From d61d3ade23c493b4435ca6b3a4635471a26efe15 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 8 Jun 2022 12:46:07 -0400 Subject: [PATCH] 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 --- klippy/extras/ds18b20.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/klippy/extras/ds18b20.py b/klippy/extras/ds18b20.py index 76e38532..9e36dfe5 100644 --- a/klippy/extras/ds18b20.py +++ b/klippy/extras/ds18b20.py @@ -45,12 +45,10 @@ class DS18B20: def _handle_ds18b20_response(self, params): temp = params['value'] / 1000.0 - if params["fault"] != 0: - temp = 0 # read error! report 0C and don't check temp range - elif temp < self.min_temp or temp > self.max_temp: - self.printer.invoke_shutdown( - "DS18B20 temperature %0.1f outside range of %0.1f:%.01f" - % (temp, self.min_temp, self.max_temp)) + if params["fault"]: + logging.info("ds18b20 reports fault %d (temp=%0.1f)", + params["fault"], temp) + return next_clock = self._mcu.clock32_to_clock64(params['next_clock']) last_read_clock = next_clock - self._report_clock