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

Fix DSO-18454 laser turned off after calibration #10948

Merged
merged 3 commits into from
Oct 27, 2022
Merged
Changes from 1 commit
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
45 changes: 33 additions & 12 deletions common/on-chip-calib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,17 +400,6 @@ namespace rs2
bool frame_arrived = false;
try
{
if (_sub->s->supports(RS2_OPTION_EMITTER_ENABLED))
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
{
laser_status_prev = _sub->s->get_option(RS2_OPTION_EMITTER_ENABLED);
_sub->s->set_option(RS2_OPTION_EMITTER_ENABLED, 0.0f);
}
if (_sub->s->supports(RS2_OPTION_THERMAL_COMPENSATION))
{
thermal_loop_prev = _sub->s->get_option(RS2_OPTION_THERMAL_COMPENSATION);
_sub->s->set_option(RS2_OPTION_THERMAL_COMPENSATION, 0.f);
}

bool run_fl_calib = ( (action == RS2_CALIB_ACTION_FL_CALIB) && (w == 1280) && (h == 720));
if (action == RS2_CALIB_ACTION_TARE_GROUND_TRUTH)
{
Expand Down Expand Up @@ -1139,6 +1128,18 @@ namespace rs2
{
try
{
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
//Save options that are going to change during the calibration
if (_sub->s->supports( RS2_OPTION_EMITTER_ENABLED ))
{
laser_status_prev = _sub->s->get_option( RS2_OPTION_EMITTER_ENABLED );
_sub->s->set_option( RS2_OPTION_EMITTER_ENABLED, 0.0f );
}
if (_sub->s->supports( RS2_OPTION_THERMAL_COMPENSATION ))
{
thermal_loop_prev = _sub->s->get_option( RS2_OPTION_THERMAL_COMPENSATION );
_sub->s->set_option( RS2_OPTION_THERMAL_COMPENSATION, 0.f );
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

By moving the code here those set/get options will be executed every iteration cycle (this is part of the main loop)- this may affect performance.
Imho, the best option is to create kind of LUT that for each state will define the state of laser/AE/Thermal loop controls, and that we'll use some 'enter_state(calib_1) /exist_state(calib_1)'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is called only once
Later on calibrate calls run_on_chip_calibration and inside that function implementation there is a loop

if (action == RS2_CALIB_ACTION_FL_CALIB)
calibrate_fl();
else if (action == RS2_CALIB_ACTION_UVMAPPING_CALIB)
Expand All @@ -1160,8 +1161,21 @@ namespace rs2
_sub_color->ui = *_ui_color;
_ui_color.reset();
}

//Restore options that were changed during the calibration.
//When calibration is successful options are restored in autocalib_notification_model::draw_content()
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
if (_sub->s->supports( RS2_OPTION_EMITTER_ENABLED ))
{
_sub->s->set_option( RS2_OPTION_EMITTER_ENABLED, laser_status_prev );
}
if (_sub->s->supports( RS2_OPTION_THERMAL_COMPENSATION ))
{
_sub->s->set_option( RS2_OPTION_THERMAL_COMPENSATION, thermal_loop_prev );
}

if (_was_streaming)
start_viewer(0, 0, 0, invoke);

throw;
}
}
Expand Down Expand Up @@ -1985,12 +1999,19 @@ namespace rs2
}
else if (update_state == RS2_CALIB_STATE_CALIB_COMPLETE)
{
if (get_manager().action == on_chip_calib_manager::RS2_CALIB_ACTION_ON_CHIP_CALIB)
{
if (get_manager()._sub->s->supports( RS2_OPTION_EMITTER_ENABLED ))
get_manager()._sub->s->set_option( RS2_OPTION_EMITTER_ENABLED, get_manager().laser_status_prev );
if (get_manager()._sub->s->supports( RS2_OPTION_THERMAL_COMPENSATION ))
get_manager()._sub->s->set_option( RS2_OPTION_THERMAL_COMPENSATION, get_manager().thermal_loop_prev );
}
if (get_manager().action == on_chip_calib_manager::RS2_CALIB_ACTION_UVMAPPING_CALIB)
{
if (get_manager()._sub->s->supports(RS2_OPTION_EMITTER_ENABLED))
get_manager()._sub->s->set_option(RS2_OPTION_EMITTER_ENABLED, get_manager().laser_status_prev);
if (get_manager()._sub->s->supports(RS2_OPTION_THERMAL_COMPENSATION))
get_manager()._sub->s->set_option(RS2_OPTION_THERMAL_COMPENSATION, get_manager().laser_status_prev);
get_manager()._sub->s->set_option(RS2_OPTION_THERMAL_COMPENSATION, get_manager().thermal_loop_prev);
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved

ImGui::SetCursorScreenPos({ float(x + 20), float(y + 33) });
ImGui::Text("%s", "Health-Check Number for PX: ");
Expand Down