Implemented velocity mode, but didn't test it yet
Some checks failed
Test And Build / Lint (push) Failing after 4s
Test And Build / Build (push) Successful in 7s

This commit is contained in:
2026-01-20 16:52:52 +01:00
parent 18e68b193a
commit 9a52a4b9ce
2 changed files with 16 additions and 31 deletions

View File

@@ -1179,26 +1179,16 @@ 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
char command[MAXBUF_];
int axisNo;
getAddress(pasynUser, &axisNo);
// Map the EPICS value to MasterMACS values (see // Map the EPICS value to MasterMACS values (see
// MasterMACS_manual.pdf). // MasterMACS_manual.pdf).
int adjustedValue = 0; int adjustedMode = 0;
if (value == 0) { if (mode == 0) {
adjustedValue = 1; adjustedMode = 1;
} else if (value == 1) { } else if (mode == 1) {
adjustedValue = 3; adjustedMode = 3;
} else { } else {
// This branch is unreachable, as it is is already checked // This branch is unreachable, as it is is already checked
// within sinqController::writeInt32 that value is either 0 // within sinqController::writeInt32 that value is either 0
@@ -1206,13 +1196,8 @@ asynStatus masterMacsAxis::setMode(int mode) {
return asynError; return asynError;
} }
snprintf(command, sizeof(value), "%d", adjustedValue); snprintf(command, sizeof(command), "%d", adjustedMode);
return write(axisNo, 07, command); return pC_->write(axisNo(), 07, command);
}
return status;
} else {
return sinqController::writeInt32(pasynUser, value);
}
} }
bool masterMacsAxis::needInit() { return pMasterMacsA_->needInit; } bool masterMacsAxis::needInit() { return pMasterMacsA_->needInit; }

View File

@@ -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