diff epro.py @ 26:3090d8bf4242

Fix temperature decoding.
author Daniel O'Connor <darius@dons.net.au>
date Tue, 21 Dec 2021 15:05:32 +1030
parents 60ead9b5fc1b
children 8b8efc343b0c
line wrap: on
line diff
--- a/epro.py	Tue Dec 14 13:04:12 2021 +1030
+++ b/epro.py	Tue Dec 21 15:05:32 2021 +1030
@@ -139,8 +139,8 @@
 
     def __init__(self, dstadr, srcadr, devid, msgtype, data):
         super(BatteryTemperature, self).__init__(dstadr, srcadr, devid, msgtype, data)
-        self.temp = (data[2] & 0x7f | (data[1] & 0x7f) << 7 | (data[0] & 0x3f) << 14) / 10.0
-        if data[2] & 0x40:
+        self.temp = (data[2] & 0x7f | (data[1] & 0x7f) << 7 | (data[0] & 0x03) << 14) / 10.0
+        if data[0] & 0x40:
             self.temp *= -1
         if self.temp < -20:
             self.temp = None