commit 993386194c8b31131a7be91674735f29f34b3fe5
parent f8ce74e24c43e0d6022fdc6d21c95a7ded2e57fb
Author: mntmn <lukas@mntmn.com>
Date: Mon, 23 Mar 2020 15:42:15 +0100
kbd: clamp voltages to sane values
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/reform-keyboard2-fw-d3/Keyboard.c b/reform-keyboard2-fw-d3/Keyboard.c
@@ -223,6 +223,7 @@ void remote_get_voltages(void) {
remote_receive_string();
voltages[i] = ((float)atoi(response))/1000.0;
+ if (voltages[i]<0 || voltages[i]>=5) voltages[i]=0;
sum_volts += voltages[i];
}