From d8aa8359df6dbb5425a412c1ae83a429c33e4d7e Mon Sep 17 00:00:00 2001 From: Noha Yassin <37175819+nohayassin@users.noreply.github.com> Date: Sun, 7 Mar 2021 14:17:13 +0200 Subject: [PATCH 01/12] Auto Exposure : range value setting limitation --- src/ds5/ds5-options.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ds5/ds5-options.cpp b/src/ds5/ds5-options.cpp index 73b5869352..ed25a28f1e 100644 --- a/src/ds5/ds5-options.cpp +++ b/src/ds5/ds5-options.cpp @@ -669,6 +669,12 @@ namespace librealsense void auto_exposure_limit_option::set(float value) { + if (value < get_range().min || value > get_range().max) + { + LOG_ERROR("Auto Exposure new value - " << value << " - is outside the limit : min = " + << get_range().min << ", max = " << get_range().max << ".\n"); + return; + } command cmd_get(ds::AUTO_CALIB); cmd_get.param1 = 5; std::vector ret = _hwm.send(cmd_get); From 0c3e72442129ac42b1f85122821628e2056b75d8 Mon Sep 17 00:00:00 2001 From: Noha Yassin <37175819+nohayassin@users.noreply.github.com> Date: Sun, 7 Mar 2021 14:55:16 +0200 Subject: [PATCH 02/12] Auto Exposure : range value setting limitation --- src/ds5/ds5-options.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ds5/ds5-options.cpp b/src/ds5/ds5-options.cpp index ed25a28f1e..6d4074bd52 100644 --- a/src/ds5/ds5-options.cpp +++ b/src/ds5/ds5-options.cpp @@ -671,8 +671,8 @@ namespace librealsense { if (value < get_range().min || value > get_range().max) { - LOG_ERROR("Auto Exposure new value - " << value << " - is outside the limit : min = " - << get_range().min << ", max = " << get_range().max << ".\n"); + LOG_ERROR("Auto Exposure new value " << value << " is outside the range [" + << get_range().min << ", " << get_range().max << "].\n"); return; } command cmd_get(ds::AUTO_CALIB); From 3ccd14c220e0c321e921fab79b95a2e5507212c2 Mon Sep 17 00:00:00 2001 From: Noha Yassin <37175819+nohayassin@users.noreply.github.com> Date: Mon, 8 Mar 2021 10:28:21 +0200 Subject: [PATCH 03/12] used built-in functions --- src/ds5/ds5-options.cpp | 11 ++++------- src/ds5/ds5-options.h | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/ds5/ds5-options.cpp b/src/ds5/ds5-options.cpp index 6d4074bd52..8e20c4f80f 100644 --- a/src/ds5/ds5-options.cpp +++ b/src/ds5/ds5-options.cpp @@ -659,7 +659,7 @@ namespace librealsense } auto_exposure_limit_option::auto_exposure_limit_option(hw_monitor& hwm, sensor_base* ep) - : _hwm(hwm), _sensor(ep) + : option_base(option_range{ 0, 165000, 1, 0 }), _hwm(hwm), _sensor(ep) { _range = [this]() { @@ -669,12 +669,9 @@ namespace librealsense void auto_exposure_limit_option::set(float value) { - if (value < get_range().min || value > get_range().max) - { - LOG_ERROR("Auto Exposure new value " << value << " is outside the range [" - << get_range().min << ", " << get_range().max << "].\n"); - return; - } + if (!is_valid(value)) + throw invalid_value_exception("set(enable_auto_exposure) failed! Invalid Auto-Exposure mode request " + std::to_string(value)); + command cmd_get(ds::AUTO_CALIB); cmd_get.param1 = 5; std::vector ret = _hwm.send(cmd_get); diff --git a/src/ds5/ds5-options.h b/src/ds5/ds5-options.h index 4532f0f160..1007fc8666 100644 --- a/src/ds5/ds5-options.h +++ b/src/ds5/ds5-options.h @@ -354,7 +354,7 @@ namespace librealsense std::shared_ptr