From 7c914c017ebb185eef1f5918b101c926b606d1b7 Mon Sep 17 00:00:00 2001 From: jksemple Date: Mon, 6 May 2024 17:31:49 +0100 Subject: [PATCH] return-moving-points-ratio Update an external float variable with the movingRatio calculated internally to permit calibration of the detection ration threshold within an app --- src/eloquent_esp32cam/motion/detection.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/eloquent_esp32cam/motion/detection.h b/src/eloquent_esp32cam/motion/detection.h index a62f9398..ec19460f 100644 --- a/src/eloquent_esp32cam/motion/detection.h +++ b/src/eloquent_esp32cam/motion/detection.h @@ -100,7 +100,7 @@ namespace Eloquent { /** * */ - Exception& run() { + Exception& run(float& ratio ) { // skip fre first frames if (_skip > 0 && _skip-- > 0) return exception.set(String("Still ") + _skip + " frames to skip..."); @@ -131,7 +131,7 @@ namespace Eloquent { movingRatio = ((float) movingPoints) / camera.rgb565.length * _stride * _stride; copy(camera.rgb565); }); - + ratio = movingRatio; ESP_LOGD("MotionDetection", "moving points ratio: %.2f", movingRatio); // rate limit @@ -143,7 +143,10 @@ namespace Eloquent { return exception.clear(); } - + Exception& run() { + float dummy; + return run(dummy); + } /** * @brief Convert to JSON */