Skip to content

Commit

Permalink
PR #12813 from remibettan: power line freq option with hardcoded range
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az authored Apr 2, 2024
2 parents 55cd4be + a314fc7 commit 29b61a6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/ds/d500/d500-color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uvc_pu_option>(raw_color_ep, RS2_OPTION_POWER_LINE_FREQUENCY,
std::make_shared<power_line_freq_option>(raw_color_ep, RS2_OPTION_POWER_LINE_FREQUENCY,
description_per_value));

color_ep.register_pu(RS2_OPTION_AUTO_EXPOSURE_PRIORITY);
Expand Down
4 changes: 4 additions & 0 deletions src/ds/d500/d500-options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
}
17 changes: 17 additions & 0 deletions src/ds/d500/d500-options.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "ds/ds-private.h"
#include "core/options-container.h"
#include "option.h"
#include "platform/uvc-option.h"

#include <rsutils/lazy.h>

Expand Down Expand Up @@ -74,4 +75,20 @@ 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 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;
}
};
}

0 comments on commit 29b61a6

Please sign in to comment.