Sfoglia il codice sorgente

Repair formula mangled by PR#1319 in Jan 2015

Richard Wackerbarth 9 anni fa
parent
commit
7c94c83765
1 ha cambiato i file con 5 aggiunte e 5 eliminazioni
  1. 5
    5
      Marlin/scripts/createTemperatureLookupMarlin.py

+ 5
- 5
Marlin/scripts/createTemperatureLookupMarlin.py Vedi File

@@ -1,7 +1,7 @@
1 1
 #!/usr/bin/python
2 2
 """Thermistor Value Lookup Table Generator
3 3
 
4
-Generates lookup to temperature values for use in a microcontroller in C format based on: 
4
+Generates lookup to temperature values for use in a microcontroller in C format based on:
5 5
 http://en.wikipedia.org/wiki/Steinhart-Hart_equation
6 6
 
7 7
 The main use is for Arduino programs that read data from the circuit board described here:
@@ -45,7 +45,7 @@ class Thermistor:
45 45
         c = (y - x) / ((l3 - l2) * (l1 + l2 + l3))
46 46
         b = x - c * (l1**2 + l2**2 + l1*l2)
47 47
         a = y1 - (b + l1**2 *c)*l1
48
-        
48
+
49 49
         if c < 0:
50 50
             print "//////////////////////////////////////////////////////////////////////////////////////"
51 51
             print "// WARNING: negative coefficient 'c'! Something may be wrong with the measurements! //"
@@ -73,13 +73,13 @@ class Thermistor:
73 73
     def temp(self, adc):
74 74
         "Convert ADC reading into a temperature in Celcius"
75 75
         l = log(self.resist(adc))
76
-        Tinv = self.c1 + self.c2*l + self.c3* l**3) # inverse temperature
76
+        Tinv = self.c1 + self.c2*l + self.c3* l**3 # inverse temperature
77 77
         return (1/Tinv) - ZERO              # temperature
78 78
 
79 79
     def adc(self, temp):
80 80
         "Convert temperature into a ADC reading"
81 81
         x = (self.c1 - (1.0 / (temp+ZERO))) / (2*self.c3)
82
-        y = sqrt((self.c2 / (3*self.c3)**3 + x**2)
82
+        y = sqrt((self.c2 / (3*self.c3))**3 + x**2)
83 83
         r = exp((y-x)**(1.0/3) - (y+x)**(1.0/3))
84 84
         return (r / (self.rp + r)) * ARES
85 85
 
@@ -93,7 +93,7 @@ def main(argv):
93 93
     r3 = 226.15                             # resistance at high temperature (226.15 Ohm)
94 94
     rp = 4700;                              # pull-up resistor (4.7 kOhm)
95 95
     num_temps = 36;                         # number of entries for look-up table
96
-    
96
+
97 97
     try:
98 98
         opts, args = getopt.getopt(argv, "h", ["help", "rp=", "t1=", "t2=", "t3=", "num-temps="])
99 99
     except getopt.GetoptError as err:

Loading…
Annulla
Salva