Skip to content

Commit fa3c375

Browse files
committed
Merge branch 'test-reg' of https://github.com/stereolabs/zed-open-capture into test-reg
2 parents 6fac7d0 + 6f12933 commit fa3c375

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

examples/zed_oc_control_example.cpp

+13-3
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ int main(int argc, char *argv[])
111111

112112
// ----> Set Video parameters
113113
sl_oc::video::VideoParams params;
114-
params.res = sl_oc::video::RESOLUTION::HD1080;
115-
params.fps = sl_oc::video::FPS::FPS_30;
114+
params.res = sl_oc::video::RESOLUTION::HD2K;
115+
params.fps = sl_oc::video::FPS::FPS_15;
116116
params.verbose = verbose;
117117
// <---- Set Video parameters
118118

@@ -222,10 +222,19 @@ void handleKeyboard( sl_oc::video::VideoCapture &cap, int key )
222222
{
223223
case 'L':
224224
{
225-
logging = cap.enableAecAgcSensLogging( !logging );
225+
logging = cap.enableAecAgcSensLogging( !logging, 5 );
226226
std::cout << std::string("*** AEC/AGC registers loggin: ") << (logging?std::string("ENABLED"):std::string("DISABLED")) << std::endl;
227227
}
228228
break;
229+
230+
case 'f':
231+
case 'F':
232+
{
233+
bool res = cap.resetAGCAECregisters();
234+
std::cout << std::string("*** AEC/AGC registers reset: ") << (res?std::string("OK"):std::string("KO")) << std::endl;
235+
}
236+
break;
237+
229238
case 'l':
230239
{
231240
bool led;
@@ -312,6 +321,7 @@ void handleKeyboard( sl_oc::video::VideoCapture &cap, int key )
312321
std::cout << " * '-' -> Decrease the current control value" << std::endl;
313322
std::cout << " * '0' .. '9' -> Set the current control value" << std::endl;
314323
std::cout << " * 'L' -> Toggle AGC/AEC registers logging" << std::endl;
324+
std::cout << " * 'f' -> Fix AGC/AEC registers" << std::endl;
315325
}
316326
}
317327

include/videocapture.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ class SL_OC_EXPORT VideoCapture
379379
inline void setReadyToSync(){ mSensReadyToSync=true; }
380380
#endif
381381

382+
bool resetAGCAECregisters();
383+
382384
private:
383385
void grabThreadFunc(); //!< The frame grabbing thread function
384386

@@ -453,6 +455,8 @@ class SL_OC_EXPORT VideoCapture
453455
void saveLogDataLeft();
454456
void saveLogDataRight();
455457

458+
459+
456460
private:
457461
// Flags
458462
bool mNewFrame=false; //!< Indicates if a new frame is available

src/videocapture.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -2091,6 +2091,17 @@ void VideoCapture::saveLogDataRight()
20912091
}
20922092
}
20932093

2094+
bool VideoCapture::resetAGCAECregisters() {
2095+
int res = 0;
2096+
2097+
res += ll_write_sensor_register( 0, 1, 0x3503, 0x04);
2098+
res += ll_write_sensor_register( 1, 1, 0x3503, 0x04);
2099+
res += ll_write_sensor_register( 0, 1, 0x3505, 0x00);
2100+
res += ll_write_sensor_register( 1, 1, 0x3505, 0x00);
2101+
2102+
return res==0;
2103+
}
2104+
20942105
#ifdef SENSORS_MOD_AVAILABLE
20952106
bool VideoCapture::enableSensorSync( sensors::SensorCapture* sensCap )
20962107
{

0 commit comments

Comments
 (0)