X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fdcf77%2Fdcf77.py;h=573888f15e88e91c20d7521d98d55df5fac3adaa;hb=6b249180f1f15eb1d10c617f76b35d1535c0d4f7;hp=ab600eddff400b60ae0fab78c6bb3d8a35de67f5;hpb=156509ca42f0df2380c9f205f9aad337e1a07802;p=libsigrokdecode.git diff --git a/decoders/dcf77/dcf77.py b/decoders/dcf77/dcf77.py index ab600ed..573888f 100644 --- a/decoders/dcf77/dcf77.py +++ b/decoders/dcf77/dcf77.py @@ -23,10 +23,6 @@ import sigrokdecode as srd import calendar -# States -WAIT_FOR_RISING_EDGE = 0 -GET_BIT = 1 - # Annotation feed formats ANN_ASCII = 0 @@ -40,7 +36,6 @@ class Decoder(srd.Decoder): name = 'DCF77' longname = 'DCF77 time protocol' desc = 'TODO.' - longdesc = 'TODO.' license = 'gplv2+' inputs = ['logic'] outputs = ['dcf77'] @@ -57,7 +52,7 @@ class Decoder(srd.Decoder): ] def __init__(self, **kwargs): - self.state = WAIT_FOR_RISING_EDGE + self.state = 'WAIT FOR RISING EDGE' self.oldval = None self.samplenum = 0 self.bit_start = 0 @@ -204,11 +199,9 @@ class Decoder(srd.Decoder): raise Exception('Invalid DCF77 bit: %d' % c) def decode(self, ss, es, data): - for samplenum, (val) in data: # TODO: Handle optional PON. - - self.samplenum += 1 # FIXME. Use samplenum. Off-by-one? + for (self.samplenum, (val)) in data: # TODO: Handle optional PON. - if self.state == WAIT_FOR_RISING_EDGE: + if self.state == 'WAIT FOR RISING EDGE': # Wait until the next rising edge occurs. if not (self.oldval == 0 and val == 1): self.oldval = val @@ -262,7 +255,7 @@ class Decoder(srd.Decoder): self.handle_dcf77_bit(bit) self.bitcount += 1 - self.state = WAIT_FOR_RISING_EDGE + self.state = 'WAIT FOR RISING EDGE' else: raise Exception('Invalid state: %d' % self.state)