From 0aaf02d779996eb1c06a4329823aadcdbb8c12cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20B=C3=B6gershausen?= Date: Tue, 11 Feb 2025 15:13:36 +0100 Subject: [PATCH] motorRecord: prevent endless loop VAL-HOMF-VAL The following lead to an endless loop: - move the motor by writing to the .VAL field - while moving, home the motor using the HOMF field - while still homing, write a different value to the VAL field. The problem is that for "pmr->val != pmr->lval" the motorRecord is send into do_work() and a new HOME is started. Solution: Reset the HOMF and HOMR buttons. --- motorApp/MotorSrc/motorRecord.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/motorApp/MotorSrc/motorRecord.cc b/motorApp/MotorSrc/motorRecord.cc index ae78a176..9775f96a 100644 --- a/motorApp/MotorSrc/motorRecord.cc +++ b/motorApp/MotorSrc/motorRecord.cc @@ -1385,6 +1385,13 @@ static long process(dbCommon *arg) !(pmr->mip & MIP_STOP) && !(pmr->mip & MIP_JOG_STOP)) { + if (pmr->mip == MIP_HOMF || pmr->mip == MIP_HOMR) + { + /* Bug fix: motor enters an infinite HOME loop + in a sequence where VAL HOMF VAL is written */ + clear_buttons(pmr); + } + pmr->mip = MIP_DONE; /* Bug fix, record locks-up when BDST != 0, DLY != 0 and * new target position before backlash correction move.*/