thermistor: Avoid divide by zero error if min_temp=-273.15
Reported by @TheGuv. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
277a8185e1
commit
7fe14f05e6
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue