summaryrefslogtreecommitdiff
path: root/decoders/pan1321
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2013-08-09 19:11:08 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2013-09-02 09:05:01 +0200
commitdb9ebbc2143f4b744b273ed0d5bbfd4b02aa8db9 (patch)
treee4dbe651515592dc303c523f2b65a38f5a0cccca /decoders/pan1321
parent6bbd2a8afb1daa76bc14866c2c1a345b1cea5e44 (diff)
downloadlibsigrokdecode-db9ebbc2143f4b744b273ed0d5bbfd4b02aa8db9.tar.gz
libsigrokdecode-db9ebbc2143f4b744b273ed0d5bbfd4b02aa8db9.zip
pan1321: Code simplifications.
Diffstat (limited to 'decoders/pan1321')
-rw-r--r--decoders/pan1321/pd.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/decoders/pan1321/pd.py b/decoders/pan1321/pd.py
index 50f5adf..3799612 100644
--- a/decoders/pan1321/pd.py
+++ b/decoders/pan1321/pd.py
@@ -63,7 +63,6 @@ class Decoder(srd.Decoder):
p = s[s.find('=') + 1:]
if p not in ('0', '1'):
self.putx([2, ['Warning: Invalid JPRO parameter "%s"' % p]])
- self.cmd[rxtx] = ''
return
onoff = 'off' if (p == '0') else 'on'
x = 'Leaving' if (p == '0') else 'Entering'
@@ -72,7 +71,6 @@ class Decoder(srd.Decoder):
elif s.startswith('AT+JRES'):
if s != 'AT+JRES': # JRES has no params.
self.putx([2, ['Warning: Invalid JRES usage.']])
- self.cmd[rxtx] = ''
return
self.putx([0, ['Triggering a software reset']])
self.putx([1, ['Reset']])
@@ -87,7 +85,6 @@ class Decoder(srd.Decoder):
else:
self.putx([0, ['Host sent unsupported command: %s' % s]])
self.putx([1, ['Unsupported command: %s' % s]])
- self.cmd[rxtx] = ''
def handle_device_reply(self, rxtx, s):
if s == 'ROK':
@@ -103,7 +100,6 @@ class Decoder(srd.Decoder):
else:
self.putx([0, ['Device sent an unknown reply: %s' % s]])
self.putx([1, ['Unknown reply: %s' % s]])
- self.cmd[rxtx] = ''
def decode(self, ss, es, data):
ptype, rxtx, pdata = data
@@ -125,12 +121,13 @@ class Decoder(srd.Decoder):
# Handle host commands and device replies.
# We remove trailing \r\n from the strings before handling them.
+ self.es_block = es
if rxtx == RX:
- self.es_block = es
self.handle_device_reply(rxtx, self.cmd[rxtx][:-2])
elif rxtx == TX:
- self.es_block = es
self.handle_host_command(rxtx, self.cmd[rxtx][:-2])
else:
raise Exception('Invalid rxtx value: %d' % rxtx)
+ self.cmd[rxtx] = ''
+