From edf6f5e58cbea282f0afb8f08ec5673e7f86cf96 Mon Sep 17 00:00:00 2001 From: Nir-Az Date: Sun, 25 Sep 2022 11:20:12 +0300 Subject: [PATCH] fixes & cosmetics --- common/model-views.cpp | 616 ++++++++++++++++++++-------------------- common/model-views.h | 4 +- src/ds5/ds5-active.cpp | 19 +- src/ds5/ds5-options.cpp | 13 +- src/ds5/ds5-options.h | 5 +- 5 files changed, 342 insertions(+), 315 deletions(-) diff --git a/common/model-views.cpp b/common/model-views.cpp index 2d8cea7fae..59331ace35 100644 --- a/common/model-views.cpp +++ b/common/model-views.cpp @@ -568,14 +568,6 @@ namespace rs2 if (opt == RS2_OPTION_HOLES_FILL) use_option_name = false; - // lambda function used to convert meters to cm - while the number is a string - auto convert_float_str = [](std::string float_str, float conversion_factor) { - if (float_str.size() == 0) - return float_str; - float number_float = std::stof(float_str); - return std::to_string(number_float * conversion_factor); - }; - std::string desc_str (endpoint->get_option_description(opt)); // Device D405 is for short range, therefore, its units are in cm - for better UX @@ -595,304 +587,18 @@ namespace rs2 if (is_checkbox()) { - auto bool_value = value > 0.0f; - if (ImGui::Checkbox(label.c_str(), &bool_value)) - { - if (allow_change((bool_value ? 1.0f : 0.0f), error_message)) - { - res = true; - model.add_log(to_string() << "Setting " << opt << " to " - << (bool_value? "1.0" : "0.0") << " (" << (bool_value ? "ON" : "OFF") << ")"); - - set_option(opt, bool_value ? 1.f : 0.f, error_message); - *invalidate_flag = true; - } - } - if (ImGui::IsItemHovered() && desc) - { - ImGui::SetTooltip("%s", desc); - } + res = draw_checkbox( model, error_message, desc ); } else { - if (!is_enum()) + if( !is_enum() ) { - std::string txt = to_string() << endpoint->get_option_name(opt) << ":"; - ImGui::Text("%s", txt.c_str()); - - ImGui::SameLine(); - ImGui::SetCursorPosX(read_only ? 268.f : 245.f); - ImGui::PushStyleColor(ImGuiCol_Text, grey); - ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, grey); - ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 1.f,1.f,1.f,0.f }); - ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 1.f,1.f,1.f,0.f }); - ImGui::PushStyleColor(ImGuiCol_Button, { 1.f,1.f,1.f,0.f }); - ImGui::Button(textual_icons::question_mark, { 20, 20 }); - ImGui::PopStyleColor(5); - if (ImGui::IsItemHovered() && desc) - { - ImGui::SetTooltip("%s", desc); - } - - if (!read_only) - { - ImGui::SameLine(); - ImGui::SetCursorPosX(268); - if (!edit_mode) - { - std::string edit_id = to_string() << textual_icons::edit << "##" << id; - ImGui::PushStyleColor(ImGuiCol_Text, light_grey); - ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, light_grey); - ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 1.f,1.f,1.f,0.f }); - ImGui::PushStyleColor(ImGuiCol_Button, { 1.f,1.f,1.f,0.f }); - if (ImGui::Button(edit_id.c_str(), { 20, 20 })) - { - if (is_all_integers()) - edit_value = to_string() << (int)value; - else - edit_value = to_string() << value; - edit_mode = true; - } - if (ImGui::IsItemHovered()) - { - ImGui::SetTooltip("Enter text-edit mode"); - } - ImGui::PopStyleColor(4); - } - else - { - std::string edit_id = to_string() << textual_icons::edit << "##" << id; - ImGui::PushStyleColor(ImGuiCol_Text, light_blue); - ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, light_blue); - ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 1.f,1.f,1.f,0.f }); - ImGui::PushStyleColor(ImGuiCol_Button, { 1.f,1.f,1.f,0.f }); - if (ImGui::Button(edit_id.c_str(), { 20, 20 })) - { - edit_mode = false; - } - if (ImGui::IsItemHovered()) - { - ImGui::SetTooltip("Exit text-edit mode"); - } - ImGui::PopStyleColor(4); - } - } - - ImGui::PushItemWidth(-1); - - try - { - if (read_only) - { - ImVec2 vec{ 0, 20 }; - std::string text = (value == (int)value) ? std::to_string((int)value) : std::to_string(value); - if (range.min != range.max) - { - ImGui::ProgressBar((value / (range.max - range.min)), vec, text.c_str()); - } - else //constant value options - { - auto c = ImGui::ColorConvertU32ToFloat4(ImGui::GetColorU32(ImGuiCol_FrameBg)); - ImGui::PushStyleColor(ImGuiCol_FrameBgActive, c); - ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, c); - float dummy = std::floor(value); - if (ImGui::DragFloat(id.c_str(), &dummy, 1, 0, 0, text.c_str())) - { - // Changing the depth units not on advanced mode is not allowed, - // prompt the user to switch to advanced mode for chaging it. - if (RS2_OPTION_DEPTH_UNITS == opt) - { - auto advanced = dev->dev.as(); - if (advanced) - if (!advanced.is_enabled()) - dev->draw_advanced_mode_prompt = true; - } - } - ImGui::PopStyleColor(2); - } - } - else if (edit_mode) - { - std::string buff_str = edit_value; - - // when cm must be used instead of meters - if (use_cm_units) - buff_str = convert_float_str(buff_str, 100.f); - - char buff[TEXT_BUFF_SIZE]; - memset(buff, 0, TEXT_BUFF_SIZE); - strcpy(buff, buff_str.c_str()); - - if (ImGui::InputText(id.c_str(), buff, TEXT_BUFF_SIZE, - ImGuiInputTextFlags_EnterReturnsTrue)) - { - if (use_cm_units) - { - buff_str = convert_float_str(std::string(buff), 0.01f); - memset(buff, 0, TEXT_BUFF_SIZE); - strcpy(buff, buff_str.c_str()); - } - float new_value; - if (!utilities::string::string_to_value(buff, new_value)) - { - error_message = "Invalid float input!"; - } - else if (new_value < range.min || new_value > range.max) - { - float val = use_cm_units ? new_value * 100.f : new_value; - float min = use_cm_units ? range.min * 100.f : range.min; - float max = use_cm_units ? range.max * 100.f : range.max; - - error_message = to_string() << val - << " is out of bounds [" << min << ", " << max << "]"; - } - else - { - set_option(opt, new_value, error_message); - } - edit_mode = false; - } - else if (use_cm_units) - { - buff_str = convert_float_str(buff_str, 0.01f); - memset(buff, 0, TEXT_BUFF_SIZE); - strcpy(buff, buff_str.c_str()); - } - edit_value = buff; - } - else if (is_all_integers()) - { - auto int_value = static_cast(value); - - if (ImGui::SliderIntWithSteps(id.c_str(), &int_value, - static_cast(range.min), - static_cast(range.max), - static_cast(range.step))) - { - // TODO: Round to step? - res = slider_selected( opt, static_cast< float >( int_value ), error_message, model ); - } - else - { - res = slider_unselected( opt, static_cast< float >( int_value ), error_message, model ); - } - } - else - { - float tmp_value = value; - float temp_value_displayed = tmp_value; - float min_range_displayed = range.min; - float max_range_displayed = range.max; - - // computing the number of decimal digits taken from the step options' property - // this will then be used to format the displayed value - auto num_of_decimal_digits = [](float f) { - float f_0 = std::fabs(f - (int)f); - std::string s = std::to_string(f_0); - size_t cur_len = s.length(); - //removing trailing zeros - while (cur_len > 3 && s[cur_len - 1] == '0') - cur_len--; - return cur_len - 2; - }; - int num_of_decimal_digits_displayed = (int)num_of_decimal_digits(range.step); - - // displaying in cm instead of meters for D405 - if (use_cm_units) - { - temp_value_displayed *= 100.f; - min_range_displayed *= 100.f; - max_range_displayed *= 100.f; - int updated_num_of_decimal_digits_displayed = num_of_decimal_digits_displayed - 2; - if (updated_num_of_decimal_digits_displayed > 0) - num_of_decimal_digits_displayed = updated_num_of_decimal_digits_displayed; - } - - std::stringstream formatting_ss; - formatting_ss << "%." << num_of_decimal_digits_displayed << "f"; - - - if (ImGui::SliderFloat(id.c_str(), &temp_value_displayed, - min_range_displayed, max_range_displayed, formatting_ss.str().c_str())) - { - tmp_value = use_cm_units ? temp_value_displayed / 100.f : temp_value_displayed; - auto loffset = std::abs(fmod(tmp_value, range.step)); - auto roffset = range.step - loffset; - if (tmp_value >= 0) - tmp_value = (loffset < roffset) ? tmp_value - loffset : tmp_value + roffset; - else - tmp_value = (loffset < roffset) ? tmp_value + loffset : tmp_value - roffset; - tmp_value = (tmp_value < range.min) ? range.min : tmp_value; - tmp_value = (tmp_value > range.max) ? range.max : tmp_value; - - res = slider_selected( opt, tmp_value, error_message, model ); - } - else - { - res = slider_unselected( opt, tmp_value, error_message, model ); - } - } - } - catch (const error& e) - { - error_message = error_to_string(e); - } + res = draw_slider( model, error_message, desc, use_cm_units ); } else { - std::string txt = to_string() << (use_option_name ? endpoint->get_option_name(opt) : desc) << ":"; - - auto pos_x = ImGui::GetCursorPosX(); - - ImGui::Text("%s", txt.c_str()); - if (ImGui::IsItemHovered() && desc) - { - ImGui::SetTooltip("%s", desc); - } - - ImGui::SameLine(); - if (new_line) - ImGui::SetCursorPosX(pos_x + 120); - - ImGui::PushItemWidth(new_line ? -1.f : 100.f); - - std::vector labels; - auto selected = 0, counter = 0; - for (auto i = range.min; i <= range.max; i += range.step, counter++) - { - if (std::fabs(i - value) < 0.001f) selected = counter; - labels.push_back(endpoint->get_option_value_description(opt, i)); - } - ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, { 1,1,1,1 }); - - try - { - int tmp_selected = selected; - float tmp_value = value; - ImGui::PushItemWidth(135.f); - if (ImGui::Combo(id.c_str(), &tmp_selected, labels.data(), - static_cast(labels.size()))) - { - tmp_value = range.min + range.step * tmp_selected; - model.add_log(to_string() << "Setting " << opt << " to " - << tmp_value << " (" << labels[tmp_selected] << ")"); - set_option(opt, tmp_value, error_message); - selected = tmp_selected; - if (invalidate_flag) *invalidate_flag = true; - res = true; - } - } - catch (const error& e) - { - error_message = error_to_string(e); - } - - ImGui::PopStyleColor(); - - ImGui::PopItemWidth(); + res = draw_combobox( model, error_message, desc, new_line, use_option_name ); } - - } if (!read_only && opt == RS2_OPTION_ENABLE_AUTO_EXPOSURE && dev->auto_exposure_enabled && dev->s->is() && dev->streaming) @@ -997,6 +703,299 @@ namespace rs2 return true; } + bool option_model::draw_combobox( notifications_model& model, std::string& error_message, const char *description, bool new_line, bool use_option_name ) + { + bool item_clicked = false; + std::string txt = to_string() << ( use_option_name ? endpoint->get_option_name( opt ) : description ) << ":"; + + auto pos_x = ImGui::GetCursorPosX(); + + ImGui::Text( "%s", txt.c_str() ); + if( ImGui::IsItemHovered() && description ) + { + ImGui::SetTooltip( "%s", description ); + } + + ImGui::SameLine(); + if( new_line ) + ImGui::SetCursorPosX( pos_x + 120 ); + + ImGui::PushItemWidth( new_line ? -1.f : 100.f ); + + std::vector< const char * > labels; + auto selected = 0, counter = 0; + for( auto i = range.min; i <= range.max; i += range.step, counter++ ) + { + if( std::fabs( i - value ) < 0.001f ) + selected = counter; + labels.push_back( endpoint->get_option_value_description( opt, i ) ); + } + ImGui::PushStyleColor( ImGuiCol_TextSelectedBg, { 1, 1, 1, 1 } ); + + try + { + int tmp_selected = selected; + float tmp_value = value; + ImGui::PushItemWidth( 135.f ); + if( ImGui::Combo( id.c_str(), + &tmp_selected, + labels.data(), + static_cast< int >( labels.size() ) ) ) + { + tmp_value = range.min + range.step * tmp_selected; + model.add_log( to_string() << "Setting " << opt << " to " << tmp_value << " (" + << labels[tmp_selected] << ")" ); + set_option( opt, tmp_value, error_message ); + selected = tmp_selected; + if( invalidate_flag ) + *invalidate_flag = true; + item_clicked = true; + } + } + catch( const error & e ) + { + error_message = error_to_string( e ); + } + + ImGui::PopStyleColor(); + ImGui::PopItemWidth(); + return item_clicked; + } + bool option_model::draw_slider( notifications_model& model, std::string& error_message, const char* description, bool use_cm_units ) + { + bool slider_clicked = false; + std::string txt = to_string() << endpoint->get_option_name(opt) << ":"; + ImGui::Text("%s", txt.c_str()); + + ImGui::SameLine(); + ImGui::SetCursorPosX(read_only ? 268.f : 245.f); + ImGui::PushStyleColor(ImGuiCol_Text, grey); + ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, grey); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 1.f,1.f,1.f,0.f }); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 1.f,1.f,1.f,0.f }); + ImGui::PushStyleColor(ImGuiCol_Button, { 1.f,1.f,1.f,0.f }); + ImGui::Button(textual_icons::question_mark, { 20, 20 }); + ImGui::PopStyleColor(5); + if (ImGui::IsItemHovered() && description) + { + ImGui::SetTooltip("%s", description); + } + + if (!read_only) + { + ImGui::SameLine(); + ImGui::SetCursorPosX(268); + if (!edit_mode) + { + std::string edit_id = to_string() << textual_icons::edit << "##" << id; + ImGui::PushStyleColor(ImGuiCol_Text, light_grey); + ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, light_grey); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 1.f,1.f,1.f,0.f }); + ImGui::PushStyleColor(ImGuiCol_Button, { 1.f,1.f,1.f,0.f }); + if (ImGui::Button(edit_id.c_str(), { 20, 20 })) + { + if (is_all_integers()) + edit_value = to_string() << (int)value; + else + edit_value = to_string() << value; + edit_mode = true; + } + if (ImGui::IsItemHovered()) + { + ImGui::SetTooltip("Enter text-edit mode"); + } + ImGui::PopStyleColor(4); + } + else + { + std::string edit_id = to_string() << textual_icons::edit << "##" << id; + ImGui::PushStyleColor(ImGuiCol_Text, light_blue); + ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, light_blue); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 1.f,1.f,1.f,0.f }); + ImGui::PushStyleColor(ImGuiCol_Button, { 1.f,1.f,1.f,0.f }); + if (ImGui::Button(edit_id.c_str(), { 20, 20 })) + { + edit_mode = false; + } + if (ImGui::IsItemHovered()) + { + ImGui::SetTooltip("Exit text-edit mode"); + } + ImGui::PopStyleColor(4); + } + } + + ImGui::PushItemWidth(-1); + + try + { + if (read_only) + { + ImVec2 vec{ 0, 20 }; + std::string text = (value == (int)value) ? std::to_string((int)value) : std::to_string(value); + if (range.min != range.max) + { + ImGui::ProgressBar((value / (range.max - range.min)), vec, text.c_str()); + } + else //constant value options + { + auto c = ImGui::ColorConvertU32ToFloat4(ImGui::GetColorU32(ImGuiCol_FrameBg)); + ImGui::PushStyleColor(ImGuiCol_FrameBgActive, c); + ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, c); + float dummy = std::floor(value); + if (ImGui::DragFloat(id.c_str(), &dummy, 1, 0, 0, text.c_str())) + { + // Changing the depth units not on advanced mode is not allowed, + // prompt the user to switch to advanced mode for chaging it. + if (RS2_OPTION_DEPTH_UNITS == opt) + { + auto advanced = dev->dev.as(); + if (advanced) + if (!advanced.is_enabled()) + dev->draw_advanced_mode_prompt = true; + } + } + ImGui::PopStyleColor(2); + } + } + else if (edit_mode) + { + std::string buff_str = edit_value; + + // lambda function used to convert meters to cm - while the number is a string + auto convert_float_str = [](std::string float_str, float conversion_factor) { + if (float_str.size() == 0) + return float_str; + float number_float = std::stof(float_str); + return std::to_string(number_float * conversion_factor); + }; + + // when cm must be used instead of meters + if (use_cm_units) + buff_str = convert_float_str(buff_str, 100.f); + + char buff[TEXT_BUFF_SIZE]; + memset(buff, 0, TEXT_BUFF_SIZE); + strcpy(buff, buff_str.c_str()); + + if (ImGui::InputText(id.c_str(), buff, TEXT_BUFF_SIZE, + ImGuiInputTextFlags_EnterReturnsTrue)) + { + if (use_cm_units) + { + buff_str = convert_float_str(std::string(buff), 0.01f); + memset(buff, 0, TEXT_BUFF_SIZE); + strcpy(buff, buff_str.c_str()); + } + float new_value; + if (!utilities::string::string_to_value(buff, new_value)) + { + error_message = "Invalid float input!"; + } + else if (new_value < range.min || new_value > range.max) + { + float val = use_cm_units ? new_value * 100.f : new_value; + float min = use_cm_units ? range.min * 100.f : range.min; + float max = use_cm_units ? range.max * 100.f : range.max; + + error_message = to_string() << val + << " is out of bounds [" << min << ", " << max << "]"; + } + else + { + set_option(opt, new_value, error_message); + } + edit_mode = false; + } + else if (use_cm_units) + { + buff_str = convert_float_str(buff_str, 0.01f); + memset(buff, 0, TEXT_BUFF_SIZE); + strcpy(buff, buff_str.c_str()); + } + edit_value = buff; + } + else if (is_all_integers()) + { + auto int_value = static_cast(value); + + if (ImGui::SliderIntWithSteps(id.c_str(), &int_value, + static_cast(range.min), + static_cast(range.max), + static_cast(range.step))) + { + // TODO: Round to step? + slider_clicked = slider_selected( opt, static_cast< float >( int_value ), error_message, model ); + } + else + { + slider_clicked = slider_unselected( opt, static_cast< float >( int_value ), error_message, model ); + } + } + else + { + float tmp_value = value; + float temp_value_displayed = tmp_value; + float min_range_displayed = range.min; + float max_range_displayed = range.max; + + // computing the number of decimal digits taken from the step options' property + // this will then be used to format the displayed value + auto num_of_decimal_digits = [](float f) { + float f_0 = std::fabs(f - (int)f); + std::string s = std::to_string(f_0); + size_t cur_len = s.length(); + //removing trailing zeros + while (cur_len > 3 && s[cur_len - 1] == '0') + cur_len--; + return cur_len - 2; + }; + int num_of_decimal_digits_displayed = (int)num_of_decimal_digits(range.step); + + // displaying in cm instead of meters for D405 + if (use_cm_units) + { + temp_value_displayed *= 100.f; + min_range_displayed *= 100.f; + max_range_displayed *= 100.f; + int updated_num_of_decimal_digits_displayed = num_of_decimal_digits_displayed - 2; + if (updated_num_of_decimal_digits_displayed > 0) + num_of_decimal_digits_displayed = updated_num_of_decimal_digits_displayed; + } + + std::stringstream formatting_ss; + formatting_ss << "%." << num_of_decimal_digits_displayed << "f"; + + + if (ImGui::SliderFloat(id.c_str(), &temp_value_displayed, + min_range_displayed, max_range_displayed, formatting_ss.str().c_str())) + { + tmp_value = use_cm_units ? temp_value_displayed / 100.f : temp_value_displayed; + auto loffset = std::abs(fmod(tmp_value, range.step)); + auto roffset = range.step - loffset; + if (tmp_value >= 0) + tmp_value = (loffset < roffset) ? tmp_value - loffset : tmp_value + roffset; + else + tmp_value = (loffset < roffset) ? tmp_value + loffset : tmp_value - roffset; + tmp_value = (tmp_value < range.min) ? range.min : tmp_value; + tmp_value = (tmp_value > range.max) ? range.max : tmp_value; + + slider_clicked = slider_selected( opt, tmp_value, error_message, model ); + } + else + { + slider_clicked = slider_unselected( opt, tmp_value, error_message, model ); + } + } + } + catch (const error& e) + { + error_message = error_to_string(e); + } + + return slider_clicked; + } + bool option_model::is_checkbox() const { return range.max == 1.0f && @@ -1004,10 +1003,25 @@ namespace rs2 range.step == 1.0f; } - bool option_model::allow_change(float val, std::string& error_message) const + bool option_model::draw_checkbox( notifications_model& model, std::string& error_message, const char *description ) { - // Place here option restrictions - return true; + bool checkbox_was_clicked = false; + + auto bool_value = value > 0.0f; + if( ImGui::Checkbox( label.c_str(), &bool_value ) ) + { + checkbox_was_clicked = true; + model.add_log( to_string() + << "Setting " << opt << " to " << ( bool_value ? "1.0" : "0.0" ) << " (" + << ( bool_value ? "ON" : "OFF" ) << ")" ); + + set_option( opt, bool_value ? 1.f : 0.f, error_message ); + } + if( ImGui::IsItemHovered() && description ) + { + ImGui::SetTooltip( "%s", description ); + } + return checkbox_was_clicked; } bool option_model::slider_selected( rs2_option opt, diff --git a/common/model-views.h b/common/model-views.h index 27125b4db6..8278481d41 100644 --- a/common/model-views.h +++ b/common/model-views.h @@ -341,7 +341,9 @@ namespace rs2 bool is_all_integers() const; bool is_enum() const; bool is_checkbox() const; - bool allow_change(float val, std::string& error_message) const; + bool draw_checkbox( notifications_model& model, std::string& error_message, const char *description ); + bool draw_combobox( notifications_model& model, std::string& error_message, const char* description, bool new_line, bool use_option_name ); + bool draw_slider( notifications_model& model, std::string& error_message, const char* description, bool use_cm_units ); bool slider_selected( rs2_option opt, float value, std::string& error_message, diff --git a/src/ds5/ds5-active.cpp b/src/ds5/ds5-active.cpp index 010339780f..3c574fff6c 100644 --- a/src/ds5/ds5-active.cpp +++ b/src/ds5/ds5-active.cpp @@ -83,13 +83,18 @@ namespace librealsense } // EMITTER FREQUENCY OPTION - // TODO:: add FW minimal version check - auto emitter_frequency = std::make_shared>(raw_depth_ep, - depth_xu, - DS5_EMITTER_FREQUENCY, - "Controls the emitter frequency, 57 [KHZ] / 91 [KHZ]"); - - depth_ep.register_option(RS2_OPTION_EMITTER_FREQUENCY, emitter_frequency); + // TODO:: verify FW minimal version check + if( ( _pid == ds::RS457_PID || _pid == ds::RS455_PID ) + && _fw_version > firmware_version( "5.13.1.50" ) ) + { + auto emitter_freq = std::make_shared< emitter_frequency >( + raw_depth_ep, + std::map< float, std::string >{ + { (float)RS2_EMITTER_FREQUENCY_57_KHZ, "57 KHZ" }, + { (float)RS2_EMITTER_FREQUENCY_91_KHZ, "91 KHZ" } } ); + + depth_ep.register_option( RS2_OPTION_EMITTER_FREQUENCY, emitter_freq ); + } } else diff --git a/src/ds5/ds5-options.cpp b/src/ds5/ds5-options.cpp index 32bcbbee97..a4bf71e0f5 100644 --- a/src/ds5/ds5-options.cpp +++ b/src/ds5/ds5-options.cpp @@ -37,10 +37,15 @@ namespace librealsense "Emitter select, 0-disable all emitters, 1-enable laser, 2-enable laser auto (opt), 3-enable LED (opt)") {} - emitter_frequency::emitter_frequency(uvc_sensor& ep) - : uvc_xu_option(ep, ds::depth_xu, ds::DS5_EMITTER_FREQUENCY, - "Controls the emitter frequency, 57 [KHZ] / 91 [KHZ]") - {} + emitter_frequency::emitter_frequency( + uvc_sensor & ep, const std::map< float, std::string > & description_per_value ) + : uvc_xu_option( ep, + ds::depth_xu, + ds::DS5_EMITTER_FREQUENCY, + "Controls the emitter frequency, 57 [KHZ] / 91 [KHZ]", + description_per_value ) + { + } void emitter_frequency::set( float value ) { diff --git a/src/ds5/ds5-options.h b/src/ds5/ds5-options.h index 29b25c904b..fe60bfbb96 100644 --- a/src/ds5/ds5-options.h +++ b/src/ds5/ds5-options.h @@ -18,10 +18,11 @@ namespace librealsense explicit emitter_option(uvc_sensor& ep); }; - class emitter_frequency : public uvc_xu_option + class emitter_frequency : public uvc_xu_option { public: - explicit emitter_frequency(uvc_sensor& ep); + explicit emitter_frequency( uvc_sensor & ep, + const std::map< float, std::string > & description_per_value ); void set( float value ) override; };