Skip to content

Commit

Permalink
Set/get preset as bulk operation reduces operation time
Browse files Browse the repository at this point in the history
  • Loading branch information
OhadMeir committed Dec 19, 2024
1 parent 01ac786 commit 2fb8907
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/ds/advanced_mode/advanced_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ namespace librealsense
preset ds_advanced_mode_base::get_all() const
{
preset p;
_depth_sensor.prepare_for_bulk_operation();
get_depth_control_group(&p.depth_controls);
get_rsm(&p.rsm);
get_rau_support_vector_control(&p.rsvc);
Expand All @@ -753,6 +754,10 @@ namespace librealsense
get_depth_auto_exposure(&p.depth_auto_exposure);
get_depth_gain(&p.depth_gain);
get_depth_auto_white_balance(&p.depth_auto_white_balance);
_depth_sensor.finished_bulk_operation();

if( *_color_sensor )
( *_color_sensor )->prepare_for_bulk_operation();
get_color_exposure(&p.color_exposure);
get_color_auto_exposure(&p.color_auto_exposure);
get_color_backlight_compensation(&p.color_backlight_compensation);
Expand All @@ -766,6 +771,9 @@ namespace librealsense
get_color_white_balance(&p.color_white_balance);
get_color_auto_white_balance(&p.color_auto_white_balance);
get_color_power_line_frequency(&p.color_power_line_frequency);
if( *_color_sensor )
( *_color_sensor )->finished_bulk_operation();

return p;
}

Expand All @@ -778,6 +786,8 @@ namespace librealsense

void ds_advanced_mode_base::set_all_depth(const preset& p)
{
_depth_sensor.prepare_for_bulk_operation();

set(p.depth_controls, advanced_mode_traits<STDepthControlGroup>::group);
set(p.rsm , advanced_mode_traits<STRsm>::group);
set(p.rsvc , advanced_mode_traits<STRauSupportVectorControl>::group);
Expand Down Expand Up @@ -809,10 +819,15 @@ namespace librealsense
set( p.rctc , advanced_mode_traits< STRauColorThresholdsControl >::group );
set( p.sctc , advanced_mode_traits< STSloColorThresholdsControl >::group );
set( p.spc , advanced_mode_traits< STSloPenaltyControl >::group );

_depth_sensor.finished_bulk_operation();
}

void ds_advanced_mode_base::set_all_rgb( const preset & p )
{
if( *_color_sensor )
( *_color_sensor )->prepare_for_bulk_operation();

set_color_auto_exposure(p.color_auto_exposure);
if (p.color_auto_exposure.was_set && p.color_auto_exposure.auto_exposure == 0)
{
Expand All @@ -834,6 +849,9 @@ namespace librealsense

// TODO: W/O due to a FW bug of power_line_frequency control on Windows OS
//set_color_power_line_frequency(p.color_power_line_frequency);

if( *_color_sensor )
( *_color_sensor )->finished_bulk_operation();
}

bool ds_advanced_mode_base::should_set_rgb_preset() const
Expand Down

0 comments on commit 2fb8907

Please sign in to comment.