1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-27 13:56:24 +00:00

automatically determine min/max temp for terminator

This commit is contained in:
Steffen Vogel 2015-01-06 10:28:19 +01:00
parent 81363bc441
commit 4e02aff9b5

View File

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