Browse Source

Misc display cleanup

tags/v1.0
Jim Paris 11 years ago
parent
commit
5fbcca0675
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      terminal.py

+ 7
- 3
terminal.py View File

@@ -122,7 +122,11 @@ class Miniterm:
data = self.serial.read(1)
if not data:
continue
sys.stdout.write(data)
if ((ord(data) >= 32 and ord(data) < 128) or
data == '\r' or data == '\n' or data == '\t'):
sys.stdout.write(data)
else:
sys.stdout.write('\\x'+("0"+hex(ord(data))[2:])[-2:])
sys.stdout.flush()
except Exception as e:
traceback.print_exc()
@@ -166,8 +170,8 @@ class Miniterm:
self.start()
self.join()
print ""
self.console.cleanup()
self.serial.timeout = saved_timeout
self.console.cleanup()

if __name__ == "__main__":
import argparse
@@ -211,7 +215,7 @@ if __name__ == "__main__":

if not args.quiet:
print color.reset + "^C to exit"
print color.reset + "--"
print color.reset + "----------"
term = Miniterm(dev)
term.run()


Loading…
Cancel
Save