- rolling shutter: fix bug / include all modes

- temp save
parent 6b2f28f5
2017/04/10 18:03:21 ==========================================
scp: copied local directory to segfs and /tmp_14_days:
from: [../../install/] and [./bat/]
to: [blissadm@lid00a:/segfs/bliss/projects/LIMA/build/depot_win/win_vc9/pco/install-2017-04-10_180258]
to: [/t/rhoms1/install-2017-04-10_180258]
to: [/t/rhoms1/install-beta]
- rolling shutter: fix bug / include all modes
2017/04/10 11:16:34 ==========================================
scp: copied local directory to segfs and /tmp_14_days:
from: [../../install/] and [./bat/]
to: [blissadm@lid00a:/segfs/bliss/projects/LIMA/build/depot_win/win_vc9/pco/install-2017-04-10_111611]
to: [/t/rhoms1/install-2017-04-10_111611]
to: [/t/rhoms1/install-beta]
2017/04/10 10:13:55 ==========================================
#define PCO_SDK_VERSION "$Id: PCOSDK [1.20] $"
#define PCO_GIT_VERSION "$Id: PCO rev[2017-04-10 10:13:15 +0200] head[6b2f28f][6b2f28f52677da012dfc5397df6f8666e17f31bf] ref[ (HEAD, master)] at [2017/04/10 10:13:54] $"
#define LIMA_GIT_VERSION "$Id: LIMA rev[2017-03-07 10:56:35 +0100] head[56f36b3][56f36b3b31cbf5ca89f3812406092a7a6885d259] ref[ (HEAD, tag: core-1.7.3, github/core-1.7, core-1.7)] at [2017/04/10 10:13:54] $"
#define PROCLIB_GIT_VERSION "$Id: PROCLIB rev[2017-03-07 10:24:42 +0100] head[c80632d][c80632d5298bd81c4feb7cca52f7619884d9371e] ref[ (HEAD, github/master, github/HEAD, master)] at [2017/04/10 10:13:54] $"
#define LIBCONFIG_GIT_VERSION "$Id: LIBCONFIG rev[2013-02-07 18:08:29 +0100] head[89c411a][89c411a541d4ab4d66257ccb85749853fd685cbb] ref[ (HEAD, github/master, github/HEAD, master)] at [2017/04/10 10:13:54] $"
#define TANGO_GIT_VERSION "$Id: TANGO rev[2017-02-06 09:35:41 +0100] head[4527bfc][4527bfc00e9d88c9e0e8b9528dec7f6b444cf93d] ref[ (HEAD, github/master, github/HEAD, master)] at [2017/04/10 10:13:54] $"
#define SPEC_GIT_VERSION "$Id: SPEC rev[2017-02-06 15:52:58 +0100] head[bc5f7e2][bc5f7e2eec76bc6134d8cee9b1ba03480cd3c91e] ref[ (HEAD, github/master, github/HEAD, master)] at [2017/04/10 10:13:54] $"
2017/04/03 12:36:30 ==========================================
scp: copied local directory to segfs and /tmp_14_days:
from: [../../install/] and [./bat/]
......
......@@ -325,7 +325,7 @@ struct stcPcoData {
int iAllocatedBufferNumber;
int iAllocatedBufferNumberLima;
bool bAllocatedBufferDone;
bool bRollingShutter;
DWORD dwRollingShutter;
char *version;
......@@ -542,14 +542,15 @@ namespace lima
void _presetPixelRate(DWORD &pixRate, int &error);
bool _get_shutter_rolling_edge(int &error);
void _set_shutter_rolling_edge(bool roling, int &error);
void _get_shutter_rolling_edge(DWORD &dwRolling, int &error);
void _set_shutter_rolling_edge(DWORD dwRolling, int &error);
void _init();
void _init_edge();
void _init_dimax();
bool _isValid_pixelRate(DWORD dwPixelRate);
bool _isValid_rollingShutter(DWORD dwRollingShutter);
int _checkValidRoi(const Roi &new_roi, Roi &fixed_roi);
int _fixValidRoi(unsigned int &x0, unsigned int &x1, unsigned int xMax, unsigned int xSteps, unsigned int xMinSize, bool bSymX);
......
......@@ -1631,7 +1631,7 @@ void _pco_shutter_thread_edge(void *argin) {
sprintf_s(_msg, LEN_MSG, "%s> [EXIT]", fnId);
m_cam->_traceMsg(_msg);
m_sync->setStarted(false); // to test
//m_sync->setStarted(false); // to test
_endthread();
}
......@@ -2123,22 +2123,39 @@ int Camera::dumpRecordedImages(int &nrImages, int &error){
//=================================================================================================
//=================================================================================================
bool Camera::_isValid_rollingShutter(DWORD dwRolling)
{
switch(dwRolling)
{
case PCO_EDGE_SETUP_ROLLING_SHUTTER: return _isCapsDesc(capsRollingShutter); // 1
case PCO_EDGE_SETUP_GLOBAL_SHUTTER: return _isCapsDesc(capsGlobalShutter) ; // 2
case PCO_EDGE_SETUP_GLOBAL_RESET: return _isCapsDesc(capsGlobalResetShutter) ; //4
default: return FALSE;
}
}
void Camera::_set_shutter_rolling_edge(bool rolling, int &error){
DEB_MEMBER_FUNCT();
//=================================================================================================
//=================================================================================================
void Camera::_set_shutter_rolling_edge(DWORD dwRolling, int &error)
{
DEB_MEMBER_FUNCT();
error = 0;
if(!_isCameraType(Edge)) {
if(!_isValid_rollingShutter(dwRolling))
{
DEB_ALWAYS() << "ERROR requested Rolling Shutter not allowed " << DEB_VAR1(dwRolling);
error = -1;
return ;
return;
}
m_pcoData->bRollingShutter = rolling;
m_pcoData->dwRollingShutter = dwRolling;
DEB_ALWAYS() << "requested Rolling Shutter OK " << DEB_VAR1(dwRolling);
_beginthread( _pco_shutter_thread_edge, 0, (void*) this);
......@@ -2155,7 +2172,7 @@ void Camera::_pco_set_shutter_rolling_edge(int &error){
char *msg;
char msgBuff[MSG_SIZE+1];
DWORD _dwSetup;
DWORD dwRollingShRequested, dwRollingShNow;
DWORD m_dwSetup[10];
WORD m_wLen = 10;
WORD m_wType = 0;
......@@ -2189,9 +2206,10 @@ void Camera::_pco_set_shutter_rolling_edge(int &error){
// #define PCO_EDGE_SETUP_GLOBAL_SHUTTER 0x00000002 // global shutter
_dwSetup = m_pcoData->bRollingShutter ? PCO_EDGE_SETUP_ROLLING_SHUTTER : PCO_EDGE_SETUP_GLOBAL_SHUTTER;
dwRollingShRequested = m_pcoData->dwRollingShutter ;
PCO_FN4(error, msg,PCO_GetCameraSetup, m_handle, &m_wType, &m_dwSetup[0], &m_wLen);
m_wType = 0;
PCO_FN4(error, msg,PCO_GetCameraSetup, m_handle, &m_wType, &m_dwSetup[0], &m_wLen);
PCO_PRINT_ERR(error, msg);
if(error)
{
......@@ -2200,18 +2218,23 @@ void Camera::_pco_set_shutter_rolling_edge(int &error){
return;
}
if(m_dwSetup[0] == _dwSetup) {
DEB_ALWAYS() << fnId << " [exit - no change] ";
dwRollingShNow = m_dwSetup[0];
if(m_dwSetup[0] == dwRollingShRequested) {
DEB_ALWAYS() << "exit NO Change in ROLLING SHUTTER " << DEB_VAR2(dwRollingShNow, dwRollingShRequested);
m_config = FALSE;
return;
}
msg = msgBuff;
sprintf_s(msg, MSG_SIZE, "[Change ROLLING SHUTTER from [%d] to [%d]]",
m_dwSetup[0]==PCO_EDGE_SETUP_ROLLING_SHUTTER, _dwSetup==PCO_EDGE_SETUP_ROLLING_SHUTTER);
DEB_ALWAYS() << fnId << " " << msg;
m_dwSetup[0]==PCO_EDGE_SETUP_ROLLING_SHUTTER, dwRollingShRequested==PCO_EDGE_SETUP_ROLLING_SHUTTER);
m_dwSetup[0] = _dwSetup;
DEB_ALWAYS() << "Change in ROLLING SHUTTER " << DEB_VAR2(dwRollingShNow, dwRollingShRequested);
m_dwSetup[0] = dwRollingShRequested;
PCO_FN3(error, msg,PCO_SetTimeouts, m_handle, &ts[0], sizeof(ts));
PCO_PRINT_ERR(error, msg); if(error) return;
......@@ -2257,8 +2280,7 @@ void Camera::_pco_set_shutter_rolling_edge(int &error){
//=================================================================================================
//=================================================================================================
bool Camera::_get_shutter_rolling_edge(int &error){
void Camera::_get_shutter_rolling_edge(DWORD &dwRolling, int &error){
DEB_MEMBER_FUNCT();
DEF_FNID;
......@@ -2267,11 +2289,13 @@ bool Camera::_get_shutter_rolling_edge(int &error){
WORD m_wType;
char *msg;
m_wType = 0;
PCO_FN4(error, msg,PCO_GetCameraSetup, m_handle, &m_wType, &m_dwSetup[0], &m_wLen);
PCO_PRINT_ERR(error, msg); if(error) return FALSE;
PCO_PRINT_ERR(error, msg);
dwRolling = error ? 0 : m_dwSetup[0];
return (m_dwSetup[0] == PCO_EDGE_SETUP_ROLLING_SHUTTER);
return;
}
//=================================================================================================
......@@ -2992,3 +3016,4 @@ bool Camera::_isCapsDesc(int caps)
}
}
......@@ -712,30 +712,30 @@ char *Camera::_talk(char *_cmd, char *output, int lg){
keys_desc[ikey++] = "(RW) for EDGE only / rolling shutter mode";
if(_stricmp(cmd, key) == 0){
int error;
bool rolling, rollingNew;
DWORD dwRolling, dwRollingNew;
if(!_isCameraType(Edge)) {
ptr += sprintf_s(ptr, ptrMax - ptr, "%d", -1);
return output;
}
rolling = _get_shutter_rolling_edge(error);
_get_shutter_rolling_edge(dwRolling, error);
if(tokNr == 0) {
ptr += sprintf_s(ptr, ptrMax - ptr, "%d", rolling);
ptr += sprintf_s(ptr, ptrMax - ptr, "%d", dwRolling);
return output;
}
if((tokNr != 1) || ((strcmp(tok[1],"0") != 0) && (strcmp(tok[1],"1") != 0))){
ptr += sprintf_s(ptr, ptrMax - ptr, "syntax ERROR - %s <0 | 1>", cmd);
dwRollingNew = atoi(tok[1]);
if( (tokNr != 1) || !((dwRollingNew == 1) || (dwRollingNew == 2) || (dwRollingNew == 4)) ){
ptr += sprintf_s(ptr, ptrMax - ptr, "syntax ERROR - %s <1 (rolling), 2 (global), 4 (global reset)>", cmd);
return output;
}
rollingNew = atoi(tok[1]) != 0;
if(rollingNew != rolling){
_set_shutter_rolling_edge(rollingNew, error);
if(dwRollingNew != dwRolling){
_set_shutter_rolling_edge(dwRollingNew, error);
}
ptr += sprintf_s(ptr, ptrMax - ptr, "%d", rollingNew);
ptr += sprintf_s(ptr, ptrMax - ptr, "%d", dwRollingNew);
return output;
}
......@@ -2677,34 +2677,40 @@ int _get_time_from_imageTimestamp(void *buf,int shift,SYSTEMTIME *st)
void Camera::getRollingShutter(int &val)
{
int error;
bool rolling;
DWORD dwRolling;
if(!_isCameraType(Edge))
{
val = -1;
return;
}
rolling = _get_shutter_rolling_edge(error);
val = rolling;
_get_shutter_rolling_edge(dwRolling, error);
val = dwRolling;
}
void Camera::setRollingShutter(int val)
{
DEB_MEMBER_FUNCT();
int error;
bool rolling, rollingNew;
DWORD dwRolling, dwRollingNew;
dwRollingNew = (DWORD) val;
if(!_isCameraType(Edge)) {
if(!_isValid_rollingShutter(dwRollingNew))
{
DEB_ALWAYS() << "ERROR requested Rolling Shutter not allowed " << DEB_VAR1(dwRollingNew);
error = -1;
return;
}
rolling = _get_shutter_rolling_edge(error);
_get_shutter_rolling_edge(dwRolling, error);
rollingNew = !!val;
if(rollingNew != rolling){
_set_shutter_rolling_edge(rollingNew, error);
if(dwRollingNew != dwRolling){
_set_shutter_rolling_edge(dwRollingNew, error);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment