The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/dai: Control floodlight brightness with an env var

Co-authored-by: Jakob Bornecrantz <jakob@collabora.com>

authored by

Moses Turner
Jakob Bornecrantz
and committed by
Jakob Bornecrantz
1ef49b92 4643d4f0

+23 -9
+23 -9
src/xrt/drivers/depthai/depthai_driver.cpp
··· 50 50 #define DEPTHAI_ERROR(d, ...) U_LOG_IFL_E(d->log_level, __VA_ARGS__) 51 51 52 52 DEBUG_GET_ONCE_LOG_OPTION(depthai_log, "DEPTHAI_LOG", U_LOGGING_INFO) 53 - DEBUG_GET_ONCE_BOOL_OPTION(depthai_want_floodlight, "DEPTHAI_WANT_FLOODLIGHT", true) 53 + DEBUG_GET_ONCE_NUM_OPTION(depthai_floodlight_brightness, "DEPTHAI_FLOODLIGHT_BRIGHTNESS", 1000) 54 54 DEBUG_GET_ONCE_NUM_OPTION(depthai_startup_wait_frames, "DEPTHAI_STARTUP_WAIT_FRAMES", 0) 55 55 56 56 ··· 151 151 bool interleaved; 152 152 bool oak_d_lite; 153 153 154 - bool has_floodlight; 155 - bool want_floodlight; 154 + struct 155 + { 156 + float mA; 157 + bool has; 158 + } floodlights; 159 + 156 160 157 161 bool want_cameras; 158 162 bool want_imu; ··· 272 276 depthai_guess_ir_drivers(struct depthai_fs *depthai) 273 277 { 274 278 std::vector<std::tuple<std::string, int, int>> list_of_drivers = depthai->device->getIrDrivers(); 275 - depthai->has_floodlight = false; 279 + depthai->floodlights.has = false; 276 280 277 281 for (std::tuple<std::string, int, int> elem : list_of_drivers) { 278 282 if (std::get<0>(elem) == "LM3644") { 279 283 DEPTHAI_DEBUG(depthai, "DepthAI: Found an IR floodlight"); 280 - depthai->has_floodlight = true; 284 + depthai->floodlights.has = true; 281 285 } 282 286 } 283 - if (!depthai->has_floodlight) { 287 + 288 + if (!depthai->floodlights.has) { 284 289 DEPTHAI_DEBUG(depthai, "DepthAI: Didn't find any IR illuminators"); 285 290 } 286 291 } ··· 749 754 750 755 depthai->control_queue = depthai->device->getInputQueue("control").get(); 751 756 752 - if (depthai->has_floodlight && depthai->want_floodlight) { 753 - depthai->device->setIrFloodLightBrightness(1500); 757 + if (depthai->floodlights.has) { 758 + float mA = depthai->floodlights.mA; 759 + 760 + if (mA > 1500.0f) { 761 + DEPTHAI_ERROR(depthai, "Can not set brightness to more then 1500mA, clamping!"); 762 + mA = 1500.0f; 763 + } 764 + 765 + if (mA > 0.0f) { 766 + depthai->device->setIrFloodLightBrightness(mA); 767 + } 754 768 } 755 769 756 770 //!@todo This code will turn the exposure time down, but you may not want it. Or we may want to rework Monado's ··· 980 994 depthai->node.break_apart = depthai_fs_node_break_apart; 981 995 depthai->node.destroy = depthai_fs_node_destroy; 982 996 depthai->log_level = debug_get_log_option_depthai_log(); 983 - depthai->want_floodlight = debug_get_bool_option_depthai_want_floodlight(); 997 + depthai->floodlights.mA = debug_get_num_option_depthai_floodlight_brightness(); 984 998 depthai->device = d; 985 999 986 1000 u_var_add_root(depthai, "DepthAI Source", 0);