]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/spdif/pd.py
ir_nec: sort and comment timing specs, drop tolerance option
[libsigrokdecode.git] / decoders / spdif / pd.py
index fa90cb9198f7f98d82fe18a15122e1396a4432c1..1b7f6e92a7cf196f3e1e5edc4953d8c32d997f4c 100644 (file)
@@ -107,17 +107,17 @@ class Decoder(srd.Decoder):
         if self.pulse_width != 0:
             self.clocks.append(self.pulse_width)
             self.state = 'GET SECOND PULSE WIDTH'
-            self.puty([2, ['Found width 1: %d' % (self.pulse_width), 'W1: %d' % (self.pulse_width)]])
+            self.puty([2, ['Found width 1: %d' % self.pulse_width, 'W1: %d' % self.pulse_width]])
             self.ss_edge = self.samplenum
 
     def find_second_pulse_width(self):
         if self.pulse_width > (self.clocks[0] * 1.3) or \
                 self.pulse_width <= (self.clocks[0] * 0.75):
-            self.puty([2, ['Found width 2: %d' % (self.pulse_width), 'W2: %d' % (self.pulse_width)]])
+            self.puty([2, ['Found width 2: %d' % self.pulse_width, 'W2: %d' % self.pulse_width]])
             self.clocks.append(self.pulse_width)
             self.state = 'GET THIRD PULSE WIDTH'
         else:
-            self.puty([2, ['Search width 2: %d' % (self.pulse_width), 'SW2: %d' % (self.pulse_width)]])
+            self.puty([2, ['Search width 2: %d' % self.pulse_width, 'SW2: %d' % self.pulse_width]])
         self.ss_edge = self.samplenum
 
     def find_third_pulse_width(self):
@@ -125,11 +125,11 @@ class Decoder(srd.Decoder):
                 self.pulse_width <= (self.clocks[0] * 0.75)) \
                 and (self.pulse_width > (self.clocks[1] * 1.3) or \
                 self.pulse_width <= (self.clocks[1] * 0.75))):
-            self.puty([2, ['Search width 3: %d' % (self.pulse_width), 'SW3: %d' % (self.pulse_width)]])
+            self.puty([2, ['Search width 3: %d' % self.pulse_width, 'SW3: %d' % self.pulse_width]])
             self.ss_edge = self.samplenum
             return
         else:
-            self.puty([2, ['Found width 3: %d' % (self.pulse_width), 'W3: %d' % (self.pulse_width)]])
+            self.puty([2, ['Found width 3: %d' % self.pulse_width, 'W3: %d' % self.pulse_width]])
             self.ss_edge = self.samplenum
             # The message of the calculated bitrate should start at this sample
             # (right after the synchronisation).
@@ -266,10 +266,7 @@ class Decoder(srd.Decoder):
 
     def decode(self):
         # Set samplerate to 0 if it is not given. Decoding is still possible.
-        try:
-            if self.samplerate != 0:
-                pass
-        except:
+        if not self.samplerate:
             self.samplerate = 0
 
         # Throw away first two edges as it might be mangled data.