From ed0fe72f4645ed5d2030302038d26e1ff0308a60 Mon Sep 17 00:00:00 2001 From: MrDave Date: Thu, 26 Nov 2020 14:35:55 -0700 Subject: [PATCH] Fix end of event determination --- src/motion_loop.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/motion_loop.cpp b/src/motion_loop.cpp index f3d91e9c..aa91d1d9 100644 --- a/src/motion_loop.cpp +++ b/src/motion_loop.cpp @@ -1119,11 +1119,13 @@ static void mlp_actions_event(struct ctx_cam *cam) ((cam->frame_curr_ts.tv_sec - cam->eventtime) >= cam->conf->movie_max_time)) { cam->event_stop = TRUE; } + if ((cam->conf->event_gap > 0) && + ((cam->frame_curr_ts.tv_sec - cam->lasttime) >= cam->conf->event_gap)) { + cam->event_stop = TRUE; + } - if (((cam->frame_curr_ts.tv_sec - cam->lasttime >= cam->conf->event_gap) && - (cam->conf->event_gap > 0)) || cam->event_stop) { - - if (cam->event_nr == cam->prev_event || cam->event_stop) { + if (cam->event_stop) { + if (cam->event_nr == cam->prev_event) { mlp_ring_process(cam, IMAGE_BUFFER_FLUSH); if (cam->imgs.image_preview.diffs) { event(cam, EVENT_IMAGE_PREVIEW, NULL, NULL, NULL, &cam->current_image->imgts);