From: DL1YCF <dl1ycf@darc.de>
Date: Sun, 19 Sep 2021 21:32:48 +0000 (+0200)
Subject: Implement "rounding" for ABSOLUTE changes
X-Git-Url: https://git.rkrishnan.org/components/specifications/flags/%22..?a=commitdiff_plain;h=c7336628e042df5d1a6ee001b3b35d6fce6a2f0e;p=pihpsdr.git

Implement "rounding" for ABSOLUTE changes
---

diff --git a/actions.c b/actions.c
index c4b7afc..613b2e0 100644
--- a/actions.c
+++ b/actions.c
@@ -211,6 +211,10 @@ static inline double KnobOrWheel(PROCESS_ACTION *a, double oldval, double minval
       break;
     case ABSOLUTE:
       oldval = minval + a->val*(maxval-minval)*0.01;
+      //
+      // Round the new value to a multiple of inc
+      //
+      oldval=inc*round(oldval/inc);
       break;
     default:
       // do nothing
@@ -842,8 +846,6 @@ int process_action(void *data) {
       break;
     case PANADAPTER_STEP:
       value=KnobOrWheel(a, active_receiver->panadapter_step, 5.0, 30.0, 1.0);
-      // restrict to multiples of 5
-      active_receiver->panadapter_step=(int)(value*0.2)+5;
       break;
     case PREAMP:
     case PS: