diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2014-10-12 14:31:21 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2014-10-12 14:59:46 +0200 |
commit | 47405f47db235c06d9f2ad26ae51791136b62a91 (patch) | |
tree | c7ee2e251ed3abe20a27af45178368e3fe5ae740 /decoders/am230x/pd.py | |
parent | b1f2b85bd9a7cb79265f251cbecba84cdc04dd5e (diff) | |
download | libsigrokdecode-47405f47db235c06d9f2ad26ae51791136b62a91.tar.gz libsigrokdecode-47405f47db235c06d9f2ad26ae51791136b62a91.zip |
am230x: Minor cosmetics.
Diffstat (limited to 'decoders/am230x/pd.py')
-rw-r--r-- | decoders/am230x/pd.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/decoders/am230x/pd.py b/decoders/am230x/pd.py index 05489d9..d7cbad2 100644 --- a/decoders/am230x/pd.py +++ b/decoders/am230x/pd.py @@ -37,9 +37,9 @@ class SamplerateError(Exception): class Decoder(srd.Decoder): api_version = 2 id = 'am230x' - name = 'AM230x' - longname = 'AM230x humidity and temperature sensors' - desc = 'Proprietary single wire communication bus.' + name = 'AM230x/DHTxx' + longname = 'Aosong AM230x/DHTxx' + desc = 'Aosong AM230x/DHTxx humidity/temperature sensor protocol.' license = 'gplv2+' inputs = ['logic'] outputs = ['am230x'] @@ -95,8 +95,8 @@ class Decoder(srd.Decoder): def bits2num(self, bitlist): number = 0 - for i in range(0, len(bitlist)): - number += bitlist[-1-i] * 2**i + for i in range(len(bitlist)): + number += bitlist[-1 - i] * 2**i return number def calculate_humidity(self, bitlist): @@ -119,7 +119,7 @@ class Decoder(srd.Decoder): def calculate_checksum(self, bitlist): checksum = 0 - for i in range(8, len(bitlist)+1, 8): + for i in range(8, len(bitlist) + 1, 8): checksum += self.bits2num(bitlist[i-8:i]) return checksum % 256 |