Browse Source

automatically determine min/max temp for terminator

Steffen Vogel 9 years ago
parent
commit
4e02aff9b5
1 changed files with 9 additions and 4 deletions
  1. 9
    4
      Marlin/scripts/createTemperatureLookupMarlin.py

+ 9
- 4
Marlin/scripts/createTemperatureLookupMarlin.py View File

@@ -114,16 +114,21 @@ def main(argv):
114 114
             t3 = float(arg[0])
115 115
             r3 = float(arg[1])
116 116
         elif opt == "--num-temps":
117
-            num_temps =  int(arg)
117
+            num_temps = int(arg)
118 118
 
119
-    increment = int((ARES-1)/(num_temps-1));
120 119
     t = Thermistor(rp, t1, r1, t2, r2, t3, r3)
121
-    tmp = (TMIN-TMAX) / (num_temps-1)
122
-    temps = range(TMAX, TMIN+tmp, tmp);
120
+    increment = int((ARES-1)/(num_temps-1));
121
+    step = (TMIN-TMAX) / (num_temps-1)
122
+    low_bound = t.temp(ARES-1);
123
+    up_bound = t.temp(1);
124
+    min_temp = int(TMIN if TMIN > low_bound else low_bound)
125
+    max_temp = int(TMAX if TMAX < up_bound else up_bound)
126
+    temps = range(max_temp, TMIN+step, step);
123 127
 
124 128
     print "// Thermistor lookup table for Marlin"
125 129
     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)
126 130
     print "// Steinhart-Hart Coefficients: a=%.15g, b=%.15g, c=%.15g " % (t.c1, t.c2, t.c3)
131
+    print "// Theoretical limits of termistor: %.2f to %.2f degC" % (low_bound, up_bound)
127 132
     print
128 133
     print "#define NUMTEMPS %s" % (len(temps))
129 134
     print "const short temptable[NUMTEMPS][2] PROGMEM = {"

Loading…
Cancel
Save