mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
first test program
This commit is contained in:
parent
5a3326fa46
commit
e33b82b805
2 changed files with 52 additions and 6 deletions
|
@ -475,11 +475,11 @@ def create_default_ofdm_config():
|
||||||
nuwbits=40,
|
nuwbits=40,
|
||||||
bad_uw_errors=10,
|
bad_uw_errors=10,
|
||||||
ftwindowwidth=80,
|
ftwindowwidth=80,
|
||||||
edge_pilots=False,
|
edge_pilots=0,
|
||||||
state_machine=b"data",
|
state_machine="data".encode("utf-8"),
|
||||||
codename=b"H_1024_2048_4f",
|
codename=b"H_1024_2048_4f",
|
||||||
tx_uw=uw_sequence,
|
tx_uw=uw_sequence,
|
||||||
amp_est_mode=1,
|
amp_est_mode=True,
|
||||||
tx_bpf_en=False,
|
tx_bpf_en=False,
|
||||||
rx_bpf_en=False,
|
rx_bpf_en=False,
|
||||||
foff_limiter=False,
|
foff_limiter=False,
|
||||||
|
@ -507,7 +507,7 @@ def create_default_ofdm_config():
|
||||||
|
|
||||||
|
|
||||||
data_ofdm_500_config = create_default_ofdm_config()
|
data_ofdm_500_config = create_default_ofdm_config()
|
||||||
print(data_ofdm_500_config)
|
#print(data_ofdm_500_config)
|
||||||
data_ofdm_500_config.config.contents.ns = 5
|
data_ofdm_500_config.config.contents.ns = 5
|
||||||
data_ofdm_500_config.config.contents.np = 29
|
data_ofdm_500_config.config.contents.np = 29
|
||||||
data_ofdm_500_config.config.contents.tcp = 0.006
|
data_ofdm_500_config.config.contents.tcp = 0.006
|
||||||
|
@ -520,13 +520,17 @@ data_ofdm_500_config.config.contents.amp_est_mode = 1
|
||||||
data_ofdm_500_config.config.contents.amp_scale = 300E3
|
data_ofdm_500_config.config.contents.amp_scale = 300E3
|
||||||
data_ofdm_500_config.config.contents.codename = b"H_1024_2048_4f"
|
data_ofdm_500_config.config.contents.codename = b"H_1024_2048_4f"
|
||||||
data_ofdm_500_config.config.contents.clip_en = True
|
data_ofdm_500_config.config.contents.clip_en = True
|
||||||
data_ofdm_500_config.config.contents.clip_gain1 = 2.7;
|
data_ofdm_500_config.config.contents.clip_gain1 = 2.2;
|
||||||
data_ofdm_500_config.config.contents.clip_gain2 = 0.8;
|
data_ofdm_500_config.config.contents.clip_gain2 = 0.8;
|
||||||
data_ofdm_500_config.config.contents.timing_mx_thresh = 0.10;
|
data_ofdm_500_config.config.contents.timing_mx_thresh = 0.10;
|
||||||
data_ofdm_500_config.config.contents.tx_bpf_en = False
|
data_ofdm_500_config.config.contents.tx_bpf_en = False
|
||||||
data_ofdm_500_config.config.contents.rx_bpf_en = False
|
data_ofdm_500_config.config.contents.rx_bpf_en = False
|
||||||
# Fill the tx_uw field with the uw_sequence, and pad the rest with zeros if necessary
|
# Fill the tx_uw field with the uw_sequence, and pad the rest with zeros if necessary
|
||||||
uw_sequence = [1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0]
|
uw_sequence = [1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0]
|
||||||
|
#print(uw_sequence)
|
||||||
|
#print(len(uw_sequence))
|
||||||
|
#uw_sequence.reverse()
|
||||||
|
#print(uw_sequence)
|
||||||
data_ofdm_500_config.tx_uw = (ctypes.c_uint8 * MAX_UW_BITS)(*(uw_sequence + [0]*(MAX_UW_BITS-len(uw_sequence))))
|
data_ofdm_500_config.tx_uw = (ctypes.c_uint8 * MAX_UW_BITS)(*(uw_sequence + [0]*(MAX_UW_BITS-len(uw_sequence))))
|
||||||
|
|
||||||
|
|
||||||
|
|
42
tools/custom_mode_tests/create_custom_ofdm_mod.py
Normal file
42
tools/custom_mode_tests/create_custom_ofdm_mod.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
"""
|
||||||
|
|
||||||
|
FreeDATA % python3.11 tools/custom_mode_tests/create_custom_ofdm_mod.py | ./modem/lib/codec2/build_osx/src/freedv_data_raw_rx --vv --framesperburst 1 DATAC1 - /dev/null
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
import sys
|
||||||
|
sys.path.append('modem')
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
modem_path = '/../../modem'
|
||||||
|
if modem_path not in sys.path:
|
||||||
|
sys.path.append(modem_path)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#import modem.codec2 as codec2
|
||||||
|
from codec2 import *
|
||||||
|
|
||||||
|
import modulator as modulator
|
||||||
|
import config as config
|
||||||
|
|
||||||
|
config = config.CONFIG('config.ini')
|
||||||
|
modulator = modulator.Modulator(config.read())
|
||||||
|
#freedv = open_instance(FREEDV_MODE.data_ofdm_2438.value)
|
||||||
|
#freedv = open_instance(FREEDV_MODE.datac3.value)
|
||||||
|
freedv = open_instance(FREEDV_MODE.data_ofdm_500.value)
|
||||||
|
|
||||||
|
frames = 10
|
||||||
|
txbuffer = bytearray()
|
||||||
|
|
||||||
|
for frame in range(0,frames):
|
||||||
|
txbuffer = modulator.transmit_add_silence(txbuffer, 1000)
|
||||||
|
txbuffer = modulator.transmit_add_preamble(txbuffer, freedv)
|
||||||
|
txbuffer = modulator.transmit_create_frame(txbuffer, freedv, b'123')
|
||||||
|
txbuffer = modulator.transmit_add_postamble(txbuffer, freedv)
|
||||||
|
txbuffer = modulator.transmit_add_silence(txbuffer, 1000)
|
||||||
|
|
||||||
|
#print(txbuffer)
|
||||||
|
|
||||||
|
sys.stdout.buffer.write(txbuffer)
|
||||||
|
sys.stdout.buffer.flush()
|
Loading…
Reference in a new issue