changeset 6:2f7ee650e6fb

Use correct byte for sign bit.
author Daniel O'Connor <darius@dons.net.au>
date Wed, 09 Jun 2021 14:27:44 +0930
parents 982eeffe9d95
children 3baca74482b6
files epro.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/epro.py	Wed Sep 25 21:37:28 2019 +0930
+++ b/epro.py	Wed Jun 09 14:27:44 2021 +0930
@@ -69,7 +69,7 @@
     def __init__(self, dstadr, srcadr, devid, msgtype, data):
         super(BatteryCurrent, self).__init__(dstadr, srcadr, devid, msgtype, data)
         self.amps = (data[2] & 0x7f | (data[1] & 0x7f) << 7 | (data[0] & 0x3f) << 14) / 100.0
-        if data[2] & 0x40:
+        if data[0] & 0x40:
             self.amps *= -1
 
     def __repr__(self):