]> sigrok.org Git - libsigrokdecode.git/commitdiff
timing: disable averaging if set to zero
authorKarl Palsson <redacted>
Fri, 20 Jan 2017 16:03:21 +0000 (16:03 +0000)
committerUwe Hermann <redacted>
Sat, 13 May 2017 14:11:23 +0000 (16:11 +0200)
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 <redacted>
decoders/timing/pd.py

index 19836b0b3014cbfc00edbbdef928fc082f5778f2..01e3b016f5bb5c9e6654b3a23b11ca1da0bfb697 100644 (file)
@@ -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