mirror of
https://github.com/romanz/amodem.git
synced 2026-05-03 08:27:26 +08:00
recv:: fix logging
This commit is contained in:
5
recv.py
5
recv.py
@@ -115,10 +115,12 @@ def receive(x, freqs):
|
|||||||
bits = sigproc.modulator.decode(S) # list of bit tuples
|
bits = sigproc.modulator.decode(S) # list of bit tuples
|
||||||
streams.append(bits)
|
streams.append(bits)
|
||||||
|
|
||||||
|
log.info('Demodulation started')
|
||||||
bitstream = []
|
bitstream = []
|
||||||
for block in itertools.izip(*streams):
|
for block in itertools.izip(*streams):
|
||||||
for bits in block:
|
for bits in block:
|
||||||
bitstream.extend(bits)
|
bitstream.extend(bits)
|
||||||
|
log.info('Demodulated %d bits => %.3f kB', len(bitstream), len(bitstream) / 8e3)
|
||||||
|
|
||||||
return bitstream
|
return bitstream
|
||||||
|
|
||||||
@@ -148,11 +150,10 @@ def main(fname):
|
|||||||
|
|
||||||
data_bits = receive(x / amp, frequencies)
|
data_bits = receive(x / amp, frequencies)
|
||||||
if data_bits is None:
|
if data_bits is None:
|
||||||
log.info('Cannot demodulate symbols!')
|
log.warning('Training failed!')
|
||||||
else:
|
else:
|
||||||
data = iterate(data_bits, bufsize=8, advance=8, func=to_byte)
|
data = iterate(data_bits, bufsize=8, advance=8, func=to_byte)
|
||||||
data = ''.join(c for _, c in data)
|
data = ''.join(c for _, c in data)
|
||||||
log.info('Demodulated %.3f kB', len(data) / 1e3)
|
|
||||||
import ecc
|
import ecc
|
||||||
data = ecc.decode(data)
|
data = ecc.decode(data)
|
||||||
if data is None:
|
if data is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user