diff --git a/VER.txt b/VER.txt index a3c980a..f2f7324 100644 --- a/VER.txt +++ b/VER.txt @@ -1 +1 @@ -20180706 \ No newline at end of file +20180924 \ No newline at end of file diff --git a/src/osic.c b/src/osic.c index 4609b8e..3401cb0 100644 --- a/src/osic.c +++ b/src/osic.c @@ -207,22 +207,18 @@ void osic_CloseSock(int32_t fd) close(fd); } -int32_t osic_RdBin(int32_t fd, - char buf[], uint32_t buf_len, - uint32_t size) +int32_t osic_RdBin(int32_t fd, char buf[], uint32_t buf_len, uint32_t size) { - if (size > (buf_len-1) + 1) - size = (buf_len-1)+1; + if (size > buf_len) + size = buf_len; return read(fd, (char *)buf, size); } -void osic_WrBin(int32_t fd, char buf[], - uint32_t buf_len, - uint32_t size) +void osic_WrBin(int32_t fd, char buf[], uint32_t buf_len, uint32_t size) { int rc; - if (size > (buf_len-1)+1) - size = (buf_len-1)+1; + if (size > buf_len) + size = buf_len; rc = write(fd, (char *)buf, size); (void)rc; } diff --git a/src/sdrtest.c b/src/sdrtest.c index 19e09c2..435c852 100644 --- a/src/sdrtest.c +++ b/src/sdrtest.c @@ -558,7 +558,7 @@ static void skip(const char s[], uint32_t s_len, uint32_t * p) // send freq table static void updateChanT(){ - int i; + int i,j,l; char tmp[15],tmp1[25]; double fhz; @@ -569,43 +569,48 @@ static void updateChanT(){ double tt; - tt=-1.0; + tt=0; if(rxx[i].df>0) tt=0.5; - sndbufft[0]=0; - strcat(sndbufft,"9 S K P "); - + j=0; while (prx[i]) { + if(j==0){ + sndbufft[0]=0; + strcat(sndbufft,"9 S K P "); + } sprintf(tmp,"%02i%06li",i+1,(long int)((midfreq/1000+(int32_t)rxx[i].df*khz+tt))); tmp1[0]=tmp[0]; - tmp1[1]='0'; + tmp1[1]=' '; tmp1[2]=tmp[1]; - tmp1[3]='0'; + tmp1[3]=' '; tmp1[4]=tmp[2]; - tmp1[5]='0'; + tmp1[5]=' '; tmp1[6]=tmp[3]; - tmp1[7]='0'; + tmp1[7]=' '; tmp1[8]=tmp[4]; - tmp1[9]='0'; + tmp1[9]=' '; tmp1[10]=tmp[5]; - tmp1[11]='0'; + tmp1[11]=' '; tmp1[12]=tmp[6]; - tmp1[13]='0'; + tmp1[13]=' '; tmp1[14]=tmp[7]; - tmp1[15]='0'; + tmp1[15]=' '; tmp1[16]=tmp[8]; - tmp1[17]='0'; + tmp1[17]=' '; tmp1[18]=0; - strcat(sndbufft,tmp1); ++i; - } - if(fd){ - osi_WrBin(fd, (char *)sndbufft, 1024u/1u, 1024); - osi_WrBin(fd, (char *)sndbufft, 1024u/1u, 1024); - osi_WrBin(fd, (char *)sndbufft, 1024u/1u, 1024); - osi_WrBin(fd, (char *)sndbufft, 1024u/1u, 1024); + j++; + if(j>14){ + if(fd){ + l=strlen(sndbufft); + sndbufft[l]=0; + sndbufft[l+1]=0; + osi_WrBin(fd, (char *)sndbufft, 1024, 1024); + j=0; + } + } } } diff --git a/src/sondeudp.c b/src/sondeudp.c index ca501ee..fffa0e5 100644 --- a/src/sondeudp.c +++ b/src/sondeudp.c @@ -1365,8 +1365,7 @@ static void decodeframe92(uint32_t m) /* +crc */ ++p; if (maxchannels>0UL) { - osic_WrINT32(m+1UL, 1UL); - osi_WrStr(":", 2ul); + printf("%02i:",m+1); } osi_WrStr("R92 ", 5ul); if (8UL+len>240UL || !crcrs(chan[m].r92.rxbuf, 256ul, 8L, @@ -1602,8 +1601,7 @@ static SET256 _cnst1 = {0x03FFFFF0UL,0x00000003UL,0x00000000UL,0x00000018UL, static void WrChan(int32_t c) { if (maxchannels>0UL) { - osic_WrINT32((uint32_t)(c+1L), 1UL); - osi_WrStr(":", 2ul); + printf("%02i:",c+1); } } /* end WrChan() */ @@ -2184,8 +2182,7 @@ static void demodbytepilot(uint32_t m, char d) crc = (anonym->rxbuf[48UL]<<8UL) | anonym->rxbuf[49UL]; if (verb) { if (maxchannels>0UL) { - osic_WrINT32(m+1UL, 1UL); - osi_WrStr(":", 2ul); //if more than one channel print channel No. + printf("%02i:",m+1); } osi_WrStr("PS ",4UL); } @@ -2546,8 +2543,7 @@ static void decode41(uint32_t m) } while (!(allok || try0>2UL)); if (verb && nameok>0UL) { if (maxchannels>0UL) { - osic_WrINT32(m+1UL, 1UL); - osi_WrStr(":", 2ul); + printf("%02i:",m+1); } osi_WrStr("R41 ", 5ul); for (i = 0UL; i<=7UL; i++) { @@ -3472,6 +3468,7 @@ static char sendDFM(uint32_t m){ tmp[4] = chan[m].freq[4]; tmp[5] = chan[m].freq[5]; tmp[6] = 0; + if(strlen(tmp)>2) strcat(s,tmp); else @@ -3701,8 +3698,7 @@ static void demodframe34(uint32_t channel) } if (verb && ok0 || verb2) { if (maxchannels>0UL) { - osic_WrINT32(channel+1UL, 1UL); - osi_WrStr(":", 2ul); + printf("%02i:",channel+1); } if (anonym->c50) { osi_WrStr("C50 ", 5ul); @@ -4230,13 +4226,16 @@ static void getadc(void) sprintf(tmps,"%c%c%c%c\n",adcbuf[0],adcbuf[1],adcbuf[2],adcbuf[3]); + if(tmps[0]=='9' && tmps[1]=='S' && tmps[2]=='K' && tmps[3]=='P'){ //freq table // printf("Update channel table\n"); pos=4; mod=1; chno=0; while(adcbuf[pos]!=0){ - //chan[chno].nr=(adcbuf[pos]-48)*10+adcbuf[pos+1]-48; + chno=(int)(((char)adcbuf[pos]-48)*10+((char)adcbuf[pos+1]-48)-1); + if(chno<0) break; + chan[chno].freq[0]=adcbuf[pos+2]; chan[chno].freq[1]=adcbuf[pos+3]; chan[chno].freq[2]=adcbuf[pos+4]; @@ -4245,8 +4244,8 @@ static void getadc(void) chan[chno].freq[5]=adcbuf[pos+7]; chan[chno].freq[6]=0; pos+=8; + //printf("CH:%i QRG:",chno); //printf(chan[chno].freq);printf("\n"); - chno++; } }else if(mod==0){ adcbufsamps = 0UL;