From 64b5c3d0f6a7523d85a75f82db5495842ead282c Mon Sep 17 00:00:00 2001 From: akuker Date: Sat, 18 Jul 2020 17:59:52 -0500 Subject: [PATCH] Fix formatting to match WaveDrom --- src/raspberrypi/convert_data.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/raspberrypi/convert_data.py b/src/raspberrypi/convert_data.py index 7d3d77b..a57d1a5 100644 --- a/src/raspberrypi/convert_data.py +++ b/src/raspberrypi/convert_data.py @@ -4,7 +4,8 @@ import sys outfile = open('data.json', 'w') infile = open('timing_drawer.txt','r') - + +print("{signal: [", file=outfile) firstline = infile.readline() num_columns = len(firstline.split(";")) @@ -29,7 +30,7 @@ while (field_num < num_columns): elif (z == '00'): out = '0' else: - out = '1' + out = '2' print(out, file=outfile, end='') prev_val = z print("', data: [", file=outfile, end='') @@ -52,11 +53,11 @@ while (field_num < num_columns): prev_val = z print(z, file=outfile, end='') - print("'},", file=outfile) + print("'},", file=outfile) field_num = field_num + 1 - +print("]}", file=outfile) outfile.close()