From 2fb89074db25f1e1a3aa2b6775df48b600d6ce56 Mon Sep 17 00:00:00 2001 From: ohadmeir Date: Thu, 19 Dec 2024 15:23:38 +0200 Subject: [PATCH] Set/get preset as bulk operation reduces operation time --- src/ds/advanced_mode/advanced_mode.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/ds/advanced_mode/advanced_mode.cpp b/src/ds/advanced_mode/advanced_mode.cpp index 5627f19c47..7569693bbd 100644 --- a/src/ds/advanced_mode/advanced_mode.cpp +++ b/src/ds/advanced_mode/advanced_mode.cpp @@ -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); @@ -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); @@ -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; } @@ -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::group); set(p.rsm , advanced_mode_traits::group); set(p.rsvc , advanced_mode_traits::group); @@ -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) { @@ -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