@@ -747,10 +747,11 @@ void ADKinetix::acquireStop() {
747
747
if (this ->acquisitionActive ) {
748
748
// Abort current acquisition
749
749
pl_exp_abort (this ->cameraContext ->hcam , CCS_HALT);
750
+
751
+ // Mark acquisition as inactive
750
752
this ->acquisitionActive = false ;
751
753
752
- // Set acquire PV to 0, wait for acq thread to join
753
- setIntegerParam (ADAcquire, 0 );
754
+ // Wait for acquisition thread to join
754
755
INFO (" Waiting for acquisition thread to join..." );
755
756
epicsThreadMustJoin (this ->acquisitionThreadId );
756
757
INFO (" Acquisition stopped." );
@@ -772,10 +773,10 @@ NDDataType_t ADKinetix::getCurrentNDBitDepth() {
772
773
getIntegerParam (KTX_ReadoutPortIdx, &readoutPortIdx);
773
774
getIntegerParam (KTX_SpeedIdx, &speedIdx);
774
775
getIntegerParam (KTX_GainIdx, &gainIdx);
776
+ SpdtabGain currentGainMode = this ->cameraContext ->speedTable [readoutPortIdx].speeds [speedIdx].gains [gainIdx];
775
777
776
778
NDDataType_t dataType = NDUInt8;
777
- if (this ->cameraContext ->speedTable [readoutPortIdx].speeds [speedIdx].gains [gainIdx].bitDepth !=
778
- 8 ) {
779
+ if (currentGainMode.bitDepth != 8 ) {
779
780
dataType = NDUInt16;
780
781
}
781
782
return dataType;
@@ -1081,20 +1082,23 @@ asynStatus ADKinetix::setMinExpRes(KTX_MIN_EXP_RES currentExpRes, KTX_MIN_EXP_RE
1081
1082
asynStatus ADKinetix::writeInt32 (asynUser *pasynUser, epicsInt32 value) {
1082
1083
const char *functionName = " writeInt32" ;
1083
1084
int function = pasynUser->reason ;
1084
- int currentExpRes;
1085
+ int currentExpRes, acquiring ;
1085
1086
asynStatus status = asynSuccess;
1086
1087
1087
1088
// Need to know current exp res when switching in case we cannot update
1088
1089
getIntegerParam (KTX_MinExpRes, ¤tExpRes);
1089
1090
1091
+ // Certain actions depend on whether or not we are currently acquiring
1092
+ getIntegerParam (ADAcquire, &acquiring);
1093
+
1090
1094
/* Set the parameter and readback in the parameter library. This may be overwritten when we
1091
1095
* read back the status at the end, but that's OK */
1092
1096
status = setIntegerParam (function, value);
1093
1097
1094
1098
if (function == ADAcquire) {
1095
- if (this -> acquisitionActive && value == 0 ) {
1099
+ if (acquiring == 1 && value == 0 ) {
1096
1100
this ->acquireStop ();
1097
- } else if (! this -> acquisitionActive && value == 1 ) {
1101
+ } else if (acquiring == 0 && value == 1 ) {
1098
1102
this ->acquireStart ();
1099
1103
} else if (value == 0 ) {
1100
1104
ERR (" Acquisition not active!" );
0 commit comments