mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
counting errors based on rx_status
This commit is contained in:
parent
e93dc4d197
commit
55ae1c31ef
|
@ -63,7 +63,7 @@ add_test(NAME 001_highsnr_virtual_P_P
|
||||||
PATH=$PATH:${CODEC2_BUILD_DIR}/src;
|
PATH=$PATH:${CODEC2_BUILD_DIR}/src;
|
||||||
cd ${CMAKE_CURRENT_SOURCE_DIR}/test/001_highsnr_stdio_audio;
|
cd ${CMAKE_CURRENT_SOURCE_DIR}/test/001_highsnr_stdio_audio;
|
||||||
./test_virtual.sh")
|
./test_virtual.sh")
|
||||||
set_tests_properties(001_highsnr_virtual_P_P PROPERTIES PASS_REGULAR_EXPRESSION "RECEIVED BURSTS: 1 RECEIVED FRAMES: 2")
|
set_tests_properties(001_highsnr_virtual_P_P PROPERTIES PASS_REGULAR_EXPRESSION "RECEIVED BURSTS: 5 RECEIVED FRAMES: 10 RX_ERRORS: 0")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,7 @@ total_n_bytes = 0
|
||||||
rx_total_frames = 0
|
rx_total_frames = 0
|
||||||
rx_frames = 0
|
rx_frames = 0
|
||||||
rx_bursts = 0
|
rx_bursts = 0
|
||||||
|
rx_errors = 0
|
||||||
timeout = time.time() + 10
|
timeout = time.time() + 10
|
||||||
receive = True
|
receive = True
|
||||||
|
|
||||||
|
@ -106,8 +107,8 @@ while receive and time.time() < timeout:
|
||||||
nbytes = codec2.api.freedv_rawdatarx(freedv, bytes_out, data_in) # demodulate audio
|
nbytes = codec2.api.freedv_rawdatarx(freedv, bytes_out, data_in) # demodulate audio
|
||||||
total_n_bytes = total_n_bytes + nbytes
|
total_n_bytes = total_n_bytes + nbytes
|
||||||
|
|
||||||
|
rx_status = codec2.api.freedv_get_rx_status(freedv)
|
||||||
if DEBUGGING_MODE == True:
|
if DEBUGGING_MODE == True:
|
||||||
rx_status = codec2.api.freedv_get_rx_status(freedv)
|
|
||||||
rx_status_string = codec2.api.rx_sync_flags_to_text[rx_status]
|
rx_status_string = codec2.api.rx_sync_flags_to_text[rx_status]
|
||||||
print(f"rx_status: {rx_status_string}", file=sys.stderr)
|
print(f"rx_status: {rx_status_string}", file=sys.stderr)
|
||||||
|
|
||||||
|
@ -119,12 +120,14 @@ while receive and time.time() < timeout:
|
||||||
rx_frames = 0
|
rx_frames = 0
|
||||||
rx_bursts = rx_bursts + 1
|
rx_bursts = rx_bursts + 1
|
||||||
|
|
||||||
|
if rx_status & codec2.api.FREEDV_RX_BIT_ERRORS:
|
||||||
|
rx_errors = rx_errors + 1
|
||||||
|
|
||||||
if rx_bursts == N_BURSTS:
|
if rx_bursts == N_BURSTS:
|
||||||
receive = False
|
receive = False
|
||||||
|
|
||||||
|
|
||||||
print(f"RECEIVED BURSTS: {rx_bursts} RECEIVED FRAMES: {rx_total_frames}", file=sys.stderr)
|
print(f"RECEIVED BURSTS: {rx_bursts} RECEIVED FRAMES: {rx_total_frames} RX_ERRORS: {rx_errors}", file=sys.stderr)
|
||||||
|
|
||||||
# and at last check if we had an openend pyaudio instance and close it
|
# and at last check if we had an openend pyaudio instance and close it
|
||||||
if AUDIO_INPUT_DEVICE != -1:
|
if AUDIO_INPUT_DEVICE != -1:
|
||||||
|
|
|
@ -18,8 +18,8 @@ RX_LOG=$(mktemp)
|
||||||
# make sure all child processes are killed when we exit
|
# make sure all child processes are killed when we exit
|
||||||
trap 'jobs -p | xargs -r kill' EXIT
|
trap 'jobs -p | xargs -r kill' EXIT
|
||||||
|
|
||||||
python3 test_rx.py --mode datac0 --frames 2 --bursts 1 --audiodev 4 --debug &
|
python3 test_rx.py --mode datac0 --frames 2 --bursts 5 --audiodev 4 --debug &
|
||||||
rx_pid=$!
|
rx_pid=$!
|
||||||
sleep 1
|
sleep 1
|
||||||
python3 test_tx.py --mode datac0 --frames 2 --bursts 1 --audiodev 5
|
python3 test_tx.py --mode datac0 --frames 2 --bursts 5 --delay 500 --audiodev 5
|
||||||
wait ${rx_pid}
|
wait ${rx_pid}
|
||||||
|
|
|
@ -74,6 +74,12 @@ api.FREEDV_MODE_DATAC1 = 10
|
||||||
api.FREEDV_MODE_DATAC3 = 12
|
api.FREEDV_MODE_DATAC3 = 12
|
||||||
api.FREEDV_MODE_DATAC0 = 14
|
api.FREEDV_MODE_DATAC0 = 14
|
||||||
|
|
||||||
|
# Return code flags for freedv_get_rx_status() function
|
||||||
|
api.FREEDV_RX_TRIAL_SYNC = 0x1 # demodulator has trial sync
|
||||||
|
api.FREEDV_RX_SYNC = 0x2 # demodulator has sync
|
||||||
|
api.FREEDV_RX_BITS = 0x4 # data bits have been returned
|
||||||
|
api.FREEDV_RX_BIT_ERRORS = 0x8 # FEC may not have corrected all bit errors (not all parity checks OK)
|
||||||
|
|
||||||
api.rx_sync_flags_to_text = [
|
api.rx_sync_flags_to_text = [
|
||||||
"----",
|
"----",
|
||||||
"---T",
|
"---T",
|
||||||
|
|
Loading…
Reference in a new issue