summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2020-05-02 15:08:41 +0200
committerGerhard Sittig <gerhard.sittig@gmx.net>2020-07-07 20:44:11 +0200
commitfcf7bf485a886370573c2e40a2eadb95acb3c936 (patch)
tree2b1f5e4e9d65c42dfff23de2bd43e34cc1affca4 /decoders
parent0e15a126ec2e2058b4fb35304cb650384900d934 (diff)
downloadlibsigrokdecode-fcf7bf485a886370573c2e40a2eadb95acb3c936.tar.gz
libsigrokdecode-fcf7bf485a886370573c2e40a2eadb95acb3c936.zip
sae_j1850_vpw: drop the part which duplicates the timing decoder
The SAE J1850 Variable Pulse Width decoder used to track and annotate the width of pulses between edges, which duplicates existing features of the 'timing' decoder. Remove this part from J1850, users can always connect the input signal to multiple decoders as needed.. Also sort annotation rows while we are here. Top to bottom represents raw wire bits to highest interpretation layer, as in other decoders.
Diffstat (limited to 'decoders')
-rw-r--r--decoders/sae_j1850_vpw/pd.py23
1 files changed, 3 insertions, 20 deletions
diff --git a/decoders/sae_j1850_vpw/pd.py b/decoders/sae_j1850_vpw/pd.py
index 4ecba5c..fd2389e 100644
--- a/decoders/sae_j1850_vpw/pd.py
+++ b/decoders/sae_j1850_vpw/pd.py
@@ -25,22 +25,9 @@ class SamplerateError(Exception):
def timeuf(t):
return int (t * 1000.0 * 1000.0)
-def normalize_time(t):
- if t >= 1.0:
- return '%d s' % t
- elif t >= 0.001:
- return '%d ms' % (t * 1000.0)
- elif t >= 0.000001:
- return '%d μs' % (t * 1000.0 * 1000.0)
- elif t >= 0.000000001:
- return '%d ns' % (t * 1000.0 * 1000.0 * 1000.0)
- else:
- return '%f' % t
-
class Ann:
- ANN_TIME, \
ANN_RAW, ANN_SOF, ANN_IFS, ANN_DATA, \
- ANN_PACKET = range(6)
+ ANN_PACKET = range(5)
class Decoder(srd.Decoder):
api_version = 3
@@ -56,7 +43,6 @@ class Decoder(srd.Decoder):
{'id': 'data', 'name': 'Data', 'desc': 'Data line'},
)
annotations = (
- ('time', 'Time'),
('raw', 'Raw'),
('sof', 'SOF'),
('ifs', 'EOF/IFS'),
@@ -64,10 +50,9 @@ class Decoder(srd.Decoder):
('packet', 'Packet'),
)
annotation_rows = (
- ('packets', 'Packets', (Ann.ANN_PACKET,)),
- ('bytes', 'Bytes', (Ann.ANN_DATA,)),
('raws', 'Raws', (Ann.ANN_RAW, Ann.ANN_SOF, Ann.ANN_IFS,)),
- ('times', 'Times', (Ann.ANN_TIME,)),
+ ('bytes', 'Bytes', (Ann.ANN_DATA,)),
+ ('packets', 'Packets', (Ann.ANN_PACKET,)),
)
def __init__(self):
@@ -147,8 +132,6 @@ class Decoder(srd.Decoder):
es = self.samplenum
samples = es - ss
- txt = normalize_time(samples / self.samplerate)
- self.put(ss, es, self.out_ann, [Ann.ANN_TIME, [txt]])
t = timeuf(samples / self.samplerate)
if self.state == 'IDLE': # detect and set speed from the size of sof
if pin == self.active and t in range(self.sofl , self.sofh):