diff options
author | Gerhard Sittig <gerhard.sittig@gmx.net> | 2018-01-28 20:02:09 +0100 |
---|---|---|
committer | Gerhard Sittig <gerhard.sittig@gmx.net> | 2018-01-28 20:12:28 +0100 |
commit | 956721de58552b05776c8613449f2907196e61e9 (patch) | |
tree | 786f3795cec5fe63f722bc368986e2de23229fec /decoders | |
parent | 93b9270267472ab2bec5f4ad979531c0d2e7fbcd (diff) | |
download | libsigrokdecode-956721de58552b05776c8613449f2907196e61e9.tar.gz libsigrokdecode-956721de58552b05776c8613449f2907196e61e9.zip |
spi: cope when a sample rate of 0 was configured
The explicit test for None was not good enough. Change test conditions
such that sample rates only get processed when they got specified _and_
were not zero.
This fixes bug #1118.
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/spi/pd.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/decoders/spi/pd.py b/decoders/spi/pd.py index 32fe8da..9beb4e6 100644 --- a/decoders/spi/pd.py +++ b/decoders/spi/pd.py @@ -145,7 +145,7 @@ class Decoder(srd.Decoder): self.out_python = self.register(srd.OUTPUT_PYTHON) self.out_ann = self.register(srd.OUTPUT_ANN) self.out_binary = self.register(srd.OUTPUT_BINARY) - if self.samplerate is not None: + if self.samplerate: self.out_bitrate = self.register(srd.OUTPUT_META, meta=(int, 'Bitrate', 'Bitrate during transfers')) self.bw = (self.options['wordsize'] + 7) // 8 @@ -253,7 +253,7 @@ class Decoder(srd.Decoder): self.putdata() # Meta bitrate. - if self.samplerate is not None: + if self.samplerate: elapsed = 1 / float(self.samplerate) elapsed *= (self.samplenum - self.ss_block + 1) bitrate = int(1 / elapsed * ws) |