changeset 7:3baca74482b6

Fix a few more incorrect sign bits
author Daniel O'Connor <darius@dons.net.au>
date Wed, 09 Jun 2021 14:56:56 +0930
parents 2f7ee650e6fb
children d3624c2b7c92
files epro.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/epro.py	Wed Jun 09 14:27:44 2021 +0930
+++ b/epro.py	Wed Jun 09 14:56:56 2021 +0930
@@ -86,7 +86,7 @@
     def __init__(self, dstadr, srcadr, devid, msgtype, data):
         super(AmpHours, self).__init__(dstadr, srcadr, devid, msgtype, data)
         self.amphrs = (data[2] & 0x7f | (data[1] & 0x7f) << 7 | (data[0] & 0x3f) << 14) / 100.0
-        if data[2] & 0x40:
+        if data[0] & 0x40:
             self.amphrs *= -1
 
     def __repr__(self):
@@ -118,7 +118,7 @@
     def __init__(self, dstadr, srcadr, devid, msgtype, data):
         super(TimeRemaining, self).__init__(dstadr, srcadr, devid, msgtype, data)
         self.time = (data[2] & 0x7f | (data[1] & 0x7f) << 7 | (data[0] & 0x3f) << 14)
-        if data[2] & 0x40:
+        if data[0] & 0x40:
             self.time *= -1
 
     def __repr__(self):