Charles Young's development fork. Going forward I only want to push mature code to main repository.

Dependencies:   mbed

Fork of GEO_COUNTER_L432KC by Geo Electronics "Geo Counter"

Revision:
74:99e5a68160bc
Parent:
73:48f87b5ddafc
Child:
75:5af098188ebf
diff -r 48f87b5ddafc -r 99e5a68160bc main.cpp
--- a/main.cpp	Thu Sep 13 15:08:13 2018 -0700
+++ b/main.cpp	Thu Sep 13 15:20:28 2018 -0700
@@ -174,14 +174,15 @@
       Count2Avg[CountAvgIndex] = Count2;
       CountAvgIndex = ++CountAvgIndex % CountAvg;
 
+      // smooth counts while giving current count more weight
       uint32_t Count1Sum = 0, Count2Sum = 0;
       for (uint8_t i=0;i<CountAvg;i++)
       {
-         Count1Sum += Count1Avg[i];
-         Count2Sum += Count2Avg[i];
+         Count1Sum += Count1Avg[i] + Count1;
+         Count2Sum += Count2Avg[i] + Count2;
       }
-      Count1Save = Count1Sum / CountAvg;
-      Count2Save = Count2Sum / CountAvg;
+      Count1Save = Count1Sum / 2*CountAvg;
+      Count2Save = Count2Sum / 2*CountAvg;
       Count1 = 0;
       Count2 = 0;