# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2015-05-18 17:35:26 # Node ID 2beacef495bf8246d294919ca9c78db1599354fa # Parent a6f1f85f1eba5f1dbc390c35dffbdad04f2a3db9 added float test data generation to pseudo device script diff --git a/misc/pseudo_device.py b/misc/pseudo_device.py --- a/misc/pseudo_device.py +++ b/misc/pseudo_device.py @@ -24,7 +24,7 @@ # along with serialplot. If not, see . # -import os, pty, time +import os, pty, time, struct def ascii_test(port): """Put ASCII test data through pseudo terminal.""" @@ -39,6 +39,15 @@ def ascii_test(port): os.write(port, bytes(data + "\r\n", 'ASCII')) time.sleep(0.1) +def float_test(port): + """Put 32-bit float test data through pseudo terminal""" + for i in range(0, 1000): + f = float(i)/3.0 + data = struct.pack('f', f) + os.write(port, data) + import binascii + time.sleep(0.1) + def run(): # create the pseudo terminal master, slave = pty.openpty() @@ -48,7 +57,7 @@ def run(): print("Master terminal: {}\nSlave terminal: {}".format(master_name, slave_name)) try: - ascii_test(master) + float_test(master) finally: # close the pseudo terminal files os.close(master)