]> sigrok.org Git - libsigrokdecode.git/commitdiff
timing: Use self.samplenum for consistency across PDs.
authorUwe Hermann <redacted>
Wed, 20 Apr 2016 17:31:21 +0000 (19:31 +0200)
committerUwe Hermann <redacted>
Wed, 20 Apr 2016 17:31:21 +0000 (19:31 +0200)
decoders/timing/pd.py

index 6bca12085e7843383ec7c03d4b8de66a17503171..5e2aaa7033bc4f42a3a37364e0e4fee01a901028 100644 (file)
@@ -71,24 +71,24 @@ class Decoder(srd.Decoder):
         if not self.samplerate:
             raise SamplerateError('Cannot decode without samplerate.')
 
-        for (samplenum, (pin,)) in data:
+        for (self.samplenum, (pin,)) in data:
             # Ignore identical samples early on (for performance reasons).
             if self.oldpin == pin:
                 continue
 
             if self.oldpin is None:
                 self.oldpin = pin
-                self.last_samplenum = samplenum
+                self.last_samplenum = self.samplenum
                 continue
 
             if self.oldpin != pin:
-                samples = samplenum - self.last_samplenum
+                samples = self.samplenum - self.last_samplenum
                 t = samples / self.samplerate
 
                 # Report the timing normalized.
-                self.put(self.last_samplenum, samplenum, self.out_ann,
+                self.put(self.last_samplenum, self.samplenum, self.out_ann,
                          [0, [normalize_time(t)]])
 
                 # Store data for next round.
-                self.last_samplenum = samplenum
+                self.last_samplenum = self.samplenum
                 self.oldpin = pin