Skip to content

Commit

Permalink
hold th epower on for 2 sec
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az committed May 20, 2024
1 parent c71b3d3 commit b25b7af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ds/d400/d400-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ namespace librealsense
auto depth_ep = std::make_shared<d400_depth_sensor>(this, raw_depth_ep);

// Many commands need power during initialization phase, no point turning it on and off again for each.
raw_depth_ep->power_for_duration( std::chrono::milliseconds( 1000 ) );
raw_depth_ep->power_for_duration( std::chrono::milliseconds( 10000 ) );

depth_ep->register_info(RS2_CAMERA_INFO_PHYSICAL_PORT, filter_by_mi(all_device_infos, 0).front().device_path);

Expand Down
6 changes: 5 additions & 1 deletion src/uvc-sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ class uvc_sensor : public raw_sensor_base

void power_for_duration( std::chrono::steady_clock::duration timeout = std::chrono::milliseconds( 500 ) )
{
acquire_power();
std::weak_ptr< uvc_sensor > weak = std::dynamic_pointer_cast< uvc_sensor >( shared_from_this() );
if( auto strong = weak.lock() )
{
strong->acquire_power();
}

std::thread release_power_thread( [weak, timeout]()
{
std::this_thread::sleep_for( timeout );
Expand Down

0 comments on commit b25b7af

Please sign in to comment.