From b0632d558b09e7047e4e433cca330d27e0c9100d Mon Sep 17 00:00:00 2001 From: Ron Sluiter Date: Thu, 24 Mar 2005 17:39:22 +0000 Subject: [PATCH] Override invalid acceleration rates. --- motorApp/OmsSrc/devOmsCom.cc | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/motorApp/OmsSrc/devOmsCom.cc b/motorApp/OmsSrc/devOmsCom.cc index 3a54e889..031e4597 100644 --- a/motorApp/OmsSrc/devOmsCom.cc +++ b/motorApp/OmsSrc/devOmsCom.cc @@ -2,9 +2,9 @@ FILENAME... devOmsCom.cc USAGE... Data and functions common to all OMS device level support. -Version: $Revision: 1.7 $ +Version: $Revision: 1.8 $ Modified By: $Author: sluiter $ -Last Modified: $Date: 2005-03-21 18:05:00 $ +Last Modified: $Date: 2005-03-24 17:39:22 $ */ /* @@ -55,6 +55,7 @@ Last Modified: $Date: 2005-03-21 18:05:00 $ * .11 06-16-04 rls Terminate "LP" command with ";" to prevent MAXv stale data. * .12 08-27-04 rls Terminate "JG" command with ";" to prevent MAXv stale data. * .13 03-21-05 rls OSI - built for solaris and linux hosts. + * .14 03-23-05 rls restrict acceleration to valid values. */ #include @@ -393,7 +394,11 @@ errorexit: errMessage(-1, "Invalid device directive"); vel = NINT(parms[itera]); if (vel <= vbase) + { + errPrintf(-1, __FILE__, __LINE__, + "Overriding invalid velocity; slew <= base.\n"); vel = vbase + 1; + } sprintf(buffer, "%ld", vel); } break; @@ -411,6 +416,24 @@ errorexit: errMessage(-1, "Invalid device directive"); } break; + case SET_ACCEL: /* Prevent invalid acceleration values. */ + { + long valid_acc = NINT(parms[itera]); + + if (valid_acc < 1 || valid_acc > 1000000000) + { + errPrintf(-1, __FILE__, __LINE__, + "Overriding invalid acceleration.\n"); + + if (valid_acc < 1) + valid_acc = 1; + else + valid_acc = 1000000000; + } + sprintf(buffer, "%ld", valid_acc); + } + break; + default: sprintf(buffer, "%ld", NINT(parms[itera])); }