Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restricting the D405 w/a for calibration resolution to D405 PID only #10913

Merged
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
30 changes: 17 additions & 13 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2014,24 +2014,28 @@ namespace rs2
{
// checking format
bool is_cal_format = false;
for (auto it = stream_enabled.begin(); it != stream_enabled.end(); ++it)
// checking that the SKU is D405 - otherwise, this method should return false
if (dev.supports(RS2_CAMERA_INFO_PRODUCT_ID) && !strcmp(dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID), "0B5B"))
Copy link
Collaborator

@Nir-Az Nir-Az Sep 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please add a comment about what 0B5B means, magic numbers should not be used without explaining.
    I would maybe add a static const string D405_PID = "0B5B" for all D405 usage in this file

  2. Please explain (add a comment) why all except D405 should always return false here (I hate strcmp return value :) )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

{
if (it->second)
for (auto it = stream_enabled.begin(); it != stream_enabled.end(); ++it)
{
int selected_format_index = -1;
if (ui.selected_format_id.count(it->first) > 0)
selected_format_index = ui.selected_format_id.at(it->first);

if (format_values.count(it->first) > 0 && selected_format_index > -1)
if (it->second)
{
auto formats = format_values.at(it->first);
if (formats.size() > selected_format_index)
int selected_format_index = -1;
if (ui.selected_format_id.count(it->first) > 0)
selected_format_index = ui.selected_format_id.at(it->first);

if (format_values.count(it->first) > 0 && selected_format_index > -1)
{
auto format = formats[selected_format_index];
if (format == RS2_FORMAT_Y16)
auto formats = format_values.at(it->first);
if (formats.size() > selected_format_index)
{
is_cal_format = true;
break;
auto format = formats[selected_format_index];
if (format == RS2_FORMAT_Y16)
{
is_cal_format = true;
break;
}
}
}
}
Expand Down