From 0c055edb5e3dbe430bb77e68d9fd646df7721cd0 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 18 Jan 2022 12:20:19 -0500 Subject: [PATCH] I think in all my changes I got rid of the code that opens events on Alarm. --- src/zm_monitor.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 15a812f83..aea0c0000 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -2087,16 +2087,8 @@ bool Monitor::Analyse() { if ((!pre_event_count) || (Event::PreAlarmCount() >= alarm_frame_count-1)) { Info("%s: %03d - Gone into alarm state PreAlarmCount: %u > AlarmFrameCount:%u Cause:%s", name.c_str(), image_count, Event::PreAlarmCount(), alarm_frame_count, cause.c_str()); - - if (!event) { - event = openEvent(snap, cause, noteSetMap); - Info("%s: %03d - Opening new event %" PRIu64 ", alarm start", name.c_str(), analysis_image_count, event->Id()); - } // end if no event, so start it shared_data->state = state = ALARM; - if (alarm_frame_count) { - Debug(1, "alarm frame count so SavePreAlarmFrames"); - event->SavePreAlarmFrames(); - } + } else if (state != PREALARM) { Info("%s: %03d - Gone into prealarm state", name.c_str(), analysis_image_count); shared_data->state = state = PREALARM; @@ -2189,7 +2181,14 @@ bool Monitor::Analyse() { event = openEvent(snap, cause, noteSetMap); } } else { - Error("ALARM but no event"); + if (!event) { + event = openEvent(snap, cause, noteSetMap); + Info("%s: %03d - Opening new event %" PRIu64 ", alarm start", name.c_str(), analysis_image_count, event->Id()); + } // end if no event, so start it + if (alarm_frame_count) { + Debug(1, "alarm frame count so SavePreAlarmFrames"); + event->SavePreAlarmFrames(); + } } } else if (state == ALERT) { // Alert means this frame has no motion, but we were alarmed and are still recording.