tools/flterm.py: small clean up
This commit is contained in:
parent
94b62eff8b
commit
1a1c9b4420
|
@ -119,7 +119,7 @@ class Flterm:
|
||||||
|
|
||||||
def write_exact(self, data):
|
def write_exact(self, data):
|
||||||
if isinstance(data, str):
|
if isinstance(data, str):
|
||||||
self.serial.write(bytes(data, "latin1"))
|
self.serial.write(bytes(data, "utf-8"))
|
||||||
else:
|
else:
|
||||||
self.serial.write(serial.to_bytes(data))
|
self.serial.write(serial.to_bytes(data))
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class Flterm:
|
||||||
while retry:
|
while retry:
|
||||||
self.write_exact(frame.raw)
|
self.write_exact(frame.raw)
|
||||||
# Get the reply from the device
|
# Get the reply from the device
|
||||||
reply = character(self.serial.read(1))
|
reply = character(self.serial.read())
|
||||||
if reply == sfl_ack_success:
|
if reply == sfl_ack_success:
|
||||||
retry = 0
|
retry = 0
|
||||||
elif reply == sfl_ack_crcerror:
|
elif reply == sfl_ack_crcerror:
|
||||||
|
@ -201,7 +201,7 @@ class Flterm:
|
||||||
def reader(self):
|
def reader(self):
|
||||||
try:
|
try:
|
||||||
while self.reader_alive:
|
while self.reader_alive:
|
||||||
c = character(self.serial.read(1))
|
c = character(self.serial.read())
|
||||||
if c == '\r':
|
if c == '\r':
|
||||||
sys.stdout.write('\n')
|
sys.stdout.write('\n')
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue