- reactored
This commit is contained in:
@@ -60,27 +60,6 @@ class TempSensor_max31865(ATemperatureSensor):
|
||||
|
||||
return R
|
||||
|
||||
@staticmethod
|
||||
def vanDusenLut (R0, Tmin, Tmax, dT):
|
||||
a = +3.90830e-03
|
||||
b = -5.77500e-07
|
||||
c = -4.18301e-12
|
||||
|
||||
Rv = []
|
||||
Tv = []
|
||||
T = Tmin
|
||||
while T <= Tmax:
|
||||
R = R0*(1 + a*T + b*T**2)
|
||||
|
||||
if T < 0.0:
|
||||
R += R0*c*(T - 100)*T**3
|
||||
|
||||
Rv.append(R)
|
||||
Tv.append(T)
|
||||
T += dT
|
||||
|
||||
return Rv, Tv
|
||||
|
||||
@staticmethod
|
||||
def vanDusen_temp(Rmeas):
|
||||
RLut, TLut = __class__.vanDusenLut(100, -150, +500, 1.0)
|
||||
@@ -106,6 +85,27 @@ class TempSensor_max31865(ATemperatureSensor):
|
||||
|
||||
return T
|
||||
|
||||
@staticmethod
|
||||
def vanDusenLut (R0, Tmin, Tmax, dT):
|
||||
a = +3.90830e-03
|
||||
b = -5.77500e-07
|
||||
c = -4.18301e-12
|
||||
|
||||
Rv = []
|
||||
Tv = []
|
||||
T = Tmin
|
||||
while T <= Tmax:
|
||||
R = R0*(1 + a*T + b*T**2)
|
||||
|
||||
if T < 0.0:
|
||||
R += R0*c*(T - 100)*T**3
|
||||
|
||||
Rv.append(R)
|
||||
Tv.append(T)
|
||||
T += dT
|
||||
|
||||
return Rv, Tv
|
||||
|
||||
def process(self):
|
||||
temp = self.temperature()
|
||||
self.temp = temp
|
||||
@@ -121,8 +121,8 @@ if __name__ == '__main__':
|
||||
|
||||
digits = sensor.read_digits()
|
||||
print("Digits = {:04X}".format(digits))
|
||||
print("Temperature = {} °C".format(TempSensor_max31865.to_temperature(digits)))
|
||||
time.sleep(0.1)
|
||||
print("Temperature = {:0.2f} °C".format(TempSensor_max31865.to_temperature(digits)))
|
||||
time.sleep(0.5)
|
||||
|
||||
print("End of program")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user