summaryrefslogtreecommitdiff
path: root/shared/util.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-26 12:42:34 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-26 12:42:34 +0200
commitf353e78916a57fe21084fe34fd80c13ae4844d32 (patch)
tree392a8d6bfccad7beb70e253ad7c1786934d5657b /shared/util.c
parent54b69efe150e1a102faafb4e214159c92abbb841 (diff)
implement info command
Diffstat (limited to 'shared/util.c')
-rw-r--r--shared/util.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/shared/util.c b/shared/util.c
new file mode 100644
index 0000000..55f3491
--- /dev/null
+++ b/shared/util.c
@@ -0,0 +1,6 @@
+#include "consts.h"
+
+unsigned long w2_util_exp_mov_avg(unsigned long current_avg, unsigned long new_meas) {
+ return (unsigned long)((((double)(current_avg)) * ((double)(1.f - W2_EMA_WEIGHT))) +
+ (((double)(new_meas)) * ((double)(W2_EMA_WEIGHT))));
+}