diff epro.py @ 5:982eeffe9d95

Convert booleans to boolean. Sqlite doesn't do it and stores them as ints instead
author Daniel O'Connor <darius@dons.net.au>
date Wed, 25 Sep 2019 21:37:28 +0930
parents 787d9c8fdec6
children 2f7ee650e6fb
line wrap: on
line diff
--- a/epro.py	Sun Nov 19 18:08:13 2017 +1030
+++ b/epro.py	Wed Sep 25 21:37:28 2019 +0930
@@ -156,25 +156,25 @@
 
     def __init__(self, dstadr, srcadr, devid, msgtype, data):
         super(MonitorStatus, self).__init__(dstadr, srcadr, devid, msgtype, data)
-        self.autosyncvolt = data[0] & 0x10
-        self.autosyncamp = data[0] & 0x08
-        self.autosyncchrg = data[0] & 0x04
-        self.e501compat = data[0] & 0x02
-        self.alarmtst = data[0] & 0x01
-        self.backlight = data[1] & 0x40
-        self.disptst = data[1] & 0x20
-        self.tempsense = data[1] & 0x10 # Seems to be inverted from data sheet
-        self.auxhv = data[1] & 0x08
-        self.auxlv = data[1] & 0x04
-        self.lock = data[1] & 0x02
-        self.mainhv = data[1] & 0x01
-        self.mainlv = data[2] & 0x40
-        self.lowbatalarm = data[2] & 0x20
-        self.batflat = data[2] & 0x10
-        self.batfull = data[2] & 0x08
-        self.charged = data[2] & 0x04
-        self.nosync = data[2] & 0x02
-        self.monreset = data[2] & 0x01
+        self.autosyncvolt = bool(data[0] & 0x10)
+        self.autosyncamp = bool(data[0] & 0x08)
+        self.autosyncchrg = bool(data[0] & 0x04)
+        self.e501compat = bool(data[0] & 0x02)
+        self.alarmtst = bool(data[0] & 0x01)
+        self.backlight = bool(data[1] & 0x40)
+        self.disptst = bool(data[1] & 0x20)
+        self.tempsense = bool(data[1] & 0x10) # Seems to be inverted from data sheet
+        self.auxhv = bool(data[1] & 0x08)
+        self.auxlv = bool(data[1] & 0x04)
+        self.lock = bool(data[1] & 0x02)
+        self.mainhv = bool(data[1] & 0x01)
+        self.mainlv = bool(data[2] & 0x40)
+        self.lowbatalarm = bool(data[2] & 0x20)
+        self.batflat = bool(data[2] & 0x10)
+        self.batfull = bool(data[2] & 0x08)
+        self.charged = bool(data[2] & 0x04)
+        self.nosync = bool(data[2] & 0x02)
+        self.monreset = bool(data[2] & 0x01)
 
     def __repr__(self):
         s = super(MonitorStatus, self).__repr__()