Skip to content

Commit

Permalink
Merge pull request #3113 from lramati/ds-fix
Browse files Browse the repository at this point in the history
Fix bug with depth scale before starting device
  • Loading branch information
dorodnic committed Jan 30, 2019
2 parents a0e0cdf + 375922d commit 1f4e465
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ds5/ds5-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace librealsense
explicit ds5_depth_sensor(ds5_device* owner,
std::shared_ptr<platform::uvc_device> uvc_device,
std::unique_ptr<frame_timestamp_reader> timestamp_reader)
: uvc_sensor(ds::DEPTH_STEREO, uvc_device, move(timestamp_reader), owner), _owner(owner), _depth_units(0)
: uvc_sensor(ds::DEPTH_STEREO, uvc_device, move(timestamp_reader), owner), _owner(owner), _depth_units(-1)
{}

rs2_intrinsics get_intrinsics(const stream_profile& profile) const override
Expand Down Expand Up @@ -166,7 +166,7 @@ namespace librealsense
return results;
}

float get_depth_scale() const override { return _depth_units; }
float get_depth_scale() const override { if (_depth_units < 0) _depth_units = get_option(RS2_OPTION_DEPTH_UNITS).query(); return _depth_units; }

void set_depth_scale(float val){ _depth_units = val; }

Expand All @@ -193,7 +193,7 @@ namespace librealsense
}
protected:
const ds5_device* _owner;
std::atomic<float> _depth_units;
mutable std::atomic<float> _depth_units;
float _stereo_baseline_mm;
};

Expand Down

0 comments on commit 1f4e465

Please sign in to comment.