mirror of
https://github.com/romanz/amodem.git
synced 2026-04-21 13:46:30 +08:00
ecc.py: fix logging level to DEBUG
This commit is contained in:
7
ecc.py
7
ecc.py
@@ -11,7 +11,7 @@ BLOCK_SIZE = 255
|
|||||||
LEN_FMT = '<I'
|
LEN_FMT = '<I'
|
||||||
|
|
||||||
def encode(data, nsym=DEFAULT_NSYM):
|
def encode(data, nsym=DEFAULT_NSYM):
|
||||||
log.info('Encoded {} bytes'.format(len(data)))
|
log.debug('Encoded {} bytes'.format(len(data)))
|
||||||
data = bytearray(struct.pack(LEN_FMT, len(data)) + data)
|
data = bytearray(struct.pack(LEN_FMT, len(data)) + data)
|
||||||
chunk_size = BLOCK_SIZE - nsym
|
chunk_size = BLOCK_SIZE - nsym
|
||||||
enc = bytearray()
|
enc = bytearray()
|
||||||
@@ -31,9 +31,9 @@ def decode(data, nsym=DEFAULT_NSYM):
|
|||||||
chunk = data[i:i+BLOCK_SIZE]
|
chunk = data[i:i+BLOCK_SIZE]
|
||||||
try:
|
try:
|
||||||
dec.extend(rs_correct_msg(chunk, nsym))
|
dec.extend(rs_correct_msg(chunk, nsym))
|
||||||
log.info('Decoded %d blocks = %d bytes', (i+1) / BLOCK_SIZE, len(dec))
|
log.debug('Decoded %d blocks = %d bytes', (i+1) / BLOCK_SIZE, len(dec))
|
||||||
except ReedSolomonError as e:
|
except ReedSolomonError as e:
|
||||||
log.info('Decoding stopped: %s', e)
|
log.debug('Decoding stopped: %s', e)
|
||||||
break
|
break
|
||||||
|
|
||||||
if i == 0:
|
if i == 0:
|
||||||
@@ -50,5 +50,4 @@ def decode(data, nsym=DEFAULT_NSYM):
|
|||||||
log.warning('%d bytes are missing!', length - len(payload))
|
log.warning('%d bytes are missing!', length - len(payload))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
log.info('Decoded {} bytes'.format(length))
|
|
||||||
return payload[:length]
|
return payload[:length]
|
||||||
|
|||||||
Reference in New Issue
Block a user