Mercurial > ~darius > hgwebdir.cgi > epro
changeset 3:6d0fe22566ab
Fix cut & paste error for variable name, report disconnected sensor specially.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Sun, 19 Nov 2017 18:07:55 +1030 |
parents | ffd0dcce19ed |
children | 787d9c8fdec6 |
files | epro.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/epro.py Mon Jul 20 17:17:58 2015 +0930 +++ b/epro.py Sun Nov 19 18:07:55 2017 +1030 @@ -131,13 +131,18 @@ def __init__(self, dstadr, srcadr, devid, msgtype, data): super(BatteryTemperature, self).__init__(dstadr, srcadr, devid, msgtype, data) - self.time = (data[2] & 0x7f | (data[1] & 0x7f) << 7 | (data[0] & 0x3f) << 14) / 10.0 + self.temp = (data[2] & 0x7f | (data[1] & 0x7f) << 7 | (data[0] & 0x3f) << 14) / 10.0 if data[2] & 0x40: - self.time *= -1 + self.temp *= -1 + if self.temp == -20: + self.temp = None def __repr__(self): s = super(BatteryTemperature, self).__repr__() - s += ": %.2f degC" % (self.time) + if self.temp == None: + s += ": n/a" + else: + s += ": %.2f degC" % (self.temp) return s class MonitorStatus(Packet):