diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-01-04 12:30:20 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-01-04 12:47:37 -0500 |
commit | 7fe14f05e69f450092be7bf2d931f96918a04652 (patch) | |
tree | bebb0ddc13bcfa740c4cabb3655dc2a82f577e47 /klippy/extras | |
parent | 277a8185e1550b55f634c40923db155771736063 (diff) | |
download | kutter-7fe14f05e69f450092be7bf2d931f96918a04652.tar.gz kutter-7fe14f05e69f450092be7bf2d931f96918a04652.tar.xz kutter-7fe14f05e69f450092be7bf2d931f96918a04652.zip |
thermistor: Avoid divide by zero error if min_temp=-273.15
Reported by @TheGuv.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras')
-rw-r--r-- | klippy/extras/thermistor.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/klippy/extras/thermistor.py b/klippy/extras/thermistor.py index c39ae66e..20c87754 100644 --- a/klippy/extras/thermistor.py +++ b/klippy/extras/thermistor.py @@ -75,6 +75,8 @@ class Thermistor: temp = 1.0/inv_t + KELVIN_TO_CELCIUS self.temperature_callback(read_time + SAMPLE_COUNT * SAMPLE_TIME, temp) def calc_adc(self, temp): + if temp <= KELVIN_TO_CELCIUS: + return 1. inv_t = 1. / (temp - KELVIN_TO_CELCIUS) if self.c3: # Solve for ln_r using Cardano's formula |