summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tempmodule/temperature.c3
-rw-r--r--src/tempmodule/temperature.h4
2 files changed, 2 insertions, 5 deletions
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;
diff --git a/src/tempmodule/temperature.h b/src/tempmodule/temperature.h
index 8d990be..72189bb 100644
--- a/src/tempmodule/temperature.h
+++ b/src/tempmodule/temperature.h
@@ -1,13 +1,11 @@
#ifndef TEMPERATURE_INCLUDED
#define TEMPERATURE_INCLUDED
-#include <inttypes.h>
-
#ifdef __cplusplus
extern "C" {
#endif
-int get_resistance(int64_t vt, int64_t ra);
+int get_resistance(int vt, int ra);
int get_temperature(int res);
int get_temp_subrange(short a, short b, int res);