From 741e67e8cd6457df16f54d6fa0a8224807f1e721 Mon Sep 17 00:00:00 2001 From: Admin Date: Sun, 28 Feb 2021 22:42:29 +0100 Subject: [PATCH] ALERT also mean warming up with alarm_frame_count value before returning to ALARM.... --- src/zm_monitor.cpp | 10 ++++++++-- src/zm_monitor.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 4c334c98f..5416852e6 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -332,6 +332,7 @@ Monitor::Monitor() capture_delay(0), alarm_capture_delay(0), alarm_frame_count(0), + alert_to_alarm_frame_count(0), fps_report_interval(0), ref_blend_perc(0), alarm_ref_blend_perc(0), @@ -2087,11 +2088,16 @@ bool Monitor::Analyse() { shared_data->state = state = PREALARM; } } else if ( state == ALERT ) { - Info("%s: %03d - Gone back into alarm state", name, analysis_image_count); - shared_data->state = state = ALARM; + alert_to_alarm_frame_count--; + Info("%s: %03d - Alarmed frame while in alert state. Consecutive alarmed frames left to return to alarm state: %03d", name, analysis_image_count,alert_to_alarm_frame_count); + if (alert_to_alarm_frame_count == 0) { + Info("%s: %03d - Gone back into alarm state", name, analysis_image_count); + shared_data->state = state = ALARM; + } } last_alarm_count = analysis_image_count; } else { // no score? + alert_to_alarm_frame_count = alarm_frame_count; // load same value configured for alarm_frame_count if ( state == ALARM ) { Info("%s: %03d - Gone into alert state", name, analysis_image_count); shared_data->state = state = ALERT; diff --git a/src/zm_monitor.h b/src/zm_monitor.h index e3b9777da..54facf26b 100644 --- a/src/zm_monitor.h +++ b/src/zm_monitor.h @@ -307,6 +307,8 @@ protected: int capture_delay; // How long we wait between capture frames int alarm_capture_delay; // How long we wait between capture frames when in alarm state int alarm_frame_count; // How many alarm frames are required before an event is triggered + int alert_to_alarm_frame_count; // How many alarm frames (consecutive score frames) are required to return alarm from alert + // value for now is the same number configured in alarm_frame_count, maybe getting his own parameter some day int fps_report_interval; // How many images should be captured/processed between reporting the current FPS int ref_blend_perc; // Percentage of new image going into reference image. int alarm_ref_blend_perc; // Percentage of new image going into reference image during alarm.