[asterisk-commits] jdixon: branch jdixon/chan_usbradio-1.4 r169481 - in /team/jdixon/chan_usbrad...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 19 22:48:44 CST 2009


Author: jdixon
Date: Mon Jan 19 22:48:43 2009
New Revision: 169481

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=169481
Log:
Fixed mode steering problem and clipping in xpmr

Modified:
    team/jdixon/chan_usbradio-1.4/channels/chan_usbradio.c
    team/jdixon/chan_usbradio-1.4/channels/xpmr/xpmr.c

Modified: team/jdixon/chan_usbradio-1.4/channels/chan_usbradio.c
URL: http://svn.digium.com/svn-view/asterisk/team/jdixon/chan_usbradio-1.4/channels/chan_usbradio.c?view=diff&rev=169481&r1=169480&r2=169481
==============================================================================
--- team/jdixon/chan_usbradio-1.4/channels/chan_usbradio.c (original)
+++ team/jdixon/chan_usbradio-1.4/channels/chan_usbradio.c Mon Jan 19 22:48:43 2009
@@ -1628,7 +1628,8 @@
 */
 static int usbradio_text(struct ast_channel *c, const char *text)
 {
-	struct chan_usbradio_pvt *o = find_desc(usbradio_active);
+	struct chan_usbradio_pvt *o = c->tech_pvt;
+
 	double tx,rx;
 	char cnt,rxs[16],txs[16],txpl[16],rxpl[16];
 	char pwr,*cmd;
@@ -1641,19 +1642,19 @@
 	cnt=sscanf(text,"%s %s %s %s %s %c",cmd,rxs,txs,rxpl,txpl,&pwr);
 
 	if (strcmp(cmd,"SETCHAN")==0)
-    { 
+	{ 
 		u8 chan;
 		chan=strtod(rxs,NULL);
 		ppbinout(chan);
-        if(o->debuglevel)ast_log(LOG_NOTICE,"parse usbradio SETCHAN cmd: %s chan: %i\n",text,chan);
-        return 0;
-    }
+	        if(o->debuglevel)ast_log(LOG_NOTICE,"parse usbradio SETCHAN cmd: %s chan: %i\n",text,chan);
+	        return 0;
+	}
 	
-    if (cnt < 6)
-    {
-	    ast_log(LOG_ERROR,"Cannot parse usbradio text: %s\n",text);
-	    return 0;
-    }
+	if (cnt < 6)
+	{
+		ast_log(LOG_ERROR,"Cannot parse usbradio text: %s\n",text);
+		return 0;
+	}
 	else
 	{
 		if(o->debuglevel)ast_verbose(" << %s %s %s %s %s %c >> \n", cmd,rxs,txs,rxpl,txpl,pwr);	

Modified: team/jdixon/chan_usbradio-1.4/channels/xpmr/xpmr.c
URL: http://svn.digium.com/svn-view/asterisk/team/jdixon/chan_usbradio-1.4/channels/xpmr/xpmr.c?view=diff&rev=169481&r1=169480&r2=169481
==============================================================================
--- team/jdixon/chan_usbradio-1.4/channels/xpmr/xpmr.c (original)
+++ team/jdixon/chan_usbradio-1.4/channels/xpmr/xpmr.c Mon Jan 19 22:48:43 2009
@@ -541,9 +541,22 @@
 
 		    y=((y/calcAdjust)*outputGain)/M_Q8;
 
+
+#if	XPMR_TRACE_OVFLW == 1
+			if(y>32767)
+			{
+				y=32767;
+				printf("pmr_rx_frontend() OVRFLW \n"  );
+			}
+			else if(y<-32767)
+			{
+				y=-32767;
+				printf("pmr_rx_frontend() UNDFLW \n"  );
+			}
+#else
 			if(y>32767)y=32767;
 			else if(y<-32767)y=-32767;
-
+#endif
 		    output[iOutput]=y;					// Rx Baseband decimated
 			noutput[iOutput++] = apeak;		  	// Rx Noise
 		}
@@ -701,6 +714,9 @@
 		        y += coef[n] * x[n];
 
 			y=((y/calcAdjust)*outputGain)/M_Q8;
+
+			if (y>32767)y=32767;		 			// overflow
+			else if(y<-32767)y=-32767;
 
 			if(mixOut){
 				if(monoOut){
@@ -858,8 +874,8 @@
 		   y0 = (temp0 + temp1)/calcAdjust;
 		   y0 =(y0*outputGain)/M_Q8;
 		
-		if(y0>32766)y0=32766;
-		else if(y0<-32766)y0=-32766;
+		if(y0>32767)y0=32767;
+		else if(y0<-32767)y0=-32767;
         output[i]=y0;
     }
 
@@ -2239,7 +2255,7 @@
 		 
 		pSps->calcAdjust=gain_int_hpf_4000_1_2;
 		pSps->inputGain=(1*M_Q8);
-		pSps->outputGain=(1*M_Q8);	 // to match flat at 1KHz
+		pSps->outputGain=(1*M_Q8);	 // to match flat at 1KHz 
 		inputTmp=pSps->sink;
 	}
 
@@ -2255,7 +2271,7 @@
 		pSps->nSamples=pChan->nSamplesTx;
 		pSps->inputGain=(1*M_Q8);
 		pSps->outputGain=(1*M_Q8);
-		pSps->setpt=12000;
+		pSps->setpt=12000;			// limiting point for 100 modulation		
 		inputTmp=pSps->sink;
 	}
 




More information about the asterisk-commits mailing list