summaryrefslogtreecommitdiff
path: root/shared/util.h
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-26 15:20:55 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-26 15:20:55 +0200
commit1913a240aab3a2ad72d477aa6fff840afdcad7a3 (patch)
treefb5e1493726ce6dddc3c812aa9730e4a856dabd3 /shared/util.h
parent9c1f3dcc98b639e3bbcb6a8e199d8f1aa4bcc42a (diff)
implement mode history
Diffstat (limited to 'shared/util.h')
-rw-r--r--shared/util.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/shared/util.h b/shared/util.h
index 95f4c68..9e4d8ac 100644
--- a/shared/util.h
+++ b/shared/util.h
@@ -1,3 +1,7 @@
#pragma once
+#define W2_MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define W2_MAX(a, b) (((a) > (b)) ? (a) : (b))
+#define W2_RANGE(min, val, max) W2_MIN(max, W2_MAX(val, min))
+
unsigned long w2_util_exp_mov_avg(unsigned long current_avg, unsigned long new_meas);