|
@@ -22,6 +22,11 @@ from math import *
|
22
|
22
|
import sys
|
23
|
23
|
import getopt
|
24
|
24
|
|
|
25
|
+"Constants"
|
|
26
|
+ARES = pow(2,10) # 10 Bit ADC resolution
|
|
27
|
+TMIN = 0 # lowest temperature in table
|
|
28
|
+TMAX = 350 # highest temperature in table
|
|
29
|
+
|
25
|
30
|
class Thermistor:
|
26
|
31
|
"Class to do the thermistor maths"
|
27
|
32
|
def __init__(self, rp, t1, r1, t2, r2, t3, r3):
|
|
@@ -120,15 +125,10 @@ def main(argv):
|
120
|
125
|
elif opt == "--num-temps":
|
121
|
126
|
num_temps = int(arg)
|
122
|
127
|
|
123
|
|
- max_adc = (1024 ) - 1
|
124
|
|
- min_temp = 0
|
125
|
|
- max_temp = 350
|
126
|
|
- increment = int(max_adc/(num_temps-1));
|
127
|
|
-
|
|
128
|
+ increment = int((ARES-1)/(num_temps-1));
|
128
|
129
|
t = Thermistor(rp, t1, r1, t2, r2, t3, r3)
|
129
|
|
- tmp = (min_temp - max_temp) / (num_temps-1)
|
130
|
|
- print tmp
|
131
|
|
- temps = range(max_temp, min_temp + tmp, tmp);
|
|
130
|
+ tmp = (TMIN-TMAX) / (num_temps-1)
|
|
131
|
+ temps = range(TMAX, TMIN+tmp, tmp);
|
132
|
132
|
|
133
|
133
|
print "// Thermistor lookup table for Marlin"
|
134
|
134
|
print "// ./createTemperatureLookupMarlin.py --rp=%s --t1=%s:%s --t2=%s:%s --t3=%s:%s --num-temps=%s" % (rp, t1, r1, t2, r2, t3, r3, num_temps)
|