Skip to content

Commit

Permalink
fixing error with corrupt first jpeg in stream
Browse files Browse the repository at this point in the history
  • Loading branch information
jwlodek committed Dec 7, 2018
1 parent 8397416 commit 2670172
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions adUVCApp/src/ADUVC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ static void exitCallbackC(void* pPvt){
void ADUVC::reportUVCError(uvc_error_t status, const char* functionName){
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, "%s::%s UVC Error: %s\n",
driverName, functionName, uvc_strerror(status));
if(status != UVC_ERROR_NOT_FOUND){
char statusMessage[25];
if(status != UVC_ERROR_OTHER){
char statusMessage[25];
epicsSnprintf(statusMessage, sizeof(statusMessage), "UVC Error: %s\n", uvc_strerror(status));
setStringParam(ADStatusMessage, statusMessage);
callParamCallbacks();
Expand Down Expand Up @@ -351,6 +351,7 @@ void ADUVC::acquireStop(){
//update PV values
setIntegerParam(ADStatus, ADStatusIdle);
setIntegerParam(ADAcquire, 0);
this->firstFrame = 0;
callParamCallbacks();
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, "%s::%s Stopping aquisition\n",driverName, functionName);
}
Expand All @@ -374,7 +375,8 @@ void ADUVC::acquireStop(){
*/
void ADUVC::newFrameCallbackWrapper(uvc_frame_t* frame, void* ptr){
ADUVC* pPvt = ((ADUVC*) ptr);
pPvt->newFrameCallback(frame, pPvt);
if(pPvt->firstFrame == 0) pPvt->firstFrame = 1;
else pPvt->newFrameCallback(frame, pPvt);
}


Expand Down Expand Up @@ -525,6 +527,7 @@ void ADUVC::newFrameCallback(uvc_frame_t* frame, void* ptr){
setIntegerParam(ADNumImagesCounter, numImages);
uvc2NDArray(frame, pArray, ndDataType, colorMode, arrayInfo.totalBytes);
acquireStop();

}
// block shot mode stops once numImages reaches the number of desired images
else if(operatingMode == ADImageMultiple){
Expand Down
1 change: 1 addition & 0 deletions adUVCApp/src/ADUVC.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class ADUVC : ADDriver{
//flag that sees if shutter is on or off
int withShutter = 0;

int firstFrame = 0;

// ----------------------------------------
// UVC Functions - Logging/Reporting
Expand Down
2 changes: 1 addition & 1 deletion iocs/adUVCIOC/iocBoot/iocADUVC/st.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ epicsEnvSet("XSIZE", "640")
# The maximim image height; used for column profiles in the NDPluginStats plugin
epicsEnvSet("YSIZE", "480")
# The framerate at which the stream will operate
epicsEnvSet("FRAMERATE", "10");
epicsEnvSet("FRAMERATE", "30");
# The maximum number of time seried points in the NDPluginStats plugin
epicsEnvSet("NCHANS", "2048")
# The maximum number of frames buffered in the NDPluginCircularBuff plugin
Expand Down

0 comments on commit 2670172

Please sign in to comment.