Skip to content
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
11 changes: 11 additions & 0 deletions tools/depth-quality/depth-quality-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,17 @@ namespace rs2
{
try // Retries are needed to cope with HW stability issues
{

auto dev = cfg.resolve(_pipe);
auto depth_sensor = dev.get_device().first< rs2::depth_sensor >();
if (depth_sensor.supports(RS2_OPTION_SENSOR_MODE))
{
auto depth_profile = dev.get_stream(RS2_STREAM_DEPTH);
auto w = depth_profile.as<video_stream_profile>().width();
auto h = depth_profile.as<video_stream_profile>().height();
depth_sensor.set_option(RS2_OPTION_SENSOR_MODE, resolution_from_width_height(w, h));
}

auto profile = _pipe.start(cfg);
success = profile;
}
Expand Down
48 changes: 0 additions & 48 deletions unit-tests/func/func-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,51 +150,3 @@ inline void do_while_streaming( rs2::sensor depth_sens,
depth_sens.stop();
depth_sens.close();
}

struct hw_monitor_command
{
hw_monitor_command(
unsigned int in_cmd, int in_p1 = 0, int in_p2 = 0, int in_p3 = 0, int in_p4 = 0 )
: cmd( in_cmd )
, p1( in_p1 )
, p2( in_p2 )
, p3( in_p3 )
, p4( in_p4 )
{
}

unsigned int cmd;
int p1;
int p2;
int p3;
int p4;
};

std::vector< uint8_t > send_command_and_check( rs2::debug_protocol dp,
hw_monitor_command command,
uint32_t expected_size_return = 0 )
{
const int MAX_HW_MONITOR_BUFFER_SIZE = 1024;

std::vector< uint8_t > res( MAX_HW_MONITOR_BUFFER_SIZE, 0 );
int size = 0;

librealsense::hw_monitor::fill_usb_buffer( command.cmd,
command.p1,
command.p2,
command.p3,
command.p4,
nullptr,
0,
res.data(),
size );

res = dp.send_and_receive_raw_data( res );
REQUIRE( res.size() == sizeof( unsigned int ) * ( expected_size_return + 1 ) ); // opcode

auto vals = reinterpret_cast< int32_t * >( (void *)res.data() );
REQUIRE( vals[0] == command.cmd );
res.erase( res.begin(), res.begin() + sizeof( unsigned int ) ); // remove opcode

return res;
}
11 changes: 6 additions & 5 deletions unit-tests/func/presets/presets-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <types.h>
#include "l500/l500-private.h"
#include "l500/l500-options.h"
#include "../send-hw-monitor-command.h"

using namespace rs2;

Expand Down Expand Up @@ -44,16 +45,16 @@ std::map< rs2_option, librealsense::l500_control > option_to_code = {

enum presets_useful_laser_values
{
defualt_laser,
default_laser,
max_laser
};

const std::map< rs2_l500_visual_preset, std::pair< rs2_digital_gain, presets_useful_laser_values > >
preset_to_gain_and_laser_map
= { { RS2_L500_VISUAL_PRESET_NO_AMBIENT, { RS2_DIGITAL_GAIN_HIGH, defualt_laser } },
= { { RS2_L500_VISUAL_PRESET_NO_AMBIENT, { RS2_DIGITAL_GAIN_HIGH, default_laser } },
{ RS2_L500_VISUAL_PRESET_MAX_RANGE, { RS2_DIGITAL_GAIN_HIGH, max_laser } },
{ RS2_L500_VISUAL_PRESET_LOW_AMBIENT, { RS2_DIGITAL_GAIN_LOW, defualt_laser } },
{ RS2_L500_VISUAL_PRESET_SHORT_RANGE, { RS2_DIGITAL_GAIN_LOW, max_laser } } };
{ RS2_L500_VISUAL_PRESET_LOW_AMBIENT, { RS2_DIGITAL_GAIN_LOW, max_laser } },
{ RS2_L500_VISUAL_PRESET_SHORT_RANGE, { RS2_DIGITAL_GAIN_LOW, default_laser } } };

// except from RS2_L500_VISUAL_PRESET_AUTOMATIC and RS2_L500_VISUAL_PRESET_CUSTOM
void for_each_preset_mode_combination(
Expand Down Expand Up @@ -195,7 +196,7 @@ void build_preset_to_expected_values_map( rs2::device & dev,


expected_values[RS2_OPTION_LASER_POWER]
= preset_to_gain_and_laser[preset].second == defualt_laser ? laser_range.def
= preset_to_gain_and_laser[preset].second == default_laser ? laser_range.def
: laser_range.max;
}

Expand Down
56 changes: 56 additions & 0 deletions unit-tests/func/send-hw-monitor-command.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2020 Intel Corporation. All Rights Reserved.

#include "../test.h"
#include "librealsense2/rs.hpp"
#include "hw-monitor.h"

using namespace rs2;

struct hw_monitor_command
{
hw_monitor_command(
unsigned int in_cmd, int in_p1 = 0, int in_p2 = 0, int in_p3 = 0, int in_p4 = 0 )
: cmd( in_cmd )
, p1( in_p1 )
, p2( in_p2 )
, p3( in_p3 )
, p4( in_p4 )
{
}

unsigned int cmd;
int p1;
int p2;
int p3;
int p4;
};

std::vector< uint8_t > send_command_and_check( rs2::debug_protocol dp,
hw_monitor_command command,
uint32_t expected_size_return = 0 )
{
const int MAX_HW_MONITOR_BUFFER_SIZE = 1024;

std::vector< uint8_t > res( MAX_HW_MONITOR_BUFFER_SIZE, 0 );
int size = 0;

librealsense::hw_monitor::fill_usb_buffer( command.cmd,
command.p1,
command.p2,
command.p3,
command.p4,
nullptr,
0,
res.data(),
size );

res = dp.send_and_receive_raw_data( res );
REQUIRE( res.size() == sizeof( unsigned int ) * ( expected_size_return + 1 ) ); // opcode

auto vals = reinterpret_cast< int32_t * >( (void *)res.data() );
REQUIRE( vals[0] == command.cmd );
res.erase( res.begin(), res.begin() + sizeof( unsigned int ) ); // remove opcode

return res;
}