From 3a65e1060dd219b1981c0dcab3ecea5e1d057f38 Mon Sep 17 00:00:00 2001 From: mp49 Date: Fri, 29 Jul 2011 10:30:32 +0000 Subject: [PATCH] motor: XPS model 3 driver. set the motorStatusHome and motorStatusHomed MSTA bits correctly. Also added in support in the driver to keep track of referencing mode. --- motorApp/NewportSrc/XPSAxis.cpp | 27 ++++++++++++++++++++++++++- motorApp/NewportSrc/XPSAxis.h | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/motorApp/NewportSrc/XPSAxis.cpp b/motorApp/NewportSrc/XPSAxis.cpp index 83f07372..72387549 100644 --- a/motorApp/NewportSrc/XPSAxis.cpp +++ b/motorApp/NewportSrc/XPSAxis.cpp @@ -194,6 +194,9 @@ XPSAxis::XPSAxis(XPSController *pC, int axisNo, const char *positionerName, doub /* And we need to implement this in Asyn layer. */ getPID(); + /* Used to keep track of referencing mode in the driver.*/ + referencingMode_ = 0; + /* Wake up the poller task which will make it do a poll, * updating values for this axis to use the new resolution (stepSize_) */ pC_->wakeupPoller(); @@ -562,7 +565,29 @@ asynStatus XPSAxis::poll(bool *moving) setDoubleParam(pC_->motorLowLimit_, (lowLimit_/stepSize_)); } - setIntegerParam(pC_->motorStatusHome_, (axisStatus_ == 11) ? 1 : 0); + /*Set the ATHM signal.*/ + if (axisStatus_ == 11) { + if (referencingMode_ == 0) { + setIntegerParam(pC_->motorStatusHome_, 1); + } else { + setIntegerParam(pC_->motorStatusHome_, 0); + } + } else { + setIntegerParam(pC_->motorStatusHome_, 0); + } + + /*Set the HOMED signal.*/ + if ((axisStatus_ >= 10 && axisStatus_ <= 21) || + (axisStatus_ == 44) || (axisStatus_ == 45) || (axisStatus_ == 47)) { + if (referencingMode_ == 0) { + setIntegerParam(pC_->motorStatusHomed_, 1); + } else { + setIntegerParam(pC_->motorStatusHomed_, 0); + } + } else { + setIntegerParam(pC_->motorStatusHomed_, 0); + } + if ((axisStatus_ >= 0 && axisStatus_ <= 9) || (axisStatus_ >= 20 && axisStatus_ <= 42)) { /* Not initialized, homed or disabled */ diff --git a/motorApp/NewportSrc/XPSAxis.h b/motorApp/NewportSrc/XPSAxis.h index 94fcbaad..e46f956f 100644 --- a/motorApp/NewportSrc/XPSAxis.h +++ b/motorApp/NewportSrc/XPSAxis.h @@ -82,6 +82,7 @@ class XPSAxis : public asynMotorAxis double deferredPosition_; int deferredMove_; int deferredRelative_; + int referencingMode_; friend class XPSController; };