From 0f52af42b28051dae0308daff872085b30521bd4 Mon Sep 17 00:00:00 2001 From: kpetersn Date: Tue, 27 Mar 2018 15:15:05 -0500 Subject: [PATCH] Also read the encoder position, which isn't helpful with diagnostic feedback. --- motorApp/AMCISrc/ANF2Driver.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/motorApp/AMCISrc/ANF2Driver.cpp b/motorApp/AMCISrc/ANF2Driver.cpp index a6a30652..e0c25c64 100644 --- a/motorApp/AMCISrc/ANF2Driver.cpp +++ b/motorApp/AMCISrc/ANF2Driver.cpp @@ -823,6 +823,7 @@ asynStatus ANF2Axis::poll(bool *moving) int limit; int enabled; double position; + double encPosition; asynStatus status; epicsInt32 read_val; // don't use a pointer here. The _address_ of read_val should be passed to the read function. @@ -853,6 +854,11 @@ asynStatus ANF2Axis::poll(bool *moving) //printf("ANF2Axis::poll: Motor #%i position: %f\n", axisNo_, position); // TODO: read encoder position + status = pC_->readReg32(axisNo_, EN_POS_UPR, &read_val, DEFAULT_CONTROLLER_TIMEOUT); + //printf("ANF2Axis::poll: Motor encoder position raw: %d\n", read_val); + encPosition = (double) read_val; + setDoubleParam(pC_->motorEncoderPosition_, encPosition); + //printf("ANF2Axis::poll: Motor #%i encoder position: %f\n", axisNo_, encPosition); // Read the moving status of this motor //