Signal Lost & Reacquired warnings not showing up as even

Support and queries relating to all previous versions of ZoneMinder
Locked
almost-working
Posts: 8
Joined: Thu Aug 28, 2008 10:27 am

Signal Lost & Reacquired warnings not showing up as even

Post by almost-working »

Im trying to get Signal Loss detection working, and it seems to be doing so pretty well because in my syslog I get

zma_m7[28696]: WAR [Signal: Lost]
and
zma_m7[28696]: WAR [Signal: Reacquired]

messages fine, but, only occasionally do these show up as an event in the console.

What could be stopping them getting turned into events as a rule (rather than an exception?)

Thanks.
almost-working
Posts: 8
Joined: Thu Aug 28, 2008 10:27 am

Post by almost-working »

Hmm

Could it be because alarm_frame_count is greater than 1 and the Signal:Loss/Reacquired is only a single frame in length?

Any suggestions on howto modify the zm_monitor.cpp to make the signal loss/reacquired alarm_frame_count frames long?
almost-working
Posts: 8
Joined: Thu Aug 28, 2008 10:27 am

Post by almost-working »

Ok here is my patch.

Most of the changes are actually to add the functionality that instead of comparing one pixel with the pre-defined colour in the config page of each monitor, it compares two randomly selected pixels (and if ZM_SIGNAL_CHECK_POINTS of them are the same, a signal change is registered)

Working like a charm.

Code: Select all

--- ../../ZM-1.23.3/src/zm_monitor.cpp  2008-03-14 00:36:12.000000000 +1100
+++ zm_monitor.cpp      2008-10-26 23:22:49.201039574 +1100
@@ -879,9 +879,14 @@

                for ( int i = 0; i < config.signal_check_points; i++ )
                {
-                       int index = (rand()*pixels)/RAND_MAX;
+                       /* int index = (rand()*pixels)/RAND_MAX; */
+                       float foo = ((float) rand()) / ((float) RAND_MAX);
+                       float foo1 = ((float) rand())/ ((float) RAND_MAX);
+                       int index = pixels/3 + (int)((float) pixels * foo / 3.0f);
+                       int index1= pixels/3 + (int)((float) pixels * foo1 / 3.0f);
                        const unsigned char *ptr = buffer+(index*colours);
-                       if ( (RED(ptr) != red_val) || (GREEN(ptr) != green_val) || (BLUE(ptr) != blue_val) )
+                       const unsigned char *ptr1 = buffer+(index1*colours);
+                       if ( (RED(ptr) != RED(ptr1) ) || (GREEN(ptr) != GREEN(ptr1) ) || (BLUE(ptr) != BLUE(ptr1) ) )
                        {
                                return( true );
                        }
@@ -1041,6 +1046,7 @@
                                        else
                                                signal_text = "Signal: Reacquired";
                                        Warning(( signal_text ));
+                                       alarm_frame_count = 1;
                                        if ( event )
                                        {
                                                closeEvent();
almost-working
Posts: 8
Joined: Thu Aug 28, 2008 10:27 am

Post by almost-working »

has the added benefit of increasing the sensitivity of the capture triggers if the signal is lost/regained
User avatar
Normando
Posts: 219
Joined: Sun Aug 17, 2008 5:34 am
Location: Rosario - Argentina

Post by Normando »

Thank you very much for the patch!!
Locked