add maximum acceleration parameter check in build_trans

This commit is contained in:
jsullivan-anl
2006-09-22 17:43:14 +00:00
parent b96aedb643
commit ef1b7d30e8
3 changed files with 22 additions and 12 deletions
+12 -7
View File
@@ -243,14 +243,14 @@ STATIC RTN_STATUS PMNC87xx_build_trans(motor_cmnd command, double *parms, struct
// if (dType == PMD8751)
// sprintf(buff, "FIN A%d", drive);
// else
trans->state = IDLE_STATE; /* No command sent to the controller. */
// trans->state = IDLE_STATE; /* No command sent to the controller. */
sendMsg = false;
break;
case HOME_REV:
// if (dType == PMD8751)
// sprintf(buff, "RIN A%d", drive);
// else
trans->state = IDLE_STATE; /* No command sent to the controller. */
// trans->state = IDLE_STATE; /* No command sent to the controller. */
sendMsg = false;
break;
case LOAD_POS:
@@ -278,10 +278,10 @@ STATIC RTN_STATUS PMNC87xx_build_trans(motor_cmnd command, double *parms, struct
case SET_VEL_BASE:
if (dType == PMD8753)
{
if (abs(intval) > 1999)
intval = 1999;
if (abs(intval) >= MAX_VELOCITY)
intval = MAX_VELOCITY-1;
/* Set VEL to maximum to eliminate MPV out-of-range error */
sprintf(buff, "VEL A%d %d=2000", drive, motor);
sprintf(buff, "VEL A%d %d=%d", drive, motor, MAX_VELOCITY);
strcpy(motor_call->message, buff);
rtnval = motor_end_trans_com(mr, drvtabptr);
@@ -299,14 +299,19 @@ STATIC RTN_STATUS PMNC87xx_build_trans(motor_cmnd command, double *parms, struct
break;
case SET_VELOCITY:
if (abs(intval) > 2000)
intval = 2000;
if (abs(intval) > MAX_VELOCITY)
intval = MAX_VELOCITY;
sprintf(buff, "VEL A%d %d=%d", drive, motor, abs(intval));
break;
case SET_ACCEL:
/*
* The value passed is in steps/sec/sec.
*/
if (intval < MIN_ACCEL)
intval = MIN_ACCEL;
else if (intval > MAX_ACCEL)
intval = MAX_ACCEL;
sprintf(buff, "ACC A%d %d=%d", drive, motor, intval);
break;
case GO:
+5 -5
View File
@@ -133,7 +133,7 @@ STATIC int recv_mess(int, char *, int);
STATIC RTN_STATUS send_mess(int, char const *, char *);
STATIC int send_recv_mess(int, char const *, char *, char const *);
STATIC int set_status(int, int);
STATIC void start_status(int);
// STATIC void start_status(int);
static long report(int);
static long init();
STATIC int motor_init();
@@ -236,9 +236,9 @@ STATIC void query_done(int card, int axis, struct mess_node *nodeptr)
* start_status(int card)
* if card == -1 then start all cards
*********************************************************/
STATIC void start_status(int card)
{
}
// STATIC void start_status(int card)
// {
// }
/**************************************************************
* Parse status and position strings for a card and signal
@@ -303,7 +303,7 @@ STATIC int set_status(int card, int signal)
pStr = cntrl->chan_select_string[driverID];
recvRtn = send_recv_mess(card, buff, pStr, NULL);
CHECKRTN;
Debug(2, "start_status(): ChanSelect_string=%s\n", pStr);
Debug(2, "set_status(): ChanSelect_string=%s\n", pStr);
selectMotor = atoi(pStr);
}
else
+5
View File
@@ -47,6 +47,11 @@ Last Modified: 2004/08/17 21:28:22
#include "asynDriver.h"
#include "asynOctetSyncIO.h"
/* Motor Characteristics - in steps */
#define MAX_VELOCITY 2000
#define MIN_ACCEL 16
#define MAX_ACCEL 32000
/* Picomotor Network Controllers */
enum PMNC_model
{