Merge pull request #98 from kmpeters/encoder_ratio_fix

Modified drivers that expect unsigned encoder ratio parameters, as discussed in issue #82.  This change preserves the behavior of the device support for the MM3000 and OMS controllers before pull request #84.
This commit is contained in:
Kevin Peterson authored and GitHub committed 2018-06-27 12:24:18 -05:00
commit a002988622
2 files changed
+6 -1

No files matched your search

+5
View File
@@ -42,6 +42,7 @@ USAGE... Motor record device level support for Newport MM3000.
#include <string.h>
#include <stdlib.h>
#include <errlog.h>
#include <math.h>
#include "motorRecord.h"
#include "motor.h"
#include "motordevCom.h"
@@ -276,6 +277,10 @@ STATIC RTN_STATUS MM3000_build_trans(motor_cmnd command, double *parms, struct m
*/
break;
case SET_ENC_RATIO:
/* The motor record no longer passes unsigned values */
parms[0] = fabs(parms[0]);
parms[1] = fabs(parms[1]);
/* MM3000 valid encoder ratio values < 10,000. */
while (parms[0] > 10000.0 || parms[1] > 10000.0)
{
+1 -1
View File
@@ -513,7 +513,7 @@ errorexit: errMessage(-1, "Invalid device directive");
if (MAXv == true && parms[0] == parms[1])
sprintf(buffer, " UF");
else
sprintf(buffer, " UU%f;", parms[0]/parms[1]);
sprintf(buffer, " UU%f;", fabs(parms[0]/parms[1]));
strcat(motor_call->message, buffer);
break;