From 3128b41aa600464effd75dc771c2500729b0cbdb Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Sun, 4 Sep 2022 13:47:53 +0200 Subject: [PATCH] Compensate soldering offset for barometer/thermometer --- src/main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 4a100c7..7a32b3f 100644 --- a/src/main.c +++ b/src/main.c @@ -5,6 +5,11 @@ #include "minmea.h" //#define HZ2MS(X) ((uint64_t)((X * 53000.0)/(SystemCoreClock))) +// +#define BMP180_SOLDERING_OFF_T 190 +#define BMP180_SOLDERING_OFF_P 12050 + + void init_uart0(void) @@ -412,9 +417,6 @@ int main(void) /* Read calibration registers */ bmp180_calibrate(); - - - while (1) { read_gps(&gps_data); @@ -430,6 +432,10 @@ int main(void) LCD_ShowString(0, 48, (u8 *)(prs), GREEN); LCD_ShowString(0, 64, (u8 *)(tmp), GREEN); + /* Device offset */ + ut -= BMP180_SOLDERING_OFF_T; + up -= BMP180_SOLDERING_OFF_P; + temperature = compensate_temperature(ut); pressure = compensate_pressure(up); snprintf(tmp, MAX_ROW - 1, "T: %d", temperature);