From a00aff7270e72d6260750b053adebf62fc0b8e98 Mon Sep 17 00:00:00 2001 From: Mr-Dave Date: Thu, 13 Mar 2025 16:21:30 -0600 Subject: [PATCH] Convert IMAGE_MOTION to bool --- src/camera.cpp | 11 ++++++----- src/camera.hpp | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/camera.cpp b/src/camera.cpp index e6f791a9..657c19c8 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -107,7 +107,7 @@ void cls_camera::ring_process_debug() if (current_image->trigger) { t = "Trigger"; - } else if (current_image->flags & IMAGE_MOTION) { + } else if (current_image->motion) { t = "Motion"; } else if (current_image->flags & IMAGE_PRECAP) { t = "Precap"; @@ -164,7 +164,7 @@ void cls_camera::ring_process() current_image->flags |= IMAGE_SAVED; - if (current_image->flags & IMAGE_MOTION) { + if (current_image->motion) { if (cfg->picture_output == "best") { if (current_image->diffs > imgs.image_preview.diffs) { picture->save_preview(); @@ -1286,6 +1286,7 @@ void cls_camera::resetimages() current_image->diffs = 0; current_image->flags = 0; current_image->trigger = false; + current_image->motion = false; current_image->cent_dist = 0; memset(¤t_image->location, 0, sizeof(current_image->location)); current_image->total_labels = 0; @@ -1561,7 +1562,7 @@ void cls_camera::actions_motion() int pos = imgs.ring_in; for (indx = 0; indx < cfg->minimum_motion_frames; indx++) { - if (imgs.image_ring[pos].flags & IMAGE_MOTION) { + if (imgs.image_ring[pos].motion) { frame_count++; } if (pos == 0) { @@ -1668,7 +1669,7 @@ void cls_camera::actions() if ((current_image->diffs > threshold) && (current_image->diffs < threshold_maximum)) { - current_image->flags |= IMAGE_MOTION; + current_image->motion = true; info_diff_cnt++; info_diff_tot += (uint)current_image->diffs; info_sdev_tot += (uint)current_image->location.stddev_xy; @@ -1691,7 +1692,7 @@ void cls_camera::actions() if ((cfg->emulate_motion || event_user) && (startup_frames == 0)) { actions_emulate(); - } else if ((current_image->flags & IMAGE_MOTION) && (startup_frames == 0)) { + } else if ((current_image->motion) && (startup_frames == 0)) { actions_motion(); } else if (postcap > 0) { current_image->flags |= (IMAGE_POSTCAP | IMAGE_SAVE); diff --git a/src/camera.hpp b/src/camera.hpp index 9c8064b1..036b3f77 100644 --- a/src/camera.hpp +++ b/src/camera.hpp @@ -20,7 +20,6 @@ #ifndef _INCLUDE_CAMERA_HPP_ #define _INCLUDE_CAMERA_HPP_ -#define IMAGE_MOTION 1 #define IMAGE_SAVE 4 #define IMAGE_SAVED 8 #define IMAGE_PRECAP 16 @@ -67,6 +66,7 @@ struct ctx_image_data { unsigned long cent_dist; /* Movement center to img center distance * Note: Dist is calculated distX*distX + distY*distY */ unsigned int flags; /* See IMAGE_* defines */ bool trigger; + bool motion; ctx_coord location; /* coordinates for center and size of last motion detection*/ int total_labels; };