From 15a0f0b3eb6471e310178577a85d12f719355dc4 Mon Sep 17 00:00:00 2001 From: Ron Sluiter Date: Thu, 6 Mar 2003 18:54:56 +0000 Subject: [PATCH] - Combined calls to mx_motor_get_status() and mx_motor_get_position() with one call to mx_motor_get_extended_status(). - Set limit switch state ane error status. --- motorApp/MXmotorSrc/drvMXmotor.cc | 35 ++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/motorApp/MXmotorSrc/drvMXmotor.cc b/motorApp/MXmotorSrc/drvMXmotor.cc index 41b6e011..1dd18b7d 100644 --- a/motorApp/MXmotorSrc/drvMXmotor.cc +++ b/motorApp/MXmotorSrc/drvMXmotor.cc @@ -2,9 +2,9 @@ FILENAME... drvMXmotor.cc USAGE... Motor record driver level support for MX device driver. -Version: $Revision: 1.2 $ +Version: $Revision: 1.3 $ Modified By: $Author: sluiter $ -Last Modified: $Date: 2003-03-04 15:27:29 $ +Last Modified: $Date: 2003-03-06 18:54:56 $ */ /* @@ -251,7 +251,8 @@ static int set_status(int card, int signal) motor_info = &(brdptr->motor_info[signal]); cntrl = (struct MXcontroller *) brdptr->DevicePrivate; - mx_status = mx_motor_get_status(cntrl->MXmotor_record, &status); + mx_status = mx_motor_get_extended_status(cntrl->MXmotor_record, &motorData, + &status); if (mx_status.code != MXE_SUCCESS) return(rtn_state = ERROR); @@ -260,10 +261,6 @@ static int set_status(int card, int signal) else motor_info->status |= RA_DONE; - mx_status = mx_motor_get_position(cntrl->MXmotor_record, &motorData); - if (mx_status.code != MXE_SUCCESS) - return(rtn_state = ERROR); - if (motorData == motor_info->position) motor_info->no_motion_count++; else @@ -281,6 +278,30 @@ static int set_status(int card, int signal) plusdir = (motor_info->status & RA_DIRECTION) ? true : false; + /* Set limit switch error indicators. */ + if (status & MXSF_MTR_POSITIVE_LIMIT_HIT) + { + motor_info->status |= RA_PLUS_LS; + if (plusdir == true) + ls_active = true; + } + else + motor_info->status &= ~RA_PLUS_LS; + + if (status & MXSF_MTR_NEGATIVE_LIMIT_HIT) + { + motor_info->status |= RA_MINUS_LS; + if (plusdir == false) + ls_active = true; + } + else + motor_info->status &= ~RA_MINUS_LS; + + if (status & MXSF_MTR_ERROR) + motor_info->status |= RA_PROBLEM; + else + motor_info->status &= ~RA_PROBLEM; + rtn_state = (!motor_info->no_motion_count || ls_active == true || (motor_info->status & (RA_DONE | RA_PROBLEM))) ? 1 : 0;