From cac461875520438b5039d7c995520d04116ea7d1 Mon Sep 17 00:00:00 2001 From: Remi Bettan Date: Mon, 1 Apr 2024 14:32:37 +0300 Subject: [PATCH 1/2] power line freq option with hardcoded range --- src/ds/d500/d500-options.cpp | 4 ++++ src/ds/d500/d500-options.h | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/ds/d500/d500-options.cpp b/src/ds/d500/d500-options.cpp index 57ee6e8bc5..c4765c8a38 100644 --- a/src/ds/d500/d500-options.cpp +++ b/src/ds/d500/d500-options.cpp @@ -50,4 +50,8 @@ namespace librealsense return temperature; } + + power_line_freq_option::power_line_freq_option(const std::weak_ptr< uvc_sensor >& ep, rs2_option id, + const std::map< float, std::string >& description_per_value) : + uvc_pu_option(ep, id, description_per_value) {} } diff --git a/src/ds/d500/d500-options.h b/src/ds/d500/d500-options.h index 698166e128..ecd84ec068 100644 --- a/src/ds/d500/d500-options.h +++ b/src/ds/d500/d500-options.h @@ -6,6 +6,7 @@ #include "ds/ds-private.h" #include "core/options-container.h" #include "option.h" +#include "platform/uvc-option.h" #include @@ -74,4 +75,18 @@ namespace librealsense temperature_component _component; const char* _description; }; + + class power_line_freq_option : public uvc_pu_option + { + public: + explicit power_line_freq_option(const std::weak_ptr< uvc_sensor >& ep, rs2_option id, + const std::map< float, std::string >& description_per_value); + + virtual option_range get_range() const override + { + // this range had to be harcoded to avoid collisions with linux patches + // which have been upstreamed for d400 devices + return { 0.f /*min*/, 2.f /*max*/, 1.f /*step*/, 0.f /*default*/ }; + } + }; } From a314fc736c46fed63f3e921b6572f0a77f7a5920 Mon Sep 17 00:00:00 2001 From: Remi Bettan Date: Mon, 1 Apr 2024 15:59:54 +0300 Subject: [PATCH 2/2] forcing only max value in range --- src/ds/d500/d500-color.cpp | 7 +------ src/ds/d500/d500-options.h | 8 +++++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/ds/d500/d500-color.cpp b/src/ds/d500/d500-color.cpp index ec92b6d9aa..4ecdc81b7b 100644 --- a/src/ds/d500/d500-color.cpp +++ b/src/ds/d500/d500-color.cpp @@ -143,13 +143,8 @@ namespace librealsense { 1.f, "50Hz" }, { 2.f, "60Hz" } }; - if (val_in_range(_pid, { ds::D555E_PID })) - { - description_per_value.insert(std::make_pair(3.f, "AUTO")); - } - color_ep.register_option(RS2_OPTION_POWER_LINE_FREQUENCY, - std::make_shared(raw_color_ep, RS2_OPTION_POWER_LINE_FREQUENCY, + std::make_shared(raw_color_ep, RS2_OPTION_POWER_LINE_FREQUENCY, description_per_value)); color_ep.register_pu(RS2_OPTION_AUTO_EXPOSURE_PRIORITY); diff --git a/src/ds/d500/d500-options.h b/src/ds/d500/d500-options.h index ecd84ec068..4196974412 100644 --- a/src/ds/d500/d500-options.h +++ b/src/ds/d500/d500-options.h @@ -84,9 +84,11 @@ namespace librealsense virtual option_range get_range() const override { - // this range had to be harcoded to avoid collisions with linux patches - // which have been upstreamed for d400 devices - return { 0.f /*min*/, 2.f /*max*/, 1.f /*step*/, 0.f /*default*/ }; + // this hardcoded max range has been done because + // some d500 devices do not support the "AUTO" value + auto range = uvc_pu_option::get_range(); + range.max = 2.f; + return range; } }; }