Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mode check remove #8338

Merged
merged 3 commits into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/l500/l500-depth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,16 +712,6 @@ namespace librealsense
{
auto&& sensor_mode_option = get_option(RS2_OPTION_SENSOR_MODE);
auto vs = dynamic_cast<video_stream_profile*>((*dp).get());
if (supports_option(RS2_OPTION_VISUAL_PRESET))
{
auto&& preset_option = get_option(RS2_OPTION_VISUAL_PRESET);
if (preset_option.query() == RS2_L500_VISUAL_PRESET_CUSTOM)
{
if(sensor_mode_option.query() != get_resolution_from_width_height(vs->get_width(), vs->get_height()))
throw std::runtime_error(to_string() << "sensor mode ("<< rs2_sensor_mode((int)sensor_mode_option.query())<<") with RS2_L500_VISUAL_PRESET_CUSTOM is incompatible with the requested profile resolution ("
<< get_resolution_from_width_height(vs->get_width(), vs->get_height())<<")");
}
}
if( vs->get_format() == RS2_FORMAT_Z16 )
sensor_mode_option.set(float(get_resolution_from_width_height(vs->get_width(), vs->get_height())));
}
Expand Down
36 changes: 36 additions & 0 deletions unit-tests/func/presets/custom/test-streaming.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2020 Intel Corporation. All Rights Reserved.

//#cmake: static!

#include "../../func-common.h"
#include "../presets-common.h"

using namespace rs2;

// This test checks that if we are on custom preset and start streaming,
// with profile that has different resolution than the value of the
// sensor mode control LRS don't throw an exception and update the
// sensor mode according the profile
TEST_CASE( "sensor mode change while streaming on custom", "[l500][live]" )
{
auto devices = find_devices_by_product_line_or_exit( RS2_PRODUCT_LINE_L500 );
auto dev = devices[0];

exit_if_fw_version_is_under( dev, MIN_GET_DEFAULT_FW_VERSION );

auto depth_sens = dev.first< rs2::depth_sensor >();

reset_camera_preset_mode_to_defaults( depth_sens );

REQUIRE_NOTHROW(
depth_sens.set_option(RS2_OPTION_VISUAL_PRESET,RS2_L500_VISUAL_PRESET_CUSTOM));
maloel marked this conversation as resolved.
Show resolved Hide resolved

start_depth_ir_confidence(depth_sens, RS2_SENSOR_MODE_XGA);

auto curr_sensor_mode = RS2_SENSOR_MODE_VGA;
REQUIRE_NOTHROW(curr_sensor_mode = (rs2_sensor_mode)(int)depth_sens.get_option(RS2_OPTION_SENSOR_MODE));
REQUIRE(curr_sensor_mode == RS2_SENSOR_MODE_XGA);

stop_depth(depth_sens);
}