Skip to content

Commit

Permalink
register new option
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az committed Oct 2, 2022
1 parent 014ca23 commit 0d6d649
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 5 deletions.
11 changes: 10 additions & 1 deletion src/ds5/ds5-active.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace librealsense
{
using namespace ds;

//Projector's capacity is established based on actual HW capabilities
// Projector's capacity is established based on actual HW capabilities
auto pid = group.uvc_devices.front().pid;
if ((pid != RS_USB2_PID) && ((_device_capabilities & d400_caps::CAP_ACTIVE_PROJECTOR) == d400_caps::CAP_ACTIVE_PROJECTOR))
{
Expand Down Expand Up @@ -82,6 +82,15 @@ namespace librealsense
RS2_OPTION_PROJECTOR_TEMPERATURE));
}

// EMITTER FREQUENCY OPTION
// TODO:: add FW minimal version check
auto emitter_frequency = std::make_shared<uvc_xu_option<uint16_t>>(raw_depth_ep,
depth_xu,
DS5_EMITTER_FREQUENCY,
"Controls the emitter frequency, 57 [KHZ] / 91 [KHZ]");

depth_ep.register_option(RS2_OPTION_EMITTER_FREQUENCY, emitter_frequency);

}
else
{
Expand Down
1 change: 1 addition & 0 deletions src/ds5/ds5-active.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace librealsense
{
// Active means the HW includes an active projector
class ds5_active : public virtual ds5_device
{
public:
Expand Down
2 changes: 1 addition & 1 deletion src/ds5/ds5-factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace librealsense
};
};

// DS5U_S
// Not used, should be removed with EOL devices clean up
class rs405u_device : public ds5u_device,
public ds5_advanced_mode_base,
public firmware_logger_device
Expand Down
14 changes: 14 additions & 0 deletions src/ds5/ds5-options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ namespace librealsense
"Emitter select, 0-disable all emitters, 1-enable laser, 2-enable laser auto (opt), 3-enable LED (opt)")
{}

emitter_frequency::emitter_frequency(uvc_sensor& ep)
: uvc_xu_option(ep, ds::depth_xu, ds::DS5_EMITTER_FREQUENCY,
"Controls the emitter frequency, 57 [KHZ] / 91 [KHZ]")
{}

void emitter_frequency::set( float value )
{
if( _ep.is_streaming() )
throw wrong_api_call_sequence_exception( "Setting the emitter frequency during streaming is not allowed" );

uvc_xu_option::set( value );
}


float asic_and_projector_temperature_options::query() const
{
if (!is_enabled())
Expand Down
7 changes: 7 additions & 0 deletions src/ds5/ds5-options.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ namespace librealsense
explicit emitter_option(uvc_sensor& ep);
};

class emitter_frequency : public uvc_xu_option<uint8_t>
{
public:
explicit emitter_frequency(uvc_sensor& ep);
void set( float value ) override;
};

class asic_and_projector_temperature_options : public readonly_option
{
public:
Expand Down
5 changes: 3 additions & 2 deletions src/ds5/ds5-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace librealsense
const uint16_t RS415_PID = 0x0ad3; // ASRC
const uint16_t RS430_PID = 0x0ad4; // AWG
const uint16_t RS430_MM_PID = 0x0ad5; // AWGT
const uint16_t RS_USB2_PID = 0x0ad6; // USB2
const uint16_t RS_USB2_PID = 0x0ad6; // USB2 - fallback for SKU unable to boot properly
const uint16_t RS_RECOVERY_PID = 0x0adb;
const uint16_t RS_USB2_RECOVERY_PID = 0x0adc;
const uint16_t RS400_IMU_PID = 0x0af2; // IMU
Expand All @@ -39,7 +39,7 @@ namespace librealsense
const uint16_t RS430_MM_RGB_PID = 0x0b01; // AWGCT
const uint16_t RS460_PID = 0x0b03; // DS5U
const uint16_t RS435_RGB_PID = 0x0b07; // AWGC
const uint16_t RS405U_PID = 0x0b0c; // DS5U
const uint16_t RS405U_PID = 0x0b0c; // DS5U - Not used, should be removed with EOL devices clean up
const uint16_t RS435I_PID = 0x0b3a; // D435i
const uint16_t RS416_PID = 0x0b49; // F416
const uint16_t RS430I_PID = 0x0b4b; // D430i
Expand All @@ -61,6 +61,7 @@ namespace librealsense
const uint8_t DS5_ENABLE_AUTO_EXPOSURE = 0xB;
const uint8_t DS5_LED_PWR = 0xE;
const uint8_t DS5_THERMAL_COMPENSATION = 0xF;
const uint8_t DS5_EMITTER_FREQUENCY = 0x10; // TBD until we get the ID from FW

// Devices supported by the current version
static const std::set<std::uint16_t> rs400_sku_pid = {
Expand Down
2 changes: 1 addition & 1 deletion src/hw-monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ namespace librealsense
{
if (ptr) _heap.deallocate(ptr);
});
if (!token.get()) throw;
if( !token.get() ) throw io_exception( "heap allocation failed" );

std::lock_guard<std::recursive_mutex> lock(_local_mtx);
return _uvc_sensor_base.invoke_powered([&]
Expand Down

0 comments on commit 0d6d649

Please sign in to comment.