mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-01-23 09:10:15 +01:00
AHT20 add
This commit is contained in:
parent
b5d9103ea5
commit
0bd3201ef7
|
|
@ -25,6 +25,7 @@ build_flags =
|
|||
-I variants/${PIOENV}
|
||||
lib_deps =
|
||||
adafruit/Adafruit Unified Sensor @ 1.1.14
|
||||
adafruit/Adafruit AHTX0 @ 2.0.5
|
||||
adafruit/Adafruit BME280 Library @ 2.2.4
|
||||
adafruit/Adafruit BMP280 Library @ 2.6.8
|
||||
adafruit/Adafruit BME680 Library @ 2.0.4
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#define WX_UTILS_H_
|
||||
|
||||
#include <Adafruit_Sensor.h>
|
||||
#include <Adafruit_AHTX0.h>
|
||||
#include <Adafruit_BME280.h>
|
||||
#include <Adafruit_BMP280.h>
|
||||
#include <Adafruit_BME680.h>
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ ___________________________________________________________________*/
|
|||
#endif
|
||||
|
||||
|
||||
String versionDate = "2025-11-30";
|
||||
String versionDate = "2025-12-01";
|
||||
String versionNumber = "3.1.5";
|
||||
Configuration Config;
|
||||
WiFiClient aprsIsClient;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ float newHum, newTemp, newPress, newGas;
|
|||
|
||||
|
||||
Adafruit_BME280 bme280;
|
||||
Adafruit_AHTX0 aht20;
|
||||
#if defined(HELTEC_V3) || defined(HELTEC_V3_2)
|
||||
Adafruit_BMP280 bmp280(&Wire1);
|
||||
Adafruit_Si7021 si7021 = Adafruit_Si7021();
|
||||
|
|
@ -119,6 +120,10 @@ namespace WX_Utils {
|
|||
Serial.println("BMP280 sensor found");
|
||||
wxModuleType = 2;
|
||||
wxModuleFound = true;
|
||||
if (aht20.begin()) {
|
||||
Serial.println("AHT20 sensor found");
|
||||
if (wxModuleType == 2) wxModuleType = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (wxModuleAddress == 0x40) {
|
||||
|
|
@ -127,7 +132,7 @@ namespace WX_Utils {
|
|||
wxModuleType = 4;
|
||||
wxModuleFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef LIGHTGATEWAY_PLUS_1_0
|
||||
else if (wxModuleAddress == 0x70) {
|
||||
if (shtc3.begin()) {
|
||||
|
|
@ -273,7 +278,15 @@ namespace WX_Utils {
|
|||
newPress = 0;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 6: // BMP280 + AHT20
|
||||
bmp280.takeForcedMeasurement();
|
||||
newTemp = bmp280.readTemperature();
|
||||
newPress = (bmp280.readPressure() / 100.0F);
|
||||
sensors_event_t humidity, temp;
|
||||
aht20.getEvent(&humidity, &temp);
|
||||
newHum = humidity.relative_humidity;
|
||||
break;
|
||||
}
|
||||
|
||||
if (isnan(newTemp) || isnan(newHum) || isnan(newPress)) {
|
||||
Serial.println("BME/BMP/Si7021 Module data failed");
|
||||
|
|
@ -281,16 +294,16 @@ namespace WX_Utils {
|
|||
return ".../...g...t...";
|
||||
} else {
|
||||
String tempStr = generateTempString(((newTemp + Config.wxsensor.temperatureCorrection) * 1.8) + 32);
|
||||
|
||||
|
||||
String humStr;
|
||||
if (wxModuleType == 1 || wxModuleType == 3 || wxModuleType == 4 || wxModuleType == 5) {
|
||||
if (wxModuleType == 1 || wxModuleType == 3 || wxModuleType == 4 || wxModuleType == 5 || wxModuleType == 6) {
|
||||
humStr = generateHumString(newHum);
|
||||
} else if (wxModuleType == 2) {
|
||||
humStr = "..";
|
||||
}
|
||||
|
||||
|
||||
String presStr = (wxModuleType == 4 || wxModuleType == 5)
|
||||
? "....."
|
||||
? "....."
|
||||
: generatePresString(newPress + getAltitudeCorrection() / CORRECTION_FACTOR);
|
||||
|
||||
fifthLine = "BME-> ";
|
||||
|
|
|
|||
Loading…
Reference in a new issue