From a5edefea7cf580717e79ef71c1f82e4db0bee2e4 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Tue, 6 Feb 2018 20:29:12 +0000 Subject: [PATCH] fixed bug in numbers or bits read in git-svn-id: https://svn.code.sf.net/p/freetel/code@3395 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/src/fsk_mod_ext_vco.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/codec2-dev/src/fsk_mod_ext_vco.c b/codec2-dev/src/fsk_mod_ext_vco.c index 232da984..137bdab7 100644 --- a/codec2-dev/src/fsk_mod_ext_vco.c +++ b/codec2-dev/src/fsk_mod_ext_vco.c @@ -27,13 +27,14 @@ */ #include +#include #include #include #include #include int main(int argc,char *argv[]){ - int os, m, i, bit_i, sym; + int os, m, log2m, i, bit_i, sym; float d; FILE *fin,*fout; @@ -43,11 +44,12 @@ int main(int argc,char *argv[]){ } /* Extract parameters */ - m = atoi(argv[1]); + m = atoi(argv[1]); log2m = log2(m); + printf("log2m: %d\n", log2m); os = atoi(argv[2]); d = atof(argv[3]); - uint8_t tx_bits[m]; + uint8_t tx_bits[log2m]; int16_t rawbuf[os]; if (strcmp(argv[4],"-")==0){ @@ -64,7 +66,7 @@ int main(int argc,char *argv[]){ /* Modulate m bits to levels to drive external VCO */ - while( fread(tx_bits, sizeof(uint8_t), m, fin) == m ){ + while( fread(tx_bits, sizeof(uint8_t), log2m, fin) == log2m ){ /* generate the symbol number from the bit stream, e.g. 0,1 for 2FSK, 0,1,2,3 for 4FSK */ -- 2.25.1