diff --git a/src/ds/d400/d400-device.cpp b/src/ds/d400/d400-device.cpp index 8e43e1b1a67..3e58700d2b0 100644 --- a/src/ds/d400/d400-device.cpp +++ b/src/ds/d400/d400-device.cpp @@ -187,10 +187,6 @@ namespace librealsense synthetic_sensor::open(requests); - // needed in order to restore the HDR sub-preset when streaming is turned off and on - if (_hdr_cfg && _hdr_cfg->is_enabled()) - get_option(RS2_OPTION_HDR_ENABLED).set(1.f); - // Activate Thermal Compensation tracking if (supports_option(RS2_OPTION_THERMAL_COMPENSATION)) _owner->_thermal_monitor->update(true); diff --git a/src/ds/ds-options.cpp b/src/ds/ds-options.cpp index d70ef6c3543..e7a351b747a 100644 --- a/src/ds/ds-options.cpp +++ b/src/ds/ds-options.cpp @@ -617,6 +617,10 @@ namespace librealsense else { if (_hdr_cfg->is_enabled()) + /*throw wrong_api_call_sequence_exception( + rsutils::string::from() << "The control - " << _uvc_option->get_description() + << " - is locked while HDR mode is active.");*/ + LOG_WARNING("The control - " << _uvc_option->get_description() << " - is locked while HDR mode is active.\n"); else diff --git a/src/hdr-config.cpp b/src/hdr-config.cpp index bc82809f7f0..821d413c18f 100644 --- a/src/hdr-config.cpp +++ b/src/hdr-config.cpp @@ -15,7 +15,6 @@ namespace librealsense _sensor(depth_ep), _is_enabled(false), _is_config_in_process(false), - _has_config_changed(false), _current_hdr_sequence_index(DEFAULT_CURRENT_HDR_SEQUENCE_INDEX), _auto_exposure_to_be_restored(false), _emitter_on_off_to_be_restored(false), @@ -215,12 +214,6 @@ namespace librealsense default: throw invalid_value_exception("option is not an HDR option"); } - - // subpreset configuration change is immediately sent to firmware if HDR is already running - if (_is_enabled && _has_config_changed) - { - send_sub_preset_to_fw(); - } } bool hdr_config::is_config_in_process() const @@ -280,8 +273,14 @@ namespace librealsense } } - _is_enabled = send_sub_preset_to_fw(); - _has_config_changed = false; + std::vector response; + send_sub_preset_to_fw(); + _is_enabled = is_hdr_enabled_in_device(response); + configure_hdr_as_in_fw(response); + } + else + { + LOG_WARNING("HDR: re-enablement not supported. Disable HDR first and then try enabling again." ); } } else @@ -504,15 +503,29 @@ namespace librealsense void hdr_config::set_exposure(float value) { - _hdr_sequence_params[_current_hdr_sequence_index]._exposure = value; - _has_config_changed = true; + std::vector res; + _is_enabled = is_hdr_enabled_in_device(res); + if (!_is_enabled) + _hdr_sequence_params[_current_hdr_sequence_index]._exposure = value; + else + /*throw wrong_api_call_sequence_exception( + rsutils::string::from() << "hdr_config::set_exposure(...) failed! Cannot update HDR when it is already enabled." );*/ + LOG_WARNING("hdr_config::set_exposure(...) failed! Cannot update HDR when it is already enabled.\n"); } void hdr_config::set_gain(float value) { - _hdr_sequence_params[_current_hdr_sequence_index]._gain = value; - _has_config_changed = true; - } + std::vector res; + _is_enabled = is_hdr_enabled_in_device(res); + if (!_is_enabled) + { + _hdr_sequence_params[_current_hdr_sequence_index]._gain = value; + } + else + /*throw invalid_value_exception( + rsutils::string::from() << "hdr_config::set_gain(...) failed! Cannot update HDR when it is already enabled." );*/ + LOG_WARNING("hdr_config::set_gain(...) failed! Cannot update HDR when it is already enabled.\n"); +} hdr_params::hdr_params() : diff --git a/src/hdr-config.h b/src/hdr-config.h index 25309012cc9..a54ff524d46 100644 --- a/src/hdr-config.h +++ b/src/hdr-config.h @@ -79,7 +79,6 @@ namespace librealsense int _current_hdr_sequence_index; mutable bool _is_enabled; bool _is_config_in_process; - bool _has_config_changed; bool _auto_exposure_to_be_restored; bool _emitter_on_off_to_be_restored; hw_monitor& _hwm;