Sfoglia il codice sorgente

update serial read_line

main
AJ Schmidt 3 anni fa
parent
commit
a48cecee59
2 ha cambiato i file con 6 aggiunte e 6 eliminazioni
  1. +1
    -1
      alarmdecoder/devices/serial_device.py
  2. +5
    -5
      alarmdecoder/util.py

+ 1
- 1
alarmdecoder/devices/serial_device.py Vedi File

@@ -229,7 +229,7 @@ class SerialDevice(Device):
buf = filter_ad2prot_byte(self._device.read(1))

if buf != b'':
self._buffer += buf[0]
self._buffer += buf

if buf == b"\n":
self._buffer = self._buffer.rstrip(b"\r\n")


+ 5
- 5
alarmdecoder/util.py Vedi File

@@ -97,14 +97,14 @@ def filter_ad2prot_byte(buf):
"""
Return the byte sent in back if valid visible terminal characters or line terminators.
"""
c = buf[0];
c = buf[0]

if (c == '\n' or c == '\r'):
return c
if (c == 10 or c == 13):
return buf
if (c > 31 and c < 127):
return c
return buf
else:
return ''
return b''

def read_firmware_file(file_path):
"""


Caricamento…
Annulla
Salva