summaryrefslogtreecommitdiff
path: root/decoders/graycode
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2018-01-28 20:49:48 +0100
committerGerhard Sittig <gerhard.sittig@gmx.net>2018-01-28 20:49:48 +0100
commit15a8a05595c72d328abdea8e3b23f1b558cc46bf (patch)
treedf65ff2c6163724aa5f49275086963fa3660b6a5 /decoders/graycode
parent956721de58552b05776c8613449f2907196e61e9 (diff)
downloadlibsigrokdecode-15a8a05595c72d328abdea8e3b23f1b558cc46bf.tar.gz
libsigrokdecode-15a8a05595c72d328abdea8e3b23f1b558cc46bf.zip
graycode, morse, pwm, usb_request, wiegand: cope with absent sample rate
Improve robustness of some more protocol decoders. Few of them never checked for the availability of a sample rate in the first place, others checked for the presence of a spec but would not cope with a value of 0. Some checked the value only after processing it, which could result in runtime errors. This change is motivated by bug #1118.
Diffstat (limited to 'decoders/graycode')
-rw-r--r--decoders/graycode/pd.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/decoders/graycode/pd.py b/decoders/graycode/pd.py
index 1211c69..ef5d513 100644
--- a/decoders/graycode/pd.py
+++ b/decoders/graycode/pd.py
@@ -175,7 +175,7 @@ class Decoder(srd.Decoder):
if self.options['edges']:
self.turns.set(self.samplenum, self.count.get() // self.options['edges'])
- if self.samplerate is not None:
+ if self.samplerate:
period = (curtime - prevtime) / self.samplerate
freq = abs(phasedelta_raw) / period