forked from epics_driver_modules/motorBase
- Bug fix on "Acknowledged fault before enabling drive".
- Change back to reading EOT LS's and let record determine limit error condition.
This commit is contained in:
@@ -32,7 +32,8 @@ in file LICENSE that is included with this distribution.
|
||||
* .02 03-02-10 rls Original check into version control.
|
||||
* .03 03-16-10 rls Switch to C++ file.
|
||||
* .04 04-07-10 rls Acknowledged fault before enabling drive.
|
||||
*
|
||||
* .05 04-19-10 rls Change back to reading EOT LS's and let record determine
|
||||
* limit error condition.
|
||||
*/
|
||||
|
||||
|
||||
@@ -44,9 +45,6 @@ in file LICENSE that is included with this distribution.
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "drvEnsembleAsyn.h"
|
||||
#include "paramLib.h"
|
||||
|
||||
#include "epicsFindSymbol.h"
|
||||
#include "epicsTime.h"
|
||||
#include "epicsThread.h"
|
||||
@@ -63,6 +61,9 @@ in file LICENSE that is included with this distribution.
|
||||
#define DEFINE_MOTOR_PROTOTYPES 1
|
||||
#include "motor_interface.h"
|
||||
|
||||
#include "paramLib.h"
|
||||
#include "drvEnsembleAsyn.h"
|
||||
|
||||
motorAxisDrvSET_t motorEnsemble =
|
||||
{
|
||||
14,
|
||||
@@ -373,7 +374,7 @@ static int motorAxisSetDouble(AXIS_HDL pAxis, motorAxisParam_t function, double
|
||||
static int motorAxisSetInteger(AXIS_HDL pAxis, motorAxisParam_t function, int value)
|
||||
{
|
||||
int ret_status = MOTOR_AXIS_ERROR;
|
||||
int status;
|
||||
int status, FaultStatus;
|
||||
char inputBuff[BUFFER_SIZE], outputBuff[BUFFER_SIZE];
|
||||
|
||||
if (pAxis == NULL)
|
||||
@@ -390,9 +391,10 @@ static int motorAxisSetInteger(AXIS_HDL pAxis, motorAxisParam_t function, int va
|
||||
{
|
||||
sprintf(outputBuff, "AXISFAULT @%d", pAxis->axis);
|
||||
ret_status = sendAndReceive(pAxis->pController, outputBuff, inputBuff, sizeof(inputBuff));
|
||||
if (ret_status != 0)
|
||||
|
||||
if (ret_status == 0 && inputBuff[0] == ASCII_ACK_CHAR && (FaultStatus = atoi(&inputBuff[1])))
|
||||
{
|
||||
PRINT(pAxis->logParam, TERROR, "motorAxisSetInteger: FAULTACK = %X\n", ret_status);
|
||||
PRINT(pAxis->logParam, TERROR, "motorAxisSetInteger: FAULTACK = %X\n", FaultStatus);
|
||||
sprintf(outputBuff, "FAULTACK @%d", pAxis->axis);
|
||||
ret_status = sendAndReceive(pAxis->pController, outputBuff, inputBuff, sizeof(inputBuff));
|
||||
}
|
||||
@@ -611,7 +613,8 @@ static void EnsemblePoller(EnsembleController *pController)
|
||||
/* This is the task that polls the Ensemble */
|
||||
double timeout;
|
||||
AXIS_HDL pAxis;
|
||||
int status, itera, comStatus, axisStatus;
|
||||
int status, itera, comStatus;
|
||||
Axis_Status axisStatus;
|
||||
bool anyMoving;
|
||||
char inputBuff[BUFFER_SIZE], outputBuff[BUFFER_SIZE];
|
||||
|
||||
@@ -645,7 +648,7 @@ static void EnsemblePoller(EnsembleController *pController)
|
||||
else
|
||||
{
|
||||
PARAMS params = pAxis->params;
|
||||
axisStatus = 0;
|
||||
axisStatus.All = 0;
|
||||
if (inputBuff[0] != ASCII_ACK_CHAR)
|
||||
{
|
||||
epicsMutexUnlock(pAxis->mutexId);
|
||||
@@ -654,18 +657,28 @@ static void EnsemblePoller(EnsembleController *pController)
|
||||
else
|
||||
{
|
||||
motorParam->setInteger(params, motorAxisCommError, 0);
|
||||
axisStatus = atoi(&inputBuff[1]);
|
||||
motorParam->setInteger(params, motorAxisDone, axisStatus & IN_MOTION_BIT ? 0 : 1);
|
||||
if (axisStatus & IN_MOTION_BIT)
|
||||
axisStatus.All = atoi(&inputBuff[1]);
|
||||
motorParam->setInteger(params, motorAxisDone, !axisStatus.Bits.move_active);
|
||||
if (axisStatus.Bits.move_active)
|
||||
anyMoving = true;
|
||||
motorParam->setInteger(pAxis->params, motorAxisPowerOn, axisStatus & ENABLED_BIT ? 1 : 0);
|
||||
motorParam->setInteger(pAxis->params, motorAxisHomeSignal, axisStatus & HOME_MARKER_BIT ? 1 : 0);
|
||||
motorParam->setInteger(pAxis->params, motorAxisPowerOn, axisStatus.Bits.axis_enabled);
|
||||
motorParam->setInteger(pAxis->params, motorAxisHomeSignal, axisStatus.Bits.home_limit);
|
||||
if (pAxis->stepSize > 0.0)
|
||||
motorParam->setInteger(pAxis->params, motorAxisDirection, axisStatus & DIRECTION_BIT ? 1 : 0);
|
||||
motorParam->setInteger(pAxis->params, motorAxisDirection, axisStatus.Bits.motion_ccw);
|
||||
else
|
||||
motorParam->setInteger(pAxis->params, motorAxisDirection, axisStatus & DIRECTION_BIT ? 0 : 1);
|
||||
motorParam->setInteger(pAxis->params, motorAxisDirection, !axisStatus.Bits.motion_ccw);
|
||||
if (pAxis->stepSize > 0.0)
|
||||
{
|
||||
motorParam->setInteger(pAxis->params, motorAxisHighHardLimit, axisStatus.Bits.CW_limit);
|
||||
motorParam->setInteger(pAxis->params, motorAxisLowHardLimit, axisStatus.Bits.CCW_limit);
|
||||
}
|
||||
else
|
||||
{
|
||||
motorParam->setInteger(pAxis->params, motorAxisHighHardLimit, axisStatus.Bits.CCW_limit);
|
||||
motorParam->setInteger(pAxis->params, motorAxisLowHardLimit, axisStatus.Bits.CW_limit);
|
||||
}
|
||||
}
|
||||
pAxis->axisStatus = axisStatus;
|
||||
pAxis->axisStatus = axisStatus.All;
|
||||
}
|
||||
sprintf(outputBuff, "PFBKPROG(@%d)", pAxis->axis);
|
||||
comStatus = sendAndReceive(pController, outputBuff, inputBuff, sizeof(inputBuff));
|
||||
@@ -707,20 +720,6 @@ static void EnsemblePoller(EnsembleController *pController)
|
||||
epicsMutexUnlock(pAxis->mutexId);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
axisStatus = atoi(&inputBuff[1]);
|
||||
if (pAxis->stepSize > 0.0)
|
||||
{
|
||||
motorParam->setInteger(pAxis->params, motorAxisHighHardLimit, axisStatus & CW_FAULT_BIT ? 1 : 0);
|
||||
motorParam->setInteger(pAxis->params, motorAxisLowHardLimit, axisStatus & CCW_FAULT_BIT ? 1 : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
motorParam->setInteger(pAxis->params, motorAxisHighHardLimit, axisStatus & CCW_FAULT_BIT ? 1 : 0);
|
||||
motorParam->setInteger(pAxis->params, motorAxisLowHardLimit, axisStatus & CW_FAULT_BIT ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
motorParam->callCallback(pAxis->params);
|
||||
epicsMutexUnlock(pAxis->mutexId);
|
||||
|
||||
@@ -1,6 +1,130 @@
|
||||
/*
|
||||
FILENAME... drvEnsembleAsyn.h
|
||||
USAGE... This file contains Aerotech Ensemble Asyn driver "include" information.
|
||||
|
||||
Version: $Revision$
|
||||
Modified By: $Author$
|
||||
Last Modified: $Date$
|
||||
HeadURL: $URL$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Original Author: Chad Weimer
|
||||
* Date: 10/16/97
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .00 04-01-08 caw initialized from drvMM4000.h (Newport)
|
||||
*/
|
||||
|
||||
#ifndef DRV_MOTOR_ENSEMBLE_ASYN_H
|
||||
#define DRV_MOTOR_ENSEMBLE_ASYN_H
|
||||
|
||||
#include "motor.h"
|
||||
|
||||
/* Axis Status Register Bitmap */
|
||||
typedef union
|
||||
{
|
||||
epicsUInt32 All;
|
||||
struct
|
||||
{
|
||||
#ifdef MSB_First
|
||||
unsigned int ESTOP :1;
|
||||
unsigned int cos_encoder_err :1;
|
||||
unsigned int sin_encoder_err :1;
|
||||
unsigned int hall_C :1;
|
||||
|
||||
unsigned int hall_B :1;
|
||||
unsigned int hall_A :1;
|
||||
unsigned int marker :1;
|
||||
unsigned int home_limit :1;
|
||||
|
||||
unsigned int CCW_limit :1;
|
||||
unsigned int CW_limit :1;
|
||||
unsigned int na18_21 :4; /* N/A bits 18-21 */
|
||||
unsigned int gantry_master_active :1;
|
||||
unsigned int gantry_mode_active :1;
|
||||
|
||||
unsigned int master_suppressed :1;
|
||||
unsigned int homing_active :1;
|
||||
unsigned int joystick_active :1;
|
||||
unsigned int axis_calib_enabled :1;
|
||||
|
||||
unsigned int axis_calib_active :1;
|
||||
unsigned int na10 :1; /* N/A bit 10 */
|
||||
unsigned int motion_ccw :1;
|
||||
unsigned int brake_on :1;
|
||||
|
||||
unsigned int current_clamp :1;
|
||||
unsigned int pos_capture_active :1;
|
||||
unsigned int dec_active :1;
|
||||
unsigned int acc_active :1;
|
||||
|
||||
unsigned int move_active :1;
|
||||
unsigned int in_position :1;
|
||||
unsigned int home_cycle_complete :1;
|
||||
unsigned int axis_enabled :1;
|
||||
#else
|
||||
unsigned int axis_enabled :1;
|
||||
unsigned int home_cycle_complete :1;
|
||||
unsigned int in_position :1;
|
||||
unsigned int move_active :1;
|
||||
|
||||
unsigned int acc_active :1;
|
||||
unsigned int dec_active :1;
|
||||
unsigned int pos_capture_active :1;
|
||||
unsigned int current_clamp :1;
|
||||
|
||||
unsigned int brake_on :1;
|
||||
unsigned int motion_ccw :1;
|
||||
unsigned int na10 :1; /* N/A bit 10 */
|
||||
unsigned int axis_calib_active :1;
|
||||
|
||||
unsigned int axis_calib_enabled :1;
|
||||
unsigned int joystick_active :1;
|
||||
unsigned int homing_active :1;
|
||||
unsigned int master_suppressed :1;
|
||||
|
||||
unsigned int gantry_mode_active :1;
|
||||
unsigned int gantry_master_active :1;
|
||||
unsigned int na18_21 :4; /* N/A bits 18-21 */
|
||||
unsigned int CW_limit :1;
|
||||
unsigned int CCW_limit :1;
|
||||
|
||||
unsigned int home_limit :1;
|
||||
unsigned int marker :1;
|
||||
unsigned int hall_A :1;
|
||||
unsigned int hall_B :1;
|
||||
|
||||
unsigned int hall_C :1;
|
||||
unsigned int sin_encoder_err :1;
|
||||
unsigned int cos_encoder_err :1;
|
||||
unsigned int ESTOP :1;
|
||||
#endif
|
||||
} Bits;
|
||||
} Axis_Status;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user