Skip to content

Add set fan mode and rbv#64

Open
SourabhHalli wants to merge 5 commits into
areaDetector:masterfrom
SourabhHalli:4574-add-fan-mode-and-frame-rate
Open

Add set fan mode and rbv#64
SourabhHalli wants to merge 5 commits into
areaDetector:masterfrom
SourabhHalli:4574-add-fan-mode-and-frame-rate

Conversation

@SourabhHalli

Copy link
Copy Markdown

Please note that the Fan mode RBV is not present in the SDK2 manual but just the set value is. So mirroring the readback value

image

@jwlodek jwlodek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a camera to test with, but left some notes. When you have setpoint/readback records, you only actually need one parameter internally, if you tie the two records together with the same string.

Comment thread andorApp/Db/andorCCD.template Outdated
Comment thread andorApp/src/andorCCD.cpp Outdated
Comment thread andorApp/src/andorCCD.cpp Outdated
Comment thread andorApp/src/andorCCD.h
Comment thread docs/ADAndor/andorDoc.rst Outdated
@SourabhHalli

Copy link
Copy Markdown
Author

I was just in a confusion whether to mirror the rbv or not, thanks for the suggestion. I have Andor Ixon Ultra and its works fine for me.

@SourabhHalli SourabhHalli requested a review from jwlodek May 28, 2026 15:44

@henriquesimoes henriquesimoes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Sourabh Halli!

Do you mind squashing your current commits into a single one and adding a commit message documenting the why this change should be included the way to propose?

This way, your proposed changes are easier to review by us and by future contributors who read the repository history retroactively.

I'm leaving a few additional comments below.

Comment thread andorApp/src/andorCCD.cpp
Comment on lines -907 to 941
/*
Each track must be defined by a group of six integers.
- The top and bottom positions of the tracks.
- The left and right positions for the area of interest within each track
- The horizontal and vertical binning for each track. */
/*
Andor use 1-based exclusive co-ordinates.
e.g. from SDK manual:
1 2 1 1024 1 1
3 4 1 1024 1 1
5 6 1 1024 1 1
7 8 1 1024 1 1
9 10 1 1024 1 1 */
TrackDefn[TrackNo * 6 + 0] = mMultiTrack.TrackStart(TrackNo) + 1;
TrackDefn[TrackNo * 6 + 1] = mMultiTrack.TrackEnd(TrackNo) + 2; // CCDMultiTrack uses 0-based inlcusive co-ordinates.
TrackDefn[TrackNo * 6 + 2] = minX + 1;
TrackDefn[TrackNo * 6 + 3] = minX + sizeX;
TrackDefn[TrackNo * 6 + 4] = binX;
TrackDefn[TrackNo * 6 + 5] = mMultiTrack.TrackBin(TrackNo);
/*
Each track must be defined by a group of six integers.
- The top and bottom positions of the tracks.
- The left and right positions for the area of interest within each track
- The horizontal and vertical binning for each track. */
/*
Andor use 1-based exclusive co-ordinates.
e.g. from SDK manual:
1 2 1 1024 1 1
3 4 1 1024 1 1
5 6 1 1024 1 1
7 8 1 1024 1 1
9 10 1 1024 1 1 */
TrackDefn[TrackNo * 6 + 0] = mMultiTrack.TrackStart(TrackNo) + 1;
TrackDefn[TrackNo * 6 + 1] = mMultiTrack.TrackEnd(TrackNo) + 2; // CCDMultiTrack uses 0-based inlcusive co-ordinates.
TrackDefn[TrackNo * 6 + 2] = minX + 1;
TrackDefn[TrackNo * 6 + 3] = minX + sizeX;
TrackDefn[TrackNo * 6 + 4] = binX;
TrackDefn[TrackNo * 6 + 5] = mMultiTrack.TrackBin(TrackNo);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated EOL change. Please, change from CRLF to LF in a standalone commit, so that we know it is just fixing code styling (and can easily double-check it is correctly doing so.)

Comment thread andorApp/src/andorCCD.cpp
Comment on lines -1415 to +1431
if ((mCapabilities.ulSetFunctions & AC_SETFUNCTION_VSAMPLITUDE) != 0)
{
if ((mCapabilities.ulSetFunctions & AC_SETFUNCTION_VSAMPLITUDE) != 0)
{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here. It can be in the same commit fixing the EOL of the entire file.

field(TWVL, "2")
field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))ANDOR_FAN_MODE")
field(SCAN, "I/O Intr")
} No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing final end-of-line at the end of the file so this becomes a valid POSIX file.

Comment thread docs/ADAndor/andorDoc.rst
- Off
- ANDOR_FAN_MODE
- AndorFanMode, AndorFanMode_RBV
- AndorFanMode

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still have the AndorFanMode_RBV PV. We have only removed the ANDOR_FAN_MODE_RBV drvInfo.

Comment thread docs/ADAndor/andorDoc.rst Outdated
Comment thread andorApp/src/andorCCD.cpp
Comment on lines 776 to 781
} catch (const std::string &e) {
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
"%s:%s: %s\n",
driverName, functionName, e.c_str());
status = asynError;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we rollback the value of AndorFanMode in case of errors?

That's what this following code asks us to do:

// Set in param lib so the user sees a readback straight away. Save a backup in case of errors.
getIntegerParam(function, &oldValue);
status = setIntegerParam(function, value);

Although this could be implemented in a generic way at the end of writeInt32, the value will flicker, and users will get an incorrect event that the value has changed to the desired value (when it never actually happened in the hardware). Thus, this seems to be the correct place to rollback.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Henrique, though I agree that the value should be rolled back, users should not be able to observe a flicker in the value, since it will only be propagated to the PV once callParamCallbacks is called.

So any logic implementing rollback before that call would be enough.

@henriquesimoes henriquesimoes Jun 12, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I think I wasn't clear enough.

What I'm taking about a potential flickering is if we attempted to implement this once for all parameters at the end of writeInt32. I say it will have this flickering side-effect because we do have a callParamCallbacks() before we reach such place where the rollback would happen:

/* Do callbacks so higher layers see any changes */
callParamCallbacks();
/* Send a signal to the poller task which will make it do a poll, and switch to the fast poll rate */
epicsEventSignal(statusEvent);
if (mAcquiringData) {
asynPrint(this->pasynUserSelf, ASYN_TRACE_FLOW,
"%s:%s:, Sending dataEvent to dataTask ...\n",
driverName, functionName);
// Also signal the data readout thread
epicsEventSignal(dataEvent);
}
if (status) {
asynPrint(pasynUser, ASYN_TRACE_ERROR,
"%s:%s: error, status=%d function=%d, value=%d\n",
driverName, functionName, status, function, value);
} else {
asynPrint(pasynUser, ASYN_TRACEIO_DRIVER,
"%s:%s: function=%d, value=%d\n",
driverName, functionName, function, value);
// For a successful write, clear the error message.
setStringParam(AndorMessage, " ");
}
return status;

Of course, we could add another if (status) code block to implement such rollback before a callParamCallbacks, but that seems to lead to code to the spaghetti zone. Thus, all I'm arguing here is that rolling back inside function == AndorFanMode seems the best option for now, since (as you noted) it won't produce the flickering effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants