diff options
author | Gerhard Sittig <gerhard.sittig@gmx.net> | 2018-05-27 09:46:01 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2018-05-30 14:16:58 +0200 |
commit | 647d52869813b2df8ee82837f17681a77d0521e0 (patch) | |
tree | cbfabea27ca7e21c5fd72f40e8fde4c3cc441e2d /decoders/counter/pd.py | |
parent | 866a80dbed40dcd295efd4c7f28288b7835c973d (diff) | |
download | libsigrokdecode-647d52869813b2df8ee82837f17681a77d0521e0.tar.gz libsigrokdecode-647d52869813b2df8ee82837f17681a77d0521e0.zip |
counter: prepare for variable width annotations
Explicitly pass a start sample number to the .putc() method, to prepare
annotations where ss differs from es. This is motivated by bug #1210.
Stick with the narrow ss=es annotations for backwards compatibility.
Diffstat (limited to 'decoders/counter/pd.py')
-rw-r--r-- | decoders/counter/pd.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/decoders/counter/pd.py b/decoders/counter/pd.py index 905de6e..23cbd97 100644 --- a/decoders/counter/pd.py +++ b/decoders/counter/pd.py @@ -68,8 +68,8 @@ class Decoder(srd.Decoder): def start(self): self.out_ann = self.register(srd.OUTPUT_ANN) - def putc(self, cls, annlist): - self.put(self.samplenum, self.samplenum, self.out_ann, [cls, annlist]) + def putc(self, cls, ss, annlist): + self.put(ss, self.samplenum, self.out_ann, [cls, annlist]) def decode(self): opt_edge_map = {'rising': 'r', 'falling': 'f', 'any': 'e'} @@ -90,16 +90,17 @@ class Decoder(srd.Decoder): word_count = 0 while True: self.wait(condition) + now = self.samplenum if have_reset and self.matched[cond_reset]: edge_count = 0 word_count = 0 - self.putc(ROW_RESET, ['Word reset', 'Reset', 'Rst', 'R']) + self.putc(ROW_RESET, now, ['Word reset', 'Reset', 'Rst', 'R']) continue edge_count += 1 - self.putc(ROW_EDGE, ["{:d}".format(edge_count)]) + self.putc(ROW_EDGE, now, ["{:d}".format(edge_count)]) if divider and (edge_count % divider) == 0: word_count += 1 - self.putc(ROW_WORD, ["{:d}".format(word_count)]) + self.putc(ROW_WORD, now, ["{:d}".format(word_count)]) |