Go back to 16-bit output depth
This commit is contained in:
parent
1a3eb74ea2
commit
f640ce9677
2 changed files with 23 additions and 22 deletions
|
@ -133,15 +133,16 @@ blocks:
|
|||
coordinate: [1000, 632.0]
|
||||
rotation: 0
|
||||
state: true
|
||||
- name: blocks_interleaved_char_to_complex_0
|
||||
id: blocks_interleaved_char_to_complex
|
||||
- name: blocks_interleaved_short_to_complex_0
|
||||
id: blocks_interleaved_short_to_complex
|
||||
parameters:
|
||||
affinity: ''
|
||||
alias: ''
|
||||
comment: ''
|
||||
maxoutbuf: '0'
|
||||
minoutbuf: '0'
|
||||
scale_factor: '127'
|
||||
scale_factor: (1 << 15) - 1
|
||||
swap: 'False'
|
||||
vector_input: 'False'
|
||||
states:
|
||||
bus_sink: false
|
||||
|
@ -225,7 +226,7 @@ blocks:
|
|||
minoutbuf: '0'
|
||||
port: '1234'
|
||||
server: 'True'
|
||||
type: byte
|
||||
type: short
|
||||
vlen: '1'
|
||||
states:
|
||||
bus_sink: false
|
||||
|
@ -287,7 +288,7 @@ blocks:
|
|||
marker9: '0'
|
||||
name: '""'
|
||||
nconnections: '1'
|
||||
size: int(samp_rate // 30)
|
||||
size: min(int(samp_rate // 30), 512)
|
||||
style1: '0'
|
||||
style10: '0'
|
||||
style2: '0'
|
||||
|
@ -381,7 +382,7 @@ blocks:
|
|||
marker9: '-1'
|
||||
name: '"IQ"'
|
||||
nconnections: '1'
|
||||
size: int(samp_rate // 30)
|
||||
size: min(int(samp_rate // 30), 512)
|
||||
srate: samp_rate
|
||||
stemplot: 'False'
|
||||
style1: '1'
|
||||
|
@ -478,7 +479,7 @@ blocks:
|
|||
marker9: '-1'
|
||||
name: '"FM Demodulation"'
|
||||
nconnections: '1'
|
||||
size: (samp_rate // 30)
|
||||
size: int(samp_rate // 2 // 30)
|
||||
srate: samp_rate // 2
|
||||
stemplot: 'False'
|
||||
style1: '1'
|
||||
|
@ -575,7 +576,7 @@ blocks:
|
|||
marker9: '-1'
|
||||
name: '"IQ / Loop"'
|
||||
nconnections: '1'
|
||||
size: int(samp_rate // 30)
|
||||
size: min(int(samp_rate // 30), 512)
|
||||
srate: samp_rate
|
||||
stemplot: 'False'
|
||||
style1: '1'
|
||||
|
@ -651,7 +652,7 @@ blocks:
|
|||
grid: 'True'
|
||||
gui_hint: (0, 0, 1, 2)
|
||||
int_max: '0'
|
||||
int_min: '-90'
|
||||
int_min: 10 * math.log10(1 / ((2 ** 15 - 1) ** 2))
|
||||
label1: ''
|
||||
label10: ''
|
||||
label2: ''
|
||||
|
@ -747,16 +748,16 @@ connections:
|
|||
- [analog_wfm_rcv_pll_0, '1', audio_sink_0, '1']
|
||||
- [analog_wfm_rcv_pll_0, '1', blocks_add_xx_0, '1']
|
||||
- [blocks_add_xx_0, '0', qtgui_waterfall_sink_x_0_0_0, '0']
|
||||
- [blocks_interleaved_char_to_complex_0, '0', analog_quadrature_demod_cf_0, '0']
|
||||
- [blocks_interleaved_char_to_complex_0, '0', analog_wfm_rcv_pll_0, '0']
|
||||
- [blocks_interleaved_char_to_complex_0, '0', blocks_probe_rate_0, '0']
|
||||
- [blocks_interleaved_char_to_complex_0, '0', digital_costas_loop_cc_0, '0']
|
||||
- [blocks_interleaved_char_to_complex_0, '0', qtgui_time_sink_x_0, '0']
|
||||
- [blocks_interleaved_char_to_complex_0, '0', qtgui_waterfall_sink_x_0_0, '0']
|
||||
- [blocks_interleaved_short_to_complex_0, '0', analog_quadrature_demod_cf_0, '0']
|
||||
- [blocks_interleaved_short_to_complex_0, '0', analog_wfm_rcv_pll_0, '0']
|
||||
- [blocks_interleaved_short_to_complex_0, '0', blocks_probe_rate_0, '0']
|
||||
- [blocks_interleaved_short_to_complex_0, '0', digital_costas_loop_cc_0, '0']
|
||||
- [blocks_interleaved_short_to_complex_0, '0', qtgui_time_sink_x_0, '0']
|
||||
- [blocks_interleaved_short_to_complex_0, '0', qtgui_waterfall_sink_x_0_0, '0']
|
||||
- [blocks_probe_rate_0, rate, blocks_message_debug_0, print]
|
||||
- [digital_costas_loop_cc_0, '0', qtgui_const_sink_x_0, '0']
|
||||
- [digital_costas_loop_cc_0, '0', qtgui_time_sink_x_0_1, '0']
|
||||
- [network_tcp_source_0, '0', blocks_interleaved_char_to_complex_0, '0']
|
||||
- [network_tcp_source_0, '0', blocks_interleaved_short_to_complex_0, '0']
|
||||
|
||||
metadata:
|
||||
file_format: 1
|
||||
|
|
12
src/main.c
12
src/main.c
|
@ -59,7 +59,7 @@
|
|||
#define BIAS_STRENGTH 5
|
||||
#endif
|
||||
|
||||
#define IQ_BLOCK_LEN 64
|
||||
#define IQ_BLOCK_LEN 32
|
||||
#define RX_SLEEP_US (DECIMATION * BANDWIDTH / (1 * MHZ) / 4)
|
||||
#define DECIMATION (1 << DECIMATION_BITS)
|
||||
|
||||
|
@ -611,7 +611,7 @@ static void rf_rx(void)
|
|||
/* Scale down 2× to accomodate for jitter. */
|
||||
const int amp_scale = INT_MAX / amp_max / 2;
|
||||
|
||||
static int8_t block[IQ_BLOCK_LEN];
|
||||
static int16_t block[IQ_BLOCK_LEN];
|
||||
uint32_t prev_transfers = dma_hw->ch[dma_ch_in_cos].transfer_count;
|
||||
unsigned pos = 0;
|
||||
|
||||
|
@ -645,7 +645,7 @@ static void rf_rx(void)
|
|||
return;
|
||||
}
|
||||
|
||||
int8_t *blockptr = block;
|
||||
int16_t *blockptr = block;
|
||||
|
||||
for (int i = 0; i < IQ_BLOCK_LEN / 2; i++) {
|
||||
int delta = prev_transfers - dma_hw->ch[dma_ch_in_cos].transfer_count;
|
||||
|
@ -740,7 +740,7 @@ static void rf_rx(void)
|
|||
if (abs(dQ) > agc)
|
||||
agc = abs(dQ);
|
||||
|
||||
int agc_div = (agc >> 7) + (agc >> 14);
|
||||
int agc_div = (agc >> (8 + 7)) + (agc >> (8 + 14));
|
||||
|
||||
*blockptr++ = dI / agc_div;
|
||||
*blockptr++ = dQ / agc_div;
|
||||
|
@ -830,7 +830,7 @@ static void do_rx(int rx_pin, int bias_pin, float freq, char mode)
|
|||
|
||||
printf("Frequency: %.0f\n", actual);
|
||||
|
||||
static int8_t block[IQ_BLOCK_LEN];
|
||||
static int16_t block[IQ_BLOCK_LEN];
|
||||
|
||||
while (queue_try_remove(&iq_queue, block))
|
||||
/* Flush the queue */;
|
||||
|
@ -1145,7 +1145,7 @@ int main()
|
|||
printf("\nPuppet Online!\n");
|
||||
printf("clk_sys = %10.6f MHz\n", (float)clock_get_hz(clk_sys) / MHZ);
|
||||
|
||||
queue_init(&iq_queue, IQ_BLOCK_LEN * sizeof(int8_t), 256);
|
||||
queue_init(&iq_queue, IQ_BLOCK_LEN * sizeof(int16_t), 256);
|
||||
|
||||
static char cmd[83];
|
||||
int cmdlen = 0;
|
||||
|
|
Loading…
Reference in a new issue