Skip to content

Commit

Permalink
Handle HWM failures
Browse files Browse the repository at this point in the history
Debug on apply_calib
  • Loading branch information
ev-mp authored and Evgeni Raikhel committed Nov 5, 2022
1 parent bc47b48 commit f41fa72
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
11 changes: 11 additions & 0 deletions common/on-chip-calib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,12 @@ namespace rs2

void on_chip_calib_manager::process_flow(std::function<void()> cleanup, invoker invoke)
{
static auto_calib_action prev_action = RS2_CALIB_ACTION_ON_CHIP_OB_CALIB;
if (prev_action != action)
{
prev_action = action;
LOG_WARNING(std::string(to_string() << __LINE__ << " action = " << action ));
}
if (action == RS2_CALIB_ACTION_FL_CALIB || action == RS2_CALIB_ACTION_UVMAPPING_CALIB || action == RS2_CALIB_ACTION_FL_PLUS_CALIB)
stop_viewer(invoke);

Expand Down Expand Up @@ -1533,8 +1539,13 @@ namespace rs2
try_start_viewer(0, 0, 0, invoke); // Start with default settings

// Make new calibration active
LOG_WARNING(std::string(to_string() << __LINE__ << " wait 4"));
std::this_thread::sleep_for(std::chrono::milliseconds(4000)); // Evgeni - debug
apply_calib(true);
LOG_WARNING(std::string(to_string() << __LINE__ << " new calib applied"));
LOG_WARNING(std::string(to_string() << __LINE__ << " wait 5"));
std::this_thread::sleep_for(std::chrono::milliseconds(5000)); // Evgeni - debug
//LOG_WARNING(std::string(to_string() << __LINE__ << " wait done"));

// Capture metrics after
auto metrics_after = get_depth_metrics(invoke);
Expand Down
29 changes: 27 additions & 2 deletions src/ds5/ds5-auto-calibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,25 @@ namespace librealsense
cmd.data.push_back(p[0]);
cmd.data.push_back(p[1]);
}
_hw_monitor->send(cmd);
bool success = false;
int iter =0;
do
{
try
{
if (iter==0) // apply only in the first iteration
std::this_thread::sleep_for(std::chrono::milliseconds(1000)); // Debug sendng request below this threshold
auto res = _hw_monitor->send(cmd); // most likely will fail with MIPI SKU and require retry
LOG_WARNING("occ Save Statistics transfer FR buffer succeeded");
success = true;
}
catch(...)
{
LOG_WARNING("occ Save Statistics result failed");
std::this_thread::sleep_for(std::chrono::milliseconds(100));
};
}
while(( ++iter < 3) && (!success));
}

DirectSearchCalibrationResult result = get_calibration_status(timeout_ms, [progress_callback, host_assistance, speed](int count)
Expand Down Expand Up @@ -1765,7 +1783,14 @@ namespace librealsense
uint8_t* table = (uint8_t*)(calibration.data() + sizeof(table_header));
command write_calib(ds::CALIBRECALC, 0, 0, 0, 0xcafecafe);
write_calib.data.insert(write_calib.data.end(), (uint8_t*)table, ((uint8_t*)table) + hd->table_size);
_hw_monitor->send(write_calib);
try
{
_hw_monitor->send(write_calib);
}
catch(...)
{
LOG_ERROR("Flashing coefficients_table_id failed");
}
}
case rgb_calibration_id: // case fall-through by design. For RGB skip loading to RAM (not supported)
_curr_calibration = calibration;
Expand Down

0 comments on commit f41fa72

Please sign in to comment.