[svn-commits] tzafrir: branch 1.2 r4484 - /branches/1.2/xpp/card_fxo.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Aug 14 04:02:38 CDT 2008


Author: tzafrir
Date: Thu Aug 14 04:02:38 2008
New Revision: 4484

URL: http://svn.digium.com/view/zaptel?view=rev&rev=4484
Log:
xpp: FXO: display signed voltage values (from xpp r6055)

This is only an issue with the displayed value. In case you wondered why
you have battery voltage of more than 220V.

Modified:
    branches/1.2/xpp/card_fxo.c

Modified: branches/1.2/xpp/card_fxo.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/xpp/card_fxo.c?view=diff&rev=4484&r1=4483&r2=4484
==============================================================================
--- branches/1.2/xpp/card_fxo.c (original)
+++ branches/1.2/xpp/card_fxo.c Thu Aug 14 04:02:38 2008
@@ -839,13 +839,14 @@
 	struct FXO_priv_data	*priv;
 	enum polarity_state	pol;
 	int			msec;
-
-	priv = xpd->priv;
-	BUG_ON(!priv);
-	priv->battery_voltage[portno] = data_low;
+	signed char		volts = (signed char)data_low;
+
+	priv = xpd->priv;
+	BUG_ON(!priv);
+	priv->battery_voltage[portno] = volts;
 	if(xpd->ringing[portno])
 		goto ignore_reading;	/* ring voltage create false alarms */
-	if(abs((signed char)data_low) < BAT_THRESHOLD) {
+	if(abs(volts) < BAT_THRESHOLD) {
 		/*
 		 * Check for battery voltage fluctuations
 		 */
@@ -855,7 +856,7 @@
 			milliseconds = priv->nobattery_debounce[portno]++ *
 				poll_battery_interval;
 			if(milliseconds > BAT_DEBOUNCE) {
-				LINE_DBG(SIGNAL, xpd, portno, "BATTERY OFF voltage=%d\n", data_low);
+				LINE_DBG(SIGNAL, xpd, portno, "BATTERY OFF voltage=%d\n", volts);
 				priv->battery[portno] = BATTERY_OFF;
 				if(SPAN_REGISTERED(xpd))
 					zap_report_battery(xpd, portno);
@@ -871,7 +872,7 @@
 	} else {
 		priv->nobattery_debounce[portno] = 0;
 		if(priv->battery[portno] != BATTERY_ON) {
-			LINE_DBG(SIGNAL, xpd, portno, "BATTERY ON voltage=%d\n", data_low);
+			LINE_DBG(SIGNAL, xpd, portno, "BATTERY ON voltage=%d\n", volts);
 			priv->battery[portno] = BATTERY_ON;
 			if(SPAN_REGISTERED(xpd))
 				zap_report_battery(xpd, portno);
@@ -893,9 +894,9 @@
 	/*
 	 * Handle reverse polarity
 	 */
-	if(data_low == 0)
+	if(volts == 0)
 		pol = POL_UNKNOWN;
-	else if(IS_SET(data_low, 7))
+	else if(volts < 0)
 		pol = POL_NEGATIVE;
 	else
 		pol = POL_POSITIVE;




More information about the svn-commits mailing list