diff options
Diffstat (limited to 'decoders/dcf77/pd.py')
-rw-r--r-- | decoders/dcf77/pd.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/decoders/dcf77/pd.py b/decoders/dcf77/pd.py index 3f0ff50..14d8637 100644 --- a/decoders/dcf77/pd.py +++ b/decoders/dcf77/pd.py @@ -25,6 +25,9 @@ import calendar def bcd2int(b): return (b & 0x0f) + ((b >> 4) * 10) +class SamplerateError(Exception): + pass + class Decoder(srd.Decoder): api_version = 2 id = 'dcf77' @@ -245,8 +248,8 @@ class Decoder(srd.Decoder): raise Exception('Invalid DCF77 bit: %d' % c) def decode(self, ss, es, data): - if self.samplerate is None: - raise Exception("Cannot decode without samplerate.") + if not self.samplerate: + raise SamplerateError('Cannot decode without samplerate.') for (self.samplenum, pins) in data: # Ignore identical samples early on (for performance reasons). |