summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorKarl Palsson <karlp@etactica.com>2017-01-20 16:03:21 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2017-05-13 16:11:23 +0200
commit82738302754039cffb4ee84b2fa9b1450612a5e3 (patch)
treee8980f69c41ef034e6b55957137d72e01184ae7c /decoders
parent888790e97cb51d65b64f3fbe43d91e40f4776b07 (diff)
downloadlibsigrokdecode-82738302754039cffb4ee84b2fa9b1450612a5e3.tar.gz
libsigrokdecode-82738302754039cffb4ee84b2fa9b1450612a5e3.zip
timing: disable averaging if set to zero
The extra row of the average isn't always useful. Allow it to be disabled by setting the average window to zero. Signed-off-by: Karl Palsson <karlp@etactica.com>
Diffstat (limited to 'decoders')
-rw-r--r--decoders/timing/pd.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/decoders/timing/pd.py b/decoders/timing/pd.py
index 19836b0..01e3b01 100644
--- a/decoders/timing/pd.py
+++ b/decoders/timing/pd.py
@@ -116,8 +116,9 @@ class Decoder(srd.Decoder):
# Report the timing normalized.
self.put(self.last_samplenum, self.samplenum, self.out_ann,
[0, [normalize_time(t)]])
- self.put(self.last_samplenum, self.samplenum, self.out_ann,
- [1, [normalize_time(sum(self.last_n) / len(self.last_n))]])
+ if self.options['avg_period'] > 0:
+ self.put(self.last_samplenum, self.samplenum, self.out_ann,
+ [1, [normalize_time(sum(self.last_n) / len(self.last_n))]])
# Store data for next round.
self.last_samplenum = self.samplenum