Mercurial > ~darius > hgwebdir.cgi > epro
diff epro.py @ 10:d3624c2b7c92
merge in sign fixes
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Sun, 05 Dec 2021 18:00:43 +1030 |
parents | 3baca74482b6 |
children | 0a571da65068 |
line wrap: on
line diff
--- a/epro.py Sun Dec 05 16:19:31 2021 +1030 +++ b/epro.py Sun Dec 05 18:00:43 2021 +1030 @@ -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): @@ -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):