aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-01-04 12:30:20 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-01-04 12:47:37 -0500
commit7fe14f05e69f450092be7bf2d931f96918a04652 (patch)
treebebb0ddc13bcfa740c4cabb3655dc2a82f577e47 /klippy
parent277a8185e1550b55f634c40923db155771736063 (diff)
downloadkutter-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')
-rw-r--r--klippy/extras/thermistor.py2
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