|
43 | 43 | https://github.com/adafruit/circuitpython/releases
|
44 | 44 | * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
|
45 | 45 | """
|
46 |
| -from math import exp, pow |
| 46 | +import math |
47 | 47 | try:
|
48 | 48 | import struct
|
49 | 49 | except ImportError:
|
@@ -109,26 +109,26 @@ def temperature_NIST(self):
|
109 | 109 | if TAMB >= 0:
|
110 | 110 | VREF =(-0.176004136860E-01 +
|
111 | 111 | 0.389212049750E-01 * TAMB +
|
112 |
| - 0.185587700320E-04 * pow(TAMB, 2) + |
113 |
| - -0.994575928740E-07 * pow(TAMB, 3) + |
114 |
| - 0.318409457190E-09 * pow(TAMB, 4) + |
115 |
| - -0.560728448890E-12 * pow(TAMB, 5) + |
116 |
| - 0.560750590590E-15 * pow(TAMB, 6) + |
117 |
| - -0.320207200030E-18 * pow(TAMB, 7) + |
118 |
| - 0.971511471520E-22 * pow(TAMB, 8) + |
119 |
| - -0.121047212750E-25 * pow(TAMB, 9) + |
120 |
| - 0.1185976 * exp(-0.1183432E-03 * pow(TAMB - 0.1269686E+03, 2))) |
| 112 | + 0.185587700320E-04 * math.pow(TAMB, 2) + |
| 113 | + -0.994575928740E-07 * math.pow(TAMB, 3) + |
| 114 | + 0.318409457190E-09 * math.pow(TAMB, 4) + |
| 115 | + -0.560728448890E-12 * math.pow(TAMB, 5) + |
| 116 | + 0.560750590590E-15 * math.pow(TAMB, 6) + |
| 117 | + -0.320207200030E-18 * math.pow(TAMB, 7) + |
| 118 | + 0.971511471520E-22 * math.pow(TAMB, 8) + |
| 119 | + -0.121047212750E-25 * math.pow(TAMB, 9) + |
| 120 | + 0.1185976 * math.exp(-0.1183432E-03 * math.pow(TAMB - 0.1269686E+03, 2))) |
121 | 121 | else:
|
122 | 122 | VREF =( 0.394501280250E-01 * TAMB +
|
123 |
| - 0.236223735980E-04 * pow(TAMB, 2) + |
124 |
| - -0.328589067840E-06 * pow(TAMB, 3) + |
125 |
| - -0.499048287770E-08 * pow(TAMB, 4) + |
126 |
| - -0.675090591730E-10 * pow(TAMB, 5) + |
127 |
| - -0.574103274280E-12 * pow(TAMB, 6) + |
128 |
| - -0.310888728940E-14 * pow(TAMB, 7) + |
129 |
| - -0.104516093650E-16 * pow(TAMB, 8) + |
130 |
| - -0.198892668780E-19 * pow(TAMB, 9) + |
131 |
| - -0.163226974860E-22 * pow(TAMB, 10)) |
| 123 | + 0.236223735980E-04 * math.pow(TAMB, 2) + |
| 124 | + -0.328589067840E-06 * math.pow(TAMB, 3) + |
| 125 | + -0.499048287770E-08 * math.pow(TAMB, 4) + |
| 126 | + -0.675090591730E-10 * math.pow(TAMB, 5) + |
| 127 | + -0.574103274280E-12 * math.pow(TAMB, 6) + |
| 128 | + -0.310888728940E-14 * math.pow(TAMB, 7) + |
| 129 | + -0.104516093650E-16 * math.pow(TAMB, 8) + |
| 130 | + -0.198892668780E-19 * math.pow(TAMB, 9) + |
| 131 | + -0.163226974860E-22 * math.pow(TAMB, 10)) |
132 | 132 | # total thermoelectric voltage
|
133 | 133 | VTOTAL = VOUT + VREF
|
134 | 134 | # determine coefficients
|
@@ -167,5 +167,5 @@ def temperature_NIST(self):
|
167 | 167 | # compute temperature
|
168 | 168 | TEMPERATURE = 0
|
169 | 169 | for n, c in enumerate(DCOEF):
|
170 |
| - TEMPERATURE += c * pow(VTOTAL, n) |
| 170 | + TEMPERATURE += c * math.pow(VTOTAL, n) |
171 | 171 | return TEMPERATURE
|
0 commit comments