From ea4d2017a4b145783c899f807006c3ea2e63d6c8 Mon Sep 17 00:00:00 2001 From: nedko Date: Wed, 9 Nov 2022 12:11:34 +0200 Subject: [PATCH] Fixed negative temp and voltage numbers --- code/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/main.c b/code/main.c index 3d0bf81..a4e9b28 100644 --- a/code/main.c +++ b/code/main.c @@ -1415,7 +1415,7 @@ int8_t read_battery(int16_t *mAh, int16_t *mV, int16_t *temp) // If bit 11 is set if (val & 0x00000800) { - val -= 2048; + val -= 4096; } // Transform into mV @@ -1431,7 +1431,7 @@ int8_t read_battery(int16_t *mAh, int16_t *mV, int16_t *temp) // If bit 11 is set if (val & 0x00000800) { - val -= 2048; + val -= 4096; } // Transform into temp