Read out reference status at init
Test And Build / Lint (push) Failing after 4s
Test And Build / Build (push) Failing after 7s

When the driver is initialized, it reads from the hardware whether the motor needs to be referenced or not
This commit is contained in:
mathis_s committed 2026-11-25 08:54:13 +01:00
1 parent a4c62d429e
commit 9fbb2e64b9
1 file changed
+13 -6
+13 -6
View File
@@ -134,6 +134,9 @@ asynStatus turboPmacAxis::init() {
double motorVmax = 0.0;
double motorAccel = 0.0;
// If 0, the motor needs a reference drive. Otherwise, it doesnßt
int needs_reference = 0;
// Conversion factor between engineering units (EU) and encoder counts
double counts_to_eu = 0.0;
@@ -176,9 +179,11 @@ asynStatus turboPmacAxis::init() {
Ixx65.
*/
snprintf(command, sizeof(command),
"Q%2.2d10 Q%2.2d03 Q%2.2d04 Q%2.2d06 P%2.2d22 Q%2.2d00 I%2.2d28",
axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_);
status = pC_->writeRead(axisNo_, command, response, 7);
"Q%2.2d10 Q%2.2d03 Q%2.2d04 Q%2.2d06 P%2.2d22 Q%2.2d00 I%2.2d28 "
"M%2.2d45",
axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_, axisNo_,
axisNo_);
status = pC_->writeRead(axisNo_, command, response, 8);
msgPrintControlOptions options = {.maxRepetitions = 1, .minRepetitions = 0};
msgPrintControlKey keyDisconnected = msgPrintControlKey(
@@ -206,9 +211,9 @@ asynStatus turboPmacAxis::init() {
pC_->getMsgPrintControl().resetCount(keyDisconnected, pC_->pasynUser());
}
nvals = sscanf(response, "%lf %lf %lf %lf %d %lf %lf", &motorPos,
nvals = sscanf(response, "%lf %lf %lf %lf %d %lf %lf %d", &motorPos,
&motorVmax, &motorVelocity, &motorAccel, &acoDelay,
&counts_to_eu, &deadband_counts);
&counts_to_eu, &deadband_counts, &needs_reference);
// The acoDelay is given in milliseconds -> Convert to seconds, rounded
// up
@@ -219,7 +224,7 @@ asynStatus turboPmacAxis::init() {
// here to mm/s^2.
motorAccel = motorAccel * 1000;
if (nvals != 7) {
if (nvals != 8) {
return pC_->couldNotParseResponse(command, response, axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
@@ -263,6 +268,8 @@ asynStatus turboPmacAxis::init() {
setAxisParamChecked(this, motorPositionDeadband,
counts_to_eu * deadband_counts / 16.0);
setAxisParamChecked(this, motorStatusHomed, needs_reference != 0);
// Update the parameter library immediately
status = callParamCallbacks();
if (status != asynSuccess) {