Skip to content

Commit 6cbe817

Browse files
committed
test1
1 parent b4261f3 commit 6cbe817

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/wx_utils.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,14 @@ namespace WX_Utils {
224224
}
225225
}
226226

227+
float getAltitudeCorrection() {
228+
#ifdef HAS_GPS
229+
return Config.beacon.gpsActive ? gps.altitude.meters() : Config.wxsensor.heightCorrection;
230+
#else
231+
return Config.wxsensor.heightCorrection;
232+
#endif
233+
}
234+
227235
String readDataSensor() {
228236
switch (wxModuleType) {
229237
case 1: // BME280
@@ -282,11 +290,7 @@ namespace WX_Utils {
282290

283291
String presStr = (wxModuleType == 4 || wxModuleType == 5)
284292
? "....."
285-
#ifdef HAS_GPS
286-
: generatePresString(newPress + (gps.altitude.meters() / CORRECTION_FACTOR));
287-
#else
288-
: generatePresString(newPress + (Config.wxsensor.heightCorrection / CORRECTION_FACTOR));
289-
#endif
293+
: generatePresString(newPress + getAltitudeCorrection() / CORRECTION_FACTOR);
290294

291295
fifthLine = "BME-> ";
292296
fifthLine += String(int(newTemp + Config.wxsensor.temperatureCorrection));

0 commit comments

Comments
 (0)