Jason Cheers / analogAverager

Files at this revision

API Documentation at this revision

Comitter:
masterkookus
Date:
Mon Oct 07 12:44:29 2019 +0000
Parent:
0:13ce3869e3dd
Commit message:
Added percent or value option

Changed in this revision

analogAverager.cpp Show annotated file Show diff for this revision Revisions of this file
analogAverager.h Show annotated file Show diff for this revision Revisions of this file
--- a/analogAverager.cpp	Wed Oct 02 19:14:45 2019 +0000
+++ b/analogAverager.cpp	Mon Oct 07 12:44:29 2019 +0000
@@ -1,12 +1,26 @@
 #include "analogAverager.h"
 
-analogAverager::analogAverager(float nominalVal, bool useMinLimit, float minPercent, bool useMaxLimit, float maxPercent)
+analogAverager::analogAverager(float nominalVal, bool useMinLimit, bool minIsPercent, float minSetVal, bool useMaxLimit, bool maxIsPercent, float maxSetVal)
 {
     nomVal = nominalVal;
     maxLim=useMinLimit;
     minLim=useMaxLimit;
-    minVal = nominalVal*minPercent;
-    maxVal = nominalVal*maxPercent;
+    if (minIsPercent)
+    {
+        minVal = nominalVal*minSetVal;
+    }
+    else
+    {
+        minVal = minSetVal;
+    }
+    if (maxIsPercent)
+    {
+        maxVal = nominalVal*maxSetVal;
+    }
+    else
+    {
+        maxVal = maxSetVal;
+    }
     sampleNum=0;
 }
 
--- a/analogAverager.h	Wed Oct 02 19:14:45 2019 +0000
+++ b/analogAverager.h	Mon Oct 07 12:44:29 2019 +0000
@@ -13,7 +13,7 @@
         float nomVal;
         
     public:
-        analogAverager(float, bool, float, bool, float);
+        analogAverager(float, bool, bool, float, bool, bool, float);
         void putVal(float);
         float getAvg(void);
         void resetNum(void);