From 4ab7c9eb681b133dcfeee1ecdd318780e6df170e Mon Sep 17 00:00:00 2001 From: Gediminas Jakutis Date: Fri, 16 Feb 2018 13:41:21 +0200 Subject: tempmodule: not even close to overflowing, swtich 64b -> 32b. --- src/tempmodule/temperature.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/tempmodule/temperature.c') diff --git a/src/tempmodule/temperature.c b/src/tempmodule/temperature.c index 4f0a5f1..52fd7b7 100644 --- a/src/tempmodule/temperature.c +++ b/src/tempmodule/temperature.c @@ -16,7 +16,6 @@ struct temptuple { * * Rt = Ra * Vcc / Vt - Ra * - * Using 64-bit arithmetic as 32-bit would overflow. * On WeMOS D1 Mini the A0 reads 3.2V as 1023; our Vcc is 3.31V * The correct value of the reference volume obtained by measuring * resistances with a multimeter, taking the ADC reading and applying @@ -24,7 +23,7 @@ struct temptuple { * We shift the range by one to avoid division by zero. */ -int get_resistance(int64_t vt, int64_t ra) +int get_resistance(int vt, int ra) { ++vt; return ra * 1081 / vt - ra; -- cgit v1.2.3