Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add raw limits so that soft limits are synced with motor resolution change #193

Merged
merged 3 commits into from
May 12, 2023

Conversation

rerpha
Copy link
Contributor

@rerpha rerpha commented Nov 21, 2022

Fixes #191

@kmpeters kmpeters self-requested a review November 30, 2022 15:29
@rerpha
Copy link
Contributor Author

rerpha commented Apr 18, 2023

hi, was just wondering if you had a chance to review this? Cheers

@kmpeters
Copy link
Member

I plan to test this soon. I want to include it in the next motor release.

@kmpeters
Copy link
Member

I'm testing this pull request with simulated motors. When I change a dial limit, a camonitor shows the dial limit updates twice (both times with the same value) and the raw limits don't update.

@kmpeters
Copy link
Member

The double-camonitor-entries-for-the-limit-being-changed behavior is apparently normal behavior that is also present on the master branch.

I see the RHLM and RLLM values change in dbpr output from iocsh, but ca clients only get the correct value at the time they connect.

@kmpeters
Copy link
Member

Marking the raw limit fields isn't enough to solve the problem.

diff --git a/motorApp/MotorSrc/motorRecord.cc b/motorApp/MotorSrc/motorRecord.cc
index 77658993..91bd4928 100644
--- a/motorApp/MotorSrc/motorRecord.cc
+++ b/motorApp/MotorSrc/motorRecord.cc
@@ -3982,11 +3982,13 @@ static void set_user_highlimit(motorRecord* pmr, struct motor_dset* pdset)
         {
             pmr->dhlm = tmp_limit;
             pmr->rhlm = tmp_raw;
+            MARK_AUX(M_RHLM);
         }
         else
         {
             pmr->dllm = tmp_limit;
-            pmr->rllm = tmp_limit;
+            pmr->rllm = tmp_raw;
+            MARK_AUX(M_RLLM);
         }
     }
     MARK(M_HLM);
@@ -4052,11 +4054,13 @@ static void set_user_lowlimit(motorRecord* pmr, struct motor_dset* pdset)
         if (dir_positive) {
             pmr->dllm = tmp_limit;
             pmr->rllm = tmp_raw;
+            MARK_AUX(M_RLLM);
         }
         else
         {
             pmr->dhlm = tmp_limit;
             pmr->rhlm = tmp_raw;
+            MARK_AUX(M_RHLM);
         }
 
     }
@@ -4082,6 +4086,7 @@ static void set_dial_highlimit(motorRecord *pmr, struct motor_dset *pdset)
     tmp_raw = pmr->dhlm / pmr->mres;
     // set the raw high limit
     pmr->rhlm = tmp_raw;
+    MARK_AUX(M_RHLM);
 
     INIT_MSG();
     if (pmr->mres < 0) {
@@ -4125,7 +4130,7 @@ static void set_dial_lowlimit(motorRecord *pmr, struct motor_dset *pdset)
     tmp_raw = pmr->dllm / pmr->mres;
     // set the raw low limit
     pmr->rllm = tmp_raw;
-
+    MARK_AUX(M_RLLM);
 
     INIT_MSG();
     if (pmr->mres < 0) {

@kmpeters
Copy link
Member

Adding these lines fixes the ca-clients-failing-to-update problem:

diff --git a/motorApp/MotorSrc/motorRecord.cc b/motorApp/MotorSrc/motorRecord.cc
index 77658993..e4a106b8 100644
--- a/motorApp/MotorSrc/motorRecord.cc
+++ b/motorApp/MotorSrc/motorRecord.cc
@@ -3527,6 +3527,10 @@ static void monitor(motorRecord * pmr)
         db_post_events(pmr, &pmr->homf, local_mask);
     if ((local_mask = monitor_mask | (MARKED_AUX(M_HOMR) ? DBE_VAL_LOG : 0)))
         db_post_events(pmr, &pmr->homr, local_mask);
+    if ((local_mask = monitor_mask | (MARKED_AUX(M_RHLM) ? DBE_VAL_LOG : 0)))
+        db_post_events(pmr, &pmr->rhlm, local_mask);
+    if ((local_mask = monitor_mask | (MARKED_AUX(M_RLLM) ? DBE_VAL_LOG : 0)))
+        db_post_events(pmr, &pmr->rllm, local_mask);

@kmpeters
Copy link
Member

kmpeters commented May 12, 2023

Commit 99d0c41 fixed updating RHLM/RLLM when HLM/DHLM/LLM/DHLM change, but not when the resolution changes.

@kmpeters
Copy link
Member

Commit 99d0c41 fixed updating RHLM/RLLM when HLM/DHLM/LLM/DHLM change, but not when the resolution changes.

RHLM/RLLM shouldn't change when MRES changes.

@kmpeters kmpeters merged commit cd09677 into epics-modules:master May 12, 2023
@kmpeters kmpeters added this to the R7-3 milestone May 23, 2023
@rerpha rerpha deleted the rawlimits branch December 10, 2024 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

user/dial limits: change when motor/encoder resolution changes
2 participants