Fixed the modulator + test demodulation

This commit is contained in:
Thomas Kolb 2021-10-17 19:45:54 +02:00
parent 9ba470adeb
commit 874d8d5073
2 changed files with 5 additions and 5 deletions

View file

@ -38,16 +38,16 @@ int main(void)
float complex msg_mod[nsyms]; float complex msg_mod[nsyms];
packet_mod_get_result_cf(&pmod, msg_mod, &nsyms); // get the data packet_mod_get_result_cf(&pmod, msg_mod, &nsyms); // get the data
dump_array_cf(msg_mod, nsyms, 1.0f, "/tmp/tx.cpx");
// channel // channel
float complex msg_received[nsyms]; float complex msg_received[nsyms];
nsyms = nsyms - 63 - 8; nsyms = nsyms - 63 - 16;
//memcpy(msg_received, msg_mod, sizeof(msg_received)); // no noise in channel //memcpy(msg_received, msg_mod, sizeof(msg_received)); // no noise in channel
dump_array_cf(msg_mod, nsyms, 1.0f, "/tmp/tx.cpx"); channel_cccf_execute_block(channel, msg_mod + 63 + 16, nsyms, msg_received);
channel_cccf_execute_block(channel, msg_mod + 63 + 8, nsyms, msg_received);
dump_array_cf(msg_received, nsyms, 1.0f, "/tmp/rx.cpx"); dump_array_cf(msg_received, nsyms, 1.0f, "/tmp/rx.cpx");
// demodulate // demodulate
@ -64,7 +64,7 @@ int main(void)
} }
unsigned int received_bytes; unsigned int received_bytes;
liquid_repack_bytes(msg_demod_syms, bps, nsyms, msg_demod, 8, k+1, &received_bytes); liquid_repack_bytes(msg_demod_syms, bps, nsyms, msg_demod, 8, sizeof(msg_demod), &received_bytes);
//assert(received_bytes == k); //assert(received_bytes == k);

View file

@ -158,7 +158,7 @@ result_t packet_mod_add_header(packet_mod_ctx_t *ctx)
modem hdr_modem = modem_create(HEADER_MODULATION); modem hdr_modem = modem_create(HEADER_MODULATION);
// encode the header // encode the header
unsigned int hdr_enc_length = fec_get_enc_msg_length(HEADER_CHANNEL_CODE, ctx->length); unsigned int hdr_enc_length = fec_get_enc_msg_length(HEADER_CHANNEL_CODE, sizeof(header));
unsigned char header_encoded[hdr_enc_length]; unsigned char header_encoded[hdr_enc_length];
ERR_CHECK_LIQUID(fec_encode(hdr_fec, sizeof(header), header, header_encoded)); ERR_CHECK_LIQUID(fec_encode(hdr_fec, sizeof(header), header, header_encoded));