From: Uwe Hermann Date: Sun, 23 Nov 2014 22:06:45 +0000 (+0100) Subject: jitter: Simplify ascii-float binary out. X-Git-Tag: libsigrokdecode-0.4.0~141 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=commitdiff_plain;h=70aa53ec10dabe4a5267e142974b35d1312f7119;hp=05aaa48637fe56ac087569d784dbfdc91341f619 jitter: Simplify ascii-float binary out. This also outputs one item of OUT_BINARY per jitter value (not one item per ASCII character in the ASCII floating point number). --- diff --git a/decoders/jitter/pd.py b/decoders/jitter/pd.py index f2fdb62..d6db8e5 100644 --- a/decoders/jitter/pd.py +++ b/decoders/jitter/pd.py @@ -109,10 +109,10 @@ class Decoder(srd.Decoder): def putb(self, delta): if delta is None: return - # Format the delta to an ASCII float output. - for x in str(delta): - self.put(self.clk_start, self.sig_start, self.out_bin, (0, bytes([ord(x)]))) - self.put(self.clk_start, self.sig_start, self.out_bin, (0, bytes([ord('\n')]))) + # Format the delta to an ASCII float value terminated by a newline. + x = str(delta) + '\n' + self.put(self.clk_start, self.sig_start, self.out_bin, + (0, x.encode('UTF-8'))) # Helper function for missed clock and signal annotations. def putm(self, data):