diff --git a/aosong/am2315.py b/aosong/am2315.py index 3ac8a2e..f79f105 100644 --- a/aosong/am2315.py +++ b/aosong/am2315.py @@ -133,6 +133,10 @@ def data(self): temp_H &=0x7F tempC = (temp_H*256+temp_L)/10 + + if negative: + tempC = -abs(tempC) + tempF = self.c_to_f(tempC) # Verify CRC here @@ -146,10 +150,6 @@ def data(self): self.lastError('CRC error in sensor data.') return None - if negative: - tempC = -abs(tempC) - tempF = -abs(tempF) - return (humidity, tempC, tempF)