From 8d1891c5a7510391a68dd4a535260c133c2b92ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20B=C3=B6gershausen?= Date: Tue, 8 Jan 2019 10:40:30 +0100 Subject: [PATCH] motorRecord.cc: Make sure that ACCS/ACCU are initialized When the record is initialized, it could happen that the ACCS field was not initalized at all. Fix this: - Introduce a new value for motorACCSused, motorACCSused_Undef. This is == 0, and temporally used until the record is initilized. Using 0 as Undef will allow a (mis-) use in e.g. CSS to make the ACCS field invisable, whe ACCU is 0 (or not present at all in an older version of the motorRecord) - At the end of check_speed_and_resolution() set ACCS and ACCU, if needed. --- motorApp/MotorSrc/motorRecord.cc | 5 +++++ motorApp/MotorSrc/motorRecord.dbd | 1 + 2 files changed, 6 insertions(+) diff --git a/motorApp/MotorSrc/motorRecord.cc b/motorApp/MotorSrc/motorRecord.cc index 8ae0e92b..3c806bf9 100644 --- a/motorApp/MotorSrc/motorRecord.cc +++ b/motorApp/MotorSrc/motorRecord.cc @@ -4032,6 +4032,11 @@ static void check_speed_and_resolution(motorRecord * pmr) pmr->hvel = pmr->vbas; else range_check(pmr, &pmr->hvel, pmr->vbas, pmr->vmax); + /* Make sure that ACCS/ACCU are initialized */ + if (pmr->accu == motorACCSused_Undef) + { + updateACCSfromACCL(pmr); + } } /* diff --git a/motorApp/MotorSrc/motorRecord.dbd b/motorApp/MotorSrc/motorRecord.dbd index 64c7bd13..101e468f 100644 --- a/motorApp/MotorSrc/motorRecord.dbd +++ b/motorApp/MotorSrc/motorRecord.dbd @@ -70,6 +70,7 @@ menu(motorRMOD) { } menu(motorACCSused) { + choice(motorACCSused_Undef,"Undef") choice(motorACCSused_Accl, "Accl") choice(motorACCSused_Accs, "Accs") }