mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-28 16:52:33 +01:00
WIDE and bmp add
This commit is contained in:
@@ -13,21 +13,33 @@ extern String fifthLine;
|
||||
|
||||
namespace BME_Utils {
|
||||
|
||||
#ifndef BMPSensor
|
||||
Adafruit_BME280 bme;
|
||||
#else
|
||||
Adafruit_BMP280 bme;
|
||||
#endif
|
||||
|
||||
void setup() {
|
||||
if (Config.bme.active) {
|
||||
bool status;
|
||||
status = bme.begin(0x76); // Don't forget to join pins for righ direction on BME280!
|
||||
if (!status) {
|
||||
Serial.println("Could not find a valid BME280 sensor, check wiring!");
|
||||
show_display("ERROR", "", "BME sensor active", "but no sensor found...");
|
||||
Serial.println("Could not find a valid BME280 or BMP280 sensor, check wiring!");
|
||||
show_display("ERROR", "", "BME/BMP sensor active", "but no sensor found...");
|
||||
while (1); // sacar esto para que quede pegado si no encuentra BME280
|
||||
} else {
|
||||
#ifndef BMPSensor
|
||||
Serial.println("init : BME280 Module ... done!");
|
||||
#else
|
||||
Serial.println("init : BMP280 Module ... done!");
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
#ifndef BMPSensor
|
||||
Serial.println("(BME not 'active' in 'igate_conf.json')");
|
||||
#else
|
||||
Serial.println("(BMP not 'active' in 'igate_conf.json')");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +110,12 @@ String generatePresString(float bmePress) {
|
||||
String readDataSensor() {
|
||||
String wx, tempStr, humStr, presStr;
|
||||
float newTemp = bme.readTemperature();
|
||||
float newHum = bme.readHumidity();
|
||||
float newHum;
|
||||
#ifndef BMPSensor
|
||||
newHum = bme.readHumidity();
|
||||
#else
|
||||
newHum = 0;
|
||||
#endif
|
||||
float newPress = (bme.readPressure() / 100.0F);
|
||||
|
||||
//bme.readAltitude(SEALEVELPRESSURE_HPA) // this is for approximate Altitude Calculation.
|
||||
@@ -110,7 +127,11 @@ String readDataSensor() {
|
||||
return wx;
|
||||
} else {
|
||||
tempStr = generateTempString((newTemp * 1.8) + 32);
|
||||
#ifndef BMPSensor
|
||||
humStr = generateHumString(newHum);
|
||||
#else
|
||||
humStr = "-99";
|
||||
#endif
|
||||
presStr = generatePresString(newPress + (HEIGHT_CORRECTION/CORRECTION_FACTOR));
|
||||
fifthLine = "BME-> " + String(int(newTemp))+"C " + humStr + "% " + presStr.substring(0,4) + "hPa";
|
||||
wx = ".../...g...t" + tempStr + "r...p...P...h" + humStr + "b" + presStr;
|
||||
|
||||
Reference in New Issue
Block a user