From f353e78916a57fe21084fe34fd80c13ae4844d32 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 26 May 2022 12:42:34 +0200 Subject: implement info command --- shared/util.c | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 shared/util.c (limited to 'shared/util.c') 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)))); +} -- cgit v1.2.3