Configtool: prevent negative numbers in thermistor tables.

This commit is contained in:
jbernardis 2015-04-27 19:05:16 -04:00 committed by Markus Hitter
parent 9b7fef2e84
commit 452908afa9
1 changed files with 6 additions and 1 deletions

View File

@ -88,6 +88,8 @@ def generateTempTables(sensors, settings):
for i in range(N):
adcs.append(int(ct))
ct += increment
if ct > maxadc:
ct = maxadc
counter = 0
for adc in adcs:
@ -104,8 +106,11 @@ def generateTempTables(sensors, settings):
sep = " "
else:
sep = ","
val = int(thm.temp(adc) * mult)
if val < 0:
val = 0
ostr = (" {%4s, %5s}%s // %6.2f C, %6.0f ohms, %0.3f V,"
" %0.2f C/count, %0.2f mW") % (adc, int(thm.temp(adc) * mult),
" %0.2f C/count, %0.2f mW") % (adc, val,
sep, degC, resistance, vTherm, resolution, ptherm * 1000)
ofp.output(ostr)
if tcount == len(tl):