From: Uwe Hermann Date: Wed, 20 Apr 2016 17:31:21 +0000 (+0200) Subject: timing: Use self.samplenum for consistency across PDs. X-Git-Tag: libsigrokdecode-0.5.0~184 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=963d71d5527c9c1cf16bb8d5fbeed2d452ffd5c0;p=libsigrokdecode.git timing: Use self.samplenum for consistency across PDs. --- diff --git a/decoders/timing/pd.py b/decoders/timing/pd.py index 6bca120..5e2aaa7 100644 --- a/decoders/timing/pd.py +++ b/decoders/timing/pd.py @@ -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