return 0 or 1 for battery status rather than 0,1,2,4,8

This commit is contained in:
Matthew Wall
2014-06-09 16:46:07 +00:00
parent 3624a2f61a
commit ccdda7e2e5
2 changed files with 5 additions and 2 deletions

View File

@@ -867,7 +867,7 @@ import weewx.abstractstation
import weewx.units
import weewx.wxformulas
DRIVER_VERSION = '0.26'
DRIVER_VERSION = '0.27'
# flags for enabling/disabling debug verbosity
DEBUG_WRITES = 0
@@ -1420,9 +1420,10 @@ def getFrequencyStandard(frequency):
batterybits = { 'wind':0, 'rain':1, 'th':2, 'console':3 }
def getBatteryStatus(status, flag):
'''Return 1 if bit is set, 0 otherwise'''
bit = batterybits.get(flag)
if bit is not None:
return BitHandling.testBit(status, bit)
return 1 if BitHandling.testBit(status, bit) else 0
return None
class CWeatherTraits(object):

View File

@@ -25,6 +25,8 @@ Fix imagegenerator aggregation to permit data tables with no 'interval' column.
Prompt for metric/US units for debian installations.
For WS28xx stations, return 0 for battery ok and 1 for battery failure.
2.6.3 04/10/14