Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion src/ds5/ds5-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,12 @@ namespace librealsense
depth_sensor.register_option(RS2_OPTION_EMITTER_ALWAYS_ON, std::make_shared<emitter_always_on_option>(*_hw_monitor, &depth_sensor));
}

if (_fw_version >= firmware_version("5.9.15.1"))
if (_fw_version >= firmware_version("5.12.4.0") && (_device_capabilities & d400_caps::CAP_GLOBAL_SHUTTER) == d400_caps::CAP_GLOBAL_SHUTTER)
{
depth_sensor.register_option(RS2_OPTION_INTER_CAM_SYNC_MODE,
std::make_shared<external_sync_mode2>(*_hw_monitor, &raw_depth_sensor));
}
else if (_fw_version >= firmware_version("5.9.15.1"))
{
depth_sensor.register_option(RS2_OPTION_INTER_CAM_SYNC_MODE,
std::make_shared<external_sync_mode>(*_hw_monitor));
Expand Down
53 changes: 51 additions & 2 deletions src/ds5/ds5-options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,9 @@ namespace librealsense
_range = [this]()
{
return option_range{ ds::inter_cam_sync_mode::INTERCAM_SYNC_DEFAULT,
ds::inter_cam_sync_mode::INTERCAM_SYNC_MAX - 1,
ds::inter_cam_sync_mode::INTERCAM_SYNC_DEFAULT, 1 };
2,
1,
ds::inter_cam_sync_mode::INTERCAM_SYNC_DEFAULT};
};
}

Expand Down Expand Up @@ -406,6 +407,54 @@ namespace librealsense
return *_range;
}

external_sync_mode2::external_sync_mode2(hw_monitor& hwm, sensor_base* ep)
: _hwm(hwm), _sensor(ep)
{
_range = [this]()
{
return option_range{ ds::inter_cam_sync_mode::INTERCAM_SYNC_DEFAULT,
ds::inter_cam_sync_mode::INTERCAM_SYNC_MAX,
1,
ds::inter_cam_sync_mode::INTERCAM_SYNC_DEFAULT };
};
}

void external_sync_mode2::set(float value)
{
if (_sensor->is_streaming())
throw std::runtime_error("Cannot change Inter-camera HW synchronization mode while streaming!");

command cmd(ds::SET_CAM_SYNC);
if (value < 4)
cmd.param1 = static_cast<int>(value);
else
{
cmd.param1 = 4;
cmd.param1 |= (static_cast<int>(value - 3)) << 8;
}

_hwm.send(cmd);
_record_action(*this);
}

float external_sync_mode2::query() const
{
command cmd(ds::GET_CAM_SYNC);
auto res = _hwm.send(cmd);
if (res.empty())
throw invalid_value_exception("external_sync_mode::query result is empty!");

if (res.front() < 4)
return (res.front());
else
return (static_cast<float>(res[1]) + 3.0f);
}

option_range external_sync_mode2::get_range() const
{
return *_range;
}

emitter_on_and_off_option::emitter_on_and_off_option(hw_monitor& hwm, sensor_base* ep)
: _hwm(hwm), _sensor(ep)
{
Expand Down
25 changes: 25 additions & 0 deletions src/ds5/ds5-options.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,31 @@ namespace librealsense
hw_monitor& _hwm;
};

class external_sync_mode2 : public option
{
public:
external_sync_mode2(hw_monitor& hwm, sensor_base* depth_ep);
virtual ~external_sync_mode2() = default;
virtual void set(float value) override;
virtual float query() const override;
virtual option_range get_range() const override;
virtual bool is_enabled() const override { return _sensor && !_sensor ->is_streaming(); }

const char* get_description() const override
{
return "Inter-camera synchronization mode: 0:Default, 1:Master, 2:Slave, 3:Full Salve, 4-258:Genlock with burst count of 1-255 frames for each trigger";
}
void enable_recording(std::function<void(const option &)> record_action) override
{
_record_action = record_action;
}
private:
std::function<void(const option &)> _record_action = [](const option&) {};
lazy<option_range> _range;
hw_monitor& _hwm;
sensor_base* _sensor;
};

class emitter_on_and_off_option : public option
{
public:
Expand Down
9 changes: 5 additions & 4 deletions src/ds5/ds5-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,11 @@ namespace librealsense

enum inter_cam_sync_mode
{
INTERCAM_SYNC_DEFAULT,
INTERCAM_SYNC_MASTER,
INTERCAM_SYNC_SLAVE,
INTERCAM_SYNC_MAX
INTERCAM_SYNC_DEFAULT = 0,
INTERCAM_SYNC_MASTER = 1,
INTERCAM_SYNC_SLAVE = 2,
INTERCAM_SYNC_FULL_SLAVE = 3,
INTERCAM_SYNC_MAX = 258 // 4-258 are for Genlock with burst count of 1-255 frames for each trigger
};

enum class d400_caps : uint16_t
Expand Down