From c3d94d673a23959720ba9761ccc3c9a962dd49aa Mon Sep 17 00:00:00 2001 From: richonguzman Date: Mon, 24 Feb 2025 16:17:01 -0300 Subject: [PATCH] height correction with gps --- src/wx_utils.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/wx_utils.cpp b/src/wx_utils.cpp index 183c853..0e451d0 100644 --- a/src/wx_utils.cpp +++ b/src/wx_utils.cpp @@ -1,4 +1,6 @@ +#include #include "configuration.h" +#include "board_pinout.h" #include "wx_utils.h" #include "display.h" @@ -8,6 +10,9 @@ extern Configuration Config; extern String fifthLine; +#ifdef HAS_GPS +extern TinyGPSPlus gps; +#endif int wxModuleType = 0; uint8_t wxModuleAddress = 0x00; @@ -227,7 +232,13 @@ namespace WX_Utils { humStr = ".."; } - String presStr = (wxModuleAddress == 4) ? "....." : generatePresString(newPress + (Config.wxsensor.heightCorrection/CORRECTION_FACTOR)); + String presStr = (wxModuleAddress == 4) + ? "....." + #ifdef HAS_GPS + : generatePresString(newPress + (gps.altitude.meters() / CORRECTION_FACTOR)); + #else + : generatePresString(newPress + (Config.wxsensor.heightCorrection / CORRECTION_FACTOR)); + #endif fifthLine = "BME-> "; fifthLine += String(int(newTemp + Config.wxsensor.temperatureCorrection));