From 36eecf3a0082bdc745fe3fe04fa1506ca66702a2 Mon Sep 17 00:00:00 2001 From: Aadi Desai <21363892+supleed2@users.noreply.github.com> Date: Wed, 2 Mar 2022 10:53:45 +0000 Subject: [PATCH] Add rounded output to TMP006 temperature output --- tmp006.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tmp006.py b/tmp006.py index f14fd93..4bffaa3 100644 --- a/tmp006.py +++ b/tmp006.py @@ -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: