diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2017-06-16 10:45:36 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2017-06-16 12:48:39 +0200 |
commit | 37133b0acb35953176a777dc558e62c1c72ccaa9 (patch) | |
tree | ad9f8abebd3b9c46bea3b320dc914876f6a69f3d | |
parent | 7a57c594b6ae02171a21d0ab088d5daaff5b964e (diff) | |
download | libsigrokdecode-37133b0acb35953176a777dc558e62c1c72ccaa9.tar.gz libsigrokdecode-37133b0acb35953176a777dc558e62c1c72ccaa9.zip |
dali: Random cleanups, remove obsolete comments.
-rw-r--r-- | decoders/dali/pd.py | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/decoders/dali/pd.py b/decoders/dali/pd.py index 5b801a1..f45306a 100644 --- a/decoders/dali/pd.py +++ b/decoders/dali/pd.py @@ -52,7 +52,7 @@ class Decoder(srd.Decoder): annotation_rows = ( ('bits', 'Bits', (0,)), ('raw', 'Raw data', (7,)), - ('fields', 'Fields', (1, 2, 3, 4, 5, 6,)), + ('fields', 'Fields', (1, 2, 3, 4, 5, 6)), ) def __init__(self): @@ -60,8 +60,6 @@ class Decoder(srd.Decoder): self.samplenum = None self.edges, self.bits, self.ss_es_bits = [], [], [] self.state = 'IDLE' - self.nextSamplePoint = None - self.nextSample = None self.devType = None def start(self): @@ -151,7 +149,6 @@ class Decoder(srd.Decoder): s = ['YBit: %d' % b[1][1], 'YB: %d' % b[1][1], 'YB', 'Y', 'Y'] self.putb(1, 1, [3, s]) a = f >> 1 - # x = system.get(a, ['Unknown', 'Unk']) s = ['Short address: %d' % a, 'Addr: %d' % a, 'Addr: %d' % a, 'A: %d' % a, 'A'] self.putb(2, 7, [4, s]) @@ -198,18 +195,13 @@ class Decoder(srd.Decoder): def reset_decoder_state(self): self.edges, self.bits, self.ss_es_bits = [], [], [] self.state = 'IDLE' - # self.devType = None def decode(self, ss, es, data): if not self.samplerate: raise SamplerateError('Cannot decode without samplerate.') - bit = 0; + bit = 0 for (self.samplenum, pins) in data: self.dali = pins[0] - # data.itercnt += 1 - # data.logic_mask = 1 - # data.cur_pos = self.samplenum - # data.edge_index = -1 if self.options['polarity'] == 'active-high': self.dali ^= 1 # Invert. @@ -217,24 +209,12 @@ class Decoder(srd.Decoder): if self.state == 'IDLE': # Wait for any edge (rising or falling). if self.old_dali == self.dali: - # data.exp_logic = self.exp_logic - # data.logic_mask = 1 - # logic.cur_pos = self.samplenum continue self.edges.append(self.samplenum) self.state = 'PHASE0' self.old_dali = self.dali - # Get the next sample point. - # self.nextSamplePoint = self.samplenum + int(self.halfbit / 2) - self.old_dali = self.dali - # bit = self.dali - # data.itercnt += int((self.halfbit - 1) * 0.5) continue - # if(self.samplenum == self.nextSamplePoint): - # bit = self.dali - # continue - if (self.old_dali != self.dali): self.edges.append(self.samplenum) elif (self.samplenum == (self.edges[-1] + int(self.halfbit * 1.5))): @@ -247,9 +227,9 @@ class Decoder(srd.Decoder): self.phase0 = bit self.state = 'PHASE1' elif self.state == 'PHASE1': - if (bit == 1) and (self.phase0 == 1): # Stop bit + if (bit == 1) and (self.phase0 == 1): # Stop bit. if len(self.bits) == 17 or len(self.bits) == 9: - # Forward or Backward + # Forward or Backward. self.handle_bits(len(self.bits)) self.reset_decoder_state() # Reset upon errors. continue @@ -257,6 +237,4 @@ class Decoder(srd.Decoder): self.bits.append([self.edges[-3], bit]) self.state = 'PHASE0' - # self.nextSamplePoint = self.edges[-1] + int(self.halfbit / 2) - self.old_dali = self.dali |