-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.py
More file actions
114 lines (100 loc) · 3.09 KB
/
config.py
File metadata and controls
114 lines (100 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
"""Configuration constants for the SDR stream web application.
Protocol constants (RS codes, hopping sequences, preamble patterns, etc.)
live in ``hubble_satnet_decoder.constants`` and are re-exported here for backward
compatibility. SDR-specific and display-specific values are defined locally.
"""
import os
import hubble_satnet_decoder.constants as _fdc
from hubble_satnet_decoder.constants import ( # noqa: F401 — re-exported
ADC_FULL_SCALE,
DATA_LEN_VNEG1,
DETECTION_THRESHOLD,
F0_TOL,
FREQ_STEP_VNEG1,
GAP_DURATIONS,
HOPPING_SEQS,
LO_CHANNEL,
MAX_RAW,
MIN_ENERGY_DBFS,
NFFT_DET,
NFFT_VIS,
NMS_FREQ_BINS,
NMS_TIME_BINS,
NOVERLAP_DET,
NOVERLAP_VIS,
NUM_CHANNELS,
NUM_FSK_BINS,
NUM_HEADER_SYMS,
NUM_SYM_PER_HOP,
PAYLOAD_LEN_BYTES_V1,
PREAMBLE_BITS,
PREAMBLE_CODE_V1,
PREAMBLE_F0_SNR_MIN,
PREAMBLE_LEN,
RS_K_V1,
RS_K_VNEG1,
RS_N_V1,
RS_N_VNEG1,
SYMBOL_DURATION_S,
SYMBOLS_PER_PACKET_VNEG1,
SYNTH_RES,
TEMPLATE_FREQ_BINS,
TIME_TOL,
bins_on,
fft_freqs,
off_indices_v1,
on_indices_v1,
preamble_off_idx,
preamble_on_idx,
samples_per_symbol,
slot_samples,
templates,
time_step_s,
)
# -- SDR selection (override with environment variables) --------------------
SDR_TYPE = os.environ.get("SDR_TYPE", "pluto").lower() # "pluto" (ADALM-PLUTO & PlutoPlus) | "bladerf"
# -- PlutoSDR connection (ignored when SDR_TYPE != "pluto") -----------------
PLUTO_URI = os.environ.get("PLUTO_URI", "ip:192.168.2.1")
# -- Radio parameters (shared across SDR backends) -------------------------
CENTER_FREQ_HZ = 2_482_440_375
SAMPLE_RATE = 781_250 # 6.25 MHz / 8
RX_BUFFER_SIZE = 2 ** 16 # ~84 ms per read
RF_BANDWIDTH = int(SAMPLE_RATE)
RX_GAIN_MODE = "manual"
RX_INITIAL_GAIN_DB = 20
RX_GAIN_MIN_DB = 0
RX_GAIN_STEP_DB = 2
if SDR_TYPE == "bladerf":
RX_GAIN_MAX_DB = 60
else:
RX_GAIN_MAX_DB = 71
# -- Spectrogram (visualisation) -------------------------------------------
SPEC_DURATION_S = 10.0
SPEC_CHUNK_S = 0.5
SPEC_CHUNK_SAMPLES = int(SPEC_CHUNK_S * SAMPLE_RATE)
MAX_SPEC_CHUNKS = int(SPEC_DURATION_S / SPEC_CHUNK_S)
# IQ circular buffer: ~2 s for decode + headroom
IQ_BUFFER_SIZE = int(2.0 * SAMPLE_RATE)
# Target image size for web display
SPEC_IMG_WIDTH = 1200
SPEC_IMG_HEIGHT = 200
# -- Decoder scheduling ----------------------------------------------------
DECODE_WINDOW_S = 1.0
DECODE_INTERVAL_S = 0.5
DECODE_SAMPLES = int(DECODE_WINDOW_S * SAMPLE_RATE)
# -- Web server & app behaviour --------------------------------------------
FLASK_PORT = 8050
VERBOSE = False
MAX_DECODE_HISTORY = 200
SDR_RETRY_INTERVAL_S = 3
# -- Time-domain viewer ----------------------------------------------------
TD_WINDOW_S = 0.5
# -- Sync hubble_satnet_decoder with this SDR config -----------------------
_fdc.CHANNEL_SPACING = 25_750.0
_fdc.DEVICE_CHANNEL_SPACING = {
name: round(_fdc.CHANNEL_SPACING / sr) * sr
for name, sr in _fdc.SYNTH_RES.items()
}
CHANNEL_SPACING = _fdc.CHANNEL_SPACING
DEVICE_CHANNEL_SPACING = _fdc.DEVICE_CHANNEL_SPACING
_fdc.configure(SAMPLE_RATE)