mirror of
https://github.com/supleed2/ELEC60013-ES-CW1.git
synced 2024-12-22 21:45:48 +00:00
Add rounded output to TMP006 temperature output
This commit is contained in:
parent
444bc1c719
commit
36eecf3a00
|
@ -35,6 +35,7 @@ class TMP006:
|
|||
|
||||
@property
|
||||
def temperature(self) -> float:
|
||||
"""Measured temperature in degrees Celsius, to 2 decimel places"""
|
||||
Vobj = self.vObject()
|
||||
Tdie = self.tAmbient()
|
||||
# Values for Calculations
|
||||
|
@ -55,7 +56,7 @@ class TMP006:
|
|||
# Calculate object temperature in Kelvin
|
||||
Tobj = (Tdie**4 + (fVobj / S)) ** 0.25
|
||||
# Convert from Kelvin to Celsius
|
||||
return Tobj - 273.15
|
||||
return round(Tobj - 273.15, 2)
|
||||
|
||||
@property
|
||||
def active(self) -> bool:
|
||||
|
|
Loading…
Reference in a new issue