]> sigrok.org Git - libsigrokdecode.git/commitdiff
atsha204a: Only call output_tx_bytes() when the bytes buffer is not empty
authorMichalis Pappas <redacted>
Sat, 26 Jan 2019 21:28:04 +0000 (22:28 +0100)
committerUwe Hermann <redacted>
Tue, 30 Apr 2019 20:07:41 +0000 (22:07 +0200)
decoders/atsha204a/pd.py

index d149c497a42195b9ee94f6f94f186dda7f0fa715..8e37e5b95d6ee62a0b88f7117adbf67a9eb5ce19 100644 (file)
@@ -287,7 +287,6 @@ class Decoder(srd.Decoder):
 
     def decode(self, ss, es, data):
         cmd, databyte = data
-
         # State machine.
         if self.state == 'IDLE':
             # Wait for an I²C START condition.
@@ -309,7 +308,8 @@ class Decoder(srd.Decoder):
                 # Reset the opcode before received data, as this causes
                 # responses to be displayed incorrectly.
                 self.opcode = -1
-                self.output_rx_bytes()
+                if len(self.bytes) > 0:
+                        self.output_rx_bytes()
                 self.waddr = -1
                 self.bytes = []
                 self.state = 'IDLE'