From ea58ccdfb0fb81b2cfbbc49c4ff224e7f076b66a Mon Sep 17 00:00:00 2001 From: MrDave Date: Sat, 19 Oct 2019 22:39:53 -0600 Subject: [PATCH] Remove micro-lightswitch --- src/motion.hpp | 1 - src/motion_loop.cpp | 40 ++++------------------------------------ 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/src/motion.hpp b/src/motion.hpp index 4fd0d692..54830478 100644 --- a/src/motion.hpp +++ b/src/motion.hpp @@ -349,7 +349,6 @@ struct ctx_cam { int event_nr; int prev_event; unsigned long long database_event_id; - unsigned int lightswitch_framecounter; char text_event_string[PATH_MAX]; /* The text for conv. spec. %C - */ int text_scale; diff --git a/src/motion_loop.cpp b/src/motion_loop.cpp index 51688650..7a89aaee 100644 --- a/src/motion_loop.cpp +++ b/src/motion_loop.cpp @@ -397,7 +397,6 @@ static int mlp_init(struct ctx_cam *cam) { */ cam->event_nr = 1; cam->prev_event = 0; - cam->lightswitch_framecounter = 0; cam->detecting_motion = 0; cam->event_user = FALSE; cam->event_stop = FALSE; @@ -957,39 +956,12 @@ static void mlp_tuning(struct ctx_cam *cam){ , &cam->current_image->location); } - /* - * Update reference frame. - * micro-lighswitch: trying to auto-detect lightswitch events. - * frontdoor illumination. Updates are rate-limited to 3 per second at - * framerates above 5fps to save CPU resources and to keep sensitivity - * at a constant level. - */ - - if ((cam->current_image->diffs > cam->threshold) && - (cam->current_image->diffs < cam->threshold_maximum) && - (cam->conf.lightswitch_percent >= 1) && - (cam->lightswitch_framecounter < (cam->lastrate * 2)) && /* two seconds window only */ - /* number of changed pixels almost the same in two consecutive frames and */ - ((abs(cam->previous_diffs - cam->current_image->diffs)) < (cam->previous_diffs / 15)) && - /* center of motion in about the same place ? */ - ((abs(cam->current_image->location.x - cam->previous_location_x)) <= (cam->imgs.width / 150)) && - ((abs(cam->current_image->location.y - cam->previous_location_y)) <= (cam->imgs.height / 150))) { - if (cam->conf.primary_method == 0){ - alg_update_reference_frame(cam, RESET_REF_FRAME); - } else { - alg_new_update_frame(cam); - } - cam->current_image->diffs = 0; - cam->lightswitch_framecounter = 0; - - MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, _("micro-lightswitch!")); + if (cam->conf.primary_method == 0){ + alg_update_reference_frame(cam, UPDATE_REF_FRAME); } else { - if (cam->conf.primary_method == 0){ - alg_update_reference_frame(cam, UPDATE_REF_FRAME); - } else { - alg_new_update_frame(cam); - } + alg_new_update_frame(cam); } + cam->previous_diffs = cam->current_image->diffs; cam->previous_location_x = cam->current_image->location.x; cam->previous_location_y = cam->current_image->location.y; @@ -1061,9 +1033,6 @@ static void mlp_actions(struct ctx_cam *cam){ if ((cam->current_image->diffs > cam->threshold) && (cam->current_image->diffs < cam->threshold_maximum)) { cam->current_image->flags |= IMAGE_MOTION; - cam->lightswitch_framecounter++; /* micro lightswitch */ - } else { - cam->lightswitch_framecounter = 0; } if ((cam->conf.emulate_motion || cam->event_user) && (cam->startup_frames == 0)) { @@ -1189,7 +1158,6 @@ static void mlp_actions(struct ctx_cam *cam){ cam->event_user = FALSE; cam->postcap = 0; cam->event_nr++; - cam->lightswitch_framecounter = 0; cam->text_event_string[0] = '\0'; } }