From ddf1095b5f004c27cd89677b25e65d7090258363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20B=C3=B6gershausen?= Date: Mon, 15 May 2023 22:53:25 +0200 Subject: [PATCH] motorRecord.cc: Correct usage of accEGUfromVelo() The function accEGUfromVelo() returns acceleration in EGU, but we need it expressed in steps. Thanks to Kevin Peterson for noticing. Correct this and divide by fabs(pmr->mres). And while there, correct a typo in a comment --- motorApp/MotorSrc/motorRecord.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/motorApp/MotorSrc/motorRecord.cc b/motorApp/MotorSrc/motorRecord.cc index feceda94..4fb5ee4f 100644 --- a/motorApp/MotorSrc/motorRecord.cc +++ b/motorApp/MotorSrc/motorRecord.cc @@ -941,7 +941,7 @@ static long postProcess(motorRecord * pmr) if (pmr->mip & MIP_JOG_STOP) { - double acc = accEGUfromVelo(pmr, pmr->velo); + double acc = accEGUfromVelo(pmr, pmr->velo) / fabs(pmr->mres); if (vel <= vbase) vel = vbase + 1; @@ -2272,7 +2272,7 @@ static RTN_STATUS do_work(motorRecord * pmr, CALLBACK_VALUE proc_ind) double newpos = pmr->dval / pmr->mres; /* where to go */ double vbase = pmr->vbas / fabs(pmr->mres); /* base speed */ double vel = pmr->velo / fabs(pmr->mres); /* normal speed */ - double acc = accEGUfromVelo(pmr, pmr->velo); + double acc = accEGUfromVelo(pmr, pmr->velo) / fabs(pmr->mres); /* * 'bpos' is one backlash distance away from 'newpos'. */ @@ -3989,7 +3989,7 @@ static void check_speed_and_resolution(motorRecord * pmr) /* ACCL == 0.0, ACCS is != 0.0 -> Use ACCS This is a (possible) new way to configure a database. Existing Db files will have ACCS == 0.0 and this - is backwards compatibleamd behaves as before */ + is backwards compatible and behaves as before */ updateACCLfromACCS(pmr); } /* Sanity check on acceleration time. */