Implemented velocity mode, but didn't test it yet
This commit is contained in:
@@ -1179,40 +1179,25 @@ asynStatus masterMacsAxis::enable(bool on) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
asynStatus masterMacsAxis::setMode(int mode) {
|
asynStatus masterMacsAxis::setMode(int mode) {
|
||||||
// masterMacs can be disabled
|
|
||||||
if (pasynUser->reason == motorSetMode()) {
|
|
||||||
|
|
||||||
// First call to the sinqController function. It checks whether it is
|
char command[pC_->MAXBUF_] = {0};
|
||||||
// possible to set the mode and whether the given value is valid.
|
|
||||||
asynStatus status = sinqController::writeInt32(pasynUser, value);
|
|
||||||
if (status == asynSuccess) {
|
|
||||||
|
|
||||||
// Now write to the hardware
|
// Map the EPICS value to MasterMACS values (see
|
||||||
char command[MAXBUF_];
|
// MasterMACS_manual.pdf).
|
||||||
int axisNo;
|
int adjustedMode = 0;
|
||||||
getAddress(pasynUser, &axisNo);
|
if (mode == 0) {
|
||||||
|
adjustedMode = 1;
|
||||||
// Map the EPICS value to MasterMACS values (see
|
} else if (mode == 1) {
|
||||||
// MasterMACS_manual.pdf).
|
adjustedMode = 3;
|
||||||
int adjustedValue = 0;
|
|
||||||
if (value == 0) {
|
|
||||||
adjustedValue = 1;
|
|
||||||
} else if (value == 1) {
|
|
||||||
adjustedValue = 3;
|
|
||||||
} else {
|
|
||||||
// This branch is unreachable, as it is is already checked
|
|
||||||
// within sinqController::writeInt32 that value is either 0
|
|
||||||
// or 1.
|
|
||||||
return asynError;
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(command, sizeof(value), "%d", adjustedValue);
|
|
||||||
return write(axisNo, 07, command);
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
} else {
|
} else {
|
||||||
return sinqController::writeInt32(pasynUser, value);
|
// This branch is unreachable, as it is is already checked
|
||||||
|
// within sinqController::writeInt32 that value is either 0
|
||||||
|
// or 1.
|
||||||
|
return asynError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snprintf(command, sizeof(command), "%d", adjustedMode);
|
||||||
|
return pC_->write(axisNo(), 07, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool masterMacsAxis::needInit() { return pMasterMacsA_->needInit; }
|
bool masterMacsAxis::needInit() { return pMasterMacsA_->needInit; }
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ class HIDDEN masterMacsAxis : public sinqAxis {
|
|||||||
* @param mode
|
* @param mode
|
||||||
* @return asynStatus
|
* @return asynStatus
|
||||||
*/
|
*/
|
||||||
asynStatus masterMacsAxis::setMode(int mode);
|
asynStatus setMode(int mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read the encoder type (incremental or absolute) for this axis
|
* @brief Read the encoder type (incremental or absolute) for this axis
|
||||||
|
|||||||
Reference in New Issue
Block a user