From 7003350768ed2f317fad1f1a81779294710df125 Mon Sep 17 00:00:00 2001 From: markster Date: Thu, 15 Apr 2004 22:23:43 +0000 Subject: Debounce red alarm to prevent red alarm oscillation git-svn-id: http://svn.digium.com/svn/zaptel/trunk@365 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- wct4xxp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wct4xxp.c b/wct4xxp.c index b19e27d..da87006 100755 --- a/wct4xxp.c +++ b/wct4xxp.c @@ -90,6 +90,7 @@ struct t4 { int syncs[4]; /* sync sources */ int psyncs[4]; /* span-relative sync sources */ int alarmtimer[4]; /* Alarm timer */ + int redalarms[4]; int blinktimer; #ifdef FANCY_ALARM int alarmpos; @@ -1265,8 +1266,13 @@ static void __t4_check_alarms(struct t4 *wc, int span) alarms |= ZT_ALARM_NOTOPEN; } - if (c & 0xa0) - alarms |= ZT_ALARM_RED; + if (c & 0xa0) { + if (wc->redalarms[span] > 10) + alarms |= ZT_ALARM_RED; + else + wc->redalarms[span]++; + } else + wc->redalarms[span] = 0; if (c & 0x4) alarms |= ZT_ALARM_BLUE; /* Keep track of recovering */ -- cgit v1.2.3